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

timestamp.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 TIMESTAMP_HEADER
00019 #define TIMESTAMP_HEADER
00020 
00021 #include "whiptk/whipcore.h"
00022 #include "whiptk/object.h"
00023 
00025 class WHIPTK_API WT_Timestamp : public WT_Object
00026 {
00027 protected:
00028 
00029     // Don't need to document this
00030     #ifndef DOXYGEN_IGNORE
00031     WT_String               m_string;
00032     WT_Integer32            m_seconds;
00033     WT_String               m_guid;
00034 
00035     enum WT_Materialize_Stage
00036     {
00037         Eating_Initial_Whitespace,
00038         Gathering_Seconds,
00039         Eating_Middle_Whitespace,
00040         Gathering_String,
00041         Eating_Next_Whitespace,
00042         Gathering_GUID,
00043         Eating_End_Whitespace
00044     } m_stage;
00045     #endif
00046 
00047 public:
00048 
00050 
00051     WT_Timestamp ()
00052         : m_seconds (0)
00053         , m_stage (Eating_Initial_Whitespace)
00054     {}
00055 
00057     WT_Timestamp(
00058         WT_Integer32 seconds, 
00059         char const * exAsciiOpcode 
00060         );
00061 
00063     WT_Timestamp(WT_Timestamp const & ts)
00064         : WT_Object()
00065         , m_seconds (ts.seconds())
00066         , m_stage (Eating_Initial_Whitespace)
00067     {
00068         set(ts.string());
00069     }
00071 
00073 
00074     WT_String const & string(void) const {   return m_string;    }
00075 
00077     WT_Integer32 seconds(void) const    {   return m_seconds;   }
00078 
00080     WT_String const & guid(void) const {   return m_guid;      }
00081 
00083     void       set(char const * exAsciiOpcode);
00085     void       set(WT_String const & exAsciiOpcode);
00087     void       set(WT_Unsigned_Integer16 const * exAsciiOpcode);
00089     void       set(
00090         WT_Integer32 seconds, 
00091         char const * exAsciiOpcode 
00092         );
00094     void       set(
00095         WT_Integer32 seconds, 
00096         WT_String const & string 
00097         );
00099     void       set(
00100         WT_Integer32 seconds, 
00101         WT_Unsigned_Integer16 const * string 
00102         );
00104     void       set(WT_Timestamp const & ts);
00106     void       set_guid(WT_String const & guid);
00107 
00109     WT_Timestamp const & operator=(WT_Timestamp const & ts)
00110     {
00111         set(ts);
00112         return *this;
00113     }
00115 
00117     WT_Result    materialize(WT_Opcode const & opcode, WT_File & file);
00118     WT_Type      object_type() const;
00119     WT_Result    skip_operand(WT_Opcode const & opcode, WT_File & file);
00121 
00123 
00124     WT_Result    serialize(
00125         WT_File & file, 
00126         char const * exAsciiOpcode 
00127         ) const;
00128 };
00129 
00130 
00131 #define DECLARE_TIMESTAMP_CLASS(class_name) \
00132     class WHIPTK_API WT_##class_name : public WT_Timestamp \
00133     { \
00134     public: \
00135  \
00136         WT_ID            object_id() const; \
00137         WT_Result        process(WT_File & file); \
00138         WT_Result        serialize(WT_File & file) const; \
00139   \
00140  \
00141         static WT_Result default_process(  WT_##class_name & item,  WT_File & file); \
00142     }                                                                                                  //
00143 
00144 #define IMPLEMENT_TIMESTAMP_CLASS_FUNCTIONS(class_name, class_lower, class_command)                        \
00145     WT_Object::WT_ID    WT_##class_name::object_id() const                                              \
00146         {return class_name##_ID;}                                                                       \
00147     WT_Result WT_##class_name::serialize(WT_File & file) const                                          \
00148         {return WT_Timestamp::serialize (file, class_command);}                                         \
00149     WT_Result WT_##class_name::process(WT_File & file)                                                  \
00150         {WD_Assert (file.class_lower##_action());                                                       \
00151             return (file.class_lower##_action())(*this, file);}                                         \
00152     WT_Result WT_##class_name::default_process(WT_##class_name & item, WT_File & file)                  \
00153         {                                                                                               \
00154             file.rendition().drawing_info().class_lower() = item;                                       \
00155             return WT_Result::Success;                                                                  \
00156         }                                                                   //
00157 
00159 
00164 DECLARE_TIMESTAMP_CLASS (Creation_Time);
00166 
00171 DECLARE_TIMESTAMP_CLASS (Modification_Time);
00173 
00178 DECLARE_TIMESTAMP_CLASS (Source_Creation_Time);
00180 
00185 DECLARE_TIMESTAMP_CLASS (Source_Modification_Time);
00186 
00187 #endif // TIMESTAMP_HEADER

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