Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages | Examples

informational.h

00001 //  Copyright (c) 1996-2001 by Autodesk, Inc.
00002 //
00003 //  By using this code, you are agreeing to the terms and conditions of
00004 //  the License Agreement included in the documentation for this code.
00005 //
00006 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00007 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00008 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00009 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00010 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00011 //
00012 //  Use, duplication, or disclosure by the U.S. Government is subject to
00013 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00014 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00015 //  Data and Computer Software), as applicable.
00016 //
00017 
00018 #if !defined INFORMATIONAL_HEADER
00019 #define INFORMATIONAL_HEADER
00020 
00021 #include "whiptk/whipcore.h"
00022 #include "whiptk/object.h"
00023 
00024 
00025 #define DECLARE_INFORMATIONAL_CLASS(class_name)\
00026     class WHIPTK_API WT_##class_name : public WT_Informational {\
00027     public: \
00028         WT_ID object_id() const;\
00029         WT_Type        object_type() const;\
00030         WT_Result      process(WT_File & file);\
00031         WT_Result      serialize(WT_File & file) const;\
00032  static WT_Result default_process(  WT_##class_name & item, WT_File & file );\
00033     };
00034 
00035 #define IMPLEMENT_INFORMATIONAL_CLASS_FUNCTIONS(class_name, class_lower, class_type, class_command)\
00036     WT_Object::WT_ID    WT_##class_name::object_id() const\
00037         {return class_name##_ID;}\
00038     WT_Object::WT_Type WT_##class_name::object_type() const\
00039         {return class_type;}\
00040     WT_Result WT_##class_name::serialize(WT_File & file) const\
00041         {return WT_Informational::serialize (file, class_command);}\
00042     WT_Result WT_##class_name::process(WT_File & file)\
00043         {WD_Assert (file.class_lower##_action());\
00044             return (file.class_lower##_action())(*this, file);}\
00045     WT_Result WT_##class_name::default_process(WT_##class_name & item, WT_File & file)\
00046         {   file.rendition().drawing_info().class_lower() = item;\
00047             preprocess_workarounds(item, file);\
00048             return WT_Result::Success;}
00049 
00050 
00059 
00060 
00065 class WHIPTK_API WT_Informational : public WT_Object
00066 {
00067 protected:
00068 
00069     WT_String m_string; 
00071 
00072     enum WT_Materialize_Stage
00073     {
00074         Eating_Initial_Whitespace,
00075         Gathering_String,
00076         Eating_End_Whitespace
00077     } m_stage;
00078 
00079 protected:
00081     static WT_Result preprocess_workarounds(WT_Object & item, WT_File & file);
00082 
00083 public:
00084 
00086     WT_Informational ()
00087         : m_stage (Eating_Initial_Whitespace)
00088     {}
00089 
00091     WT_Informational(char * string)
00092         : m_stage (Eating_Initial_Whitespace)
00093     {   set(string);    }
00094 
00096     WT_Informational(WT_Unsigned_Integer16 * string)
00097         : m_stage (Eating_Initial_Whitespace)
00098     {   set(string);    }
00099 
00101     WT_Informational(WT_Informational const & info)
00102         : WT_Object()
00103         , m_stage (Eating_Initial_Whitespace)
00104     {
00105         set(info.string());
00106     }
00107 
00109     WT_Result            materialize(WT_Opcode const & opcode, WT_File & file);
00111     WT_Result            serialize(WT_File & file, char const * name) const;
00112     WT_Result            skip_operand(WT_Opcode const & opcode, WT_File & file);
00114 
00116 
00117     void                set(char const * info);
00119     void                set(WT_Unsigned_Integer16 const * info);
00121     void                set(int length, WT_Unsigned_Integer16 const * info);
00123     void                set(WT_String const & info);
00125     WT_String const &   string(void) const
00126     {   return m_string;    }
00128     WT_Informational const & operator=(WT_Informational const & info)
00129     {
00130         set(info.string());
00131         return *this;
00132     }
00134     WT_Informational const & operator=(char * info)
00135     {
00136         set(info);
00137         return *this;
00138     }
00140 };
00141 
00143  \
00144 DECLARE_INFORMATIONAL_CLASS (Author)
00146  \
00147 DECLARE_INFORMATIONAL_CLASS (Comments)
00149  \
00150 DECLARE_INFORMATIONAL_CLASS (Copyright)
00152  \
00153 DECLARE_INFORMATIONAL_CLASS (Creator)
00155  \
00156 DECLARE_INFORMATIONAL_CLASS (Description)
00158  \
00159 DECLARE_INFORMATIONAL_CLASS (Keywords)
00161  \
00162 DECLARE_INFORMATIONAL_CLASS (Title)
00164  \
00165 DECLARE_INFORMATIONAL_CLASS (Subject)
00167  \
00168 DECLARE_INFORMATIONAL_CLASS (Source_Filename)
00169 
00170 
00171 
00172 #endif // INFORMATIONAL_HEADER

Generated on Tue May 17 12:07:44 2005 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.1