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

userdata.h

00001 //  Copyright (c) 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 USER_DATA_HEADER
00019 #define USER_DATA_HEADER
00020 
00021 #include "whiptk/whipcore.h"
00022 #include "whiptk/file.h"
00023 #include "whiptk/drawable.h"
00024 
00030 
00031 
00035 class WHIPTK_API WT_UserData : public WT_Object
00036 {
00037 private:
00038 
00039     WT_String               m_data_description;
00040     WT_Integer32            m_data_size;
00041     WT_Byte *               m_data;
00042     WT_Boolean              m_local_data_copy;
00043 
00044     enum
00045     {
00046         Starting,
00047         Getting_Data_Description,
00048         Getting_Data_Size,
00049         Getting_Data,
00050         Getting_Close
00051     }   m_stage;
00052     WT_UserData (WT_UserData const &)
00053       : WT_Object()
00054       , m_data_description()
00055       , m_data_size(0)
00056       , m_data(WD_Null)
00057       , m_local_data_copy(WD_False)
00058       , m_stage(Starting)
00059     {
00060         WD_Complain ("cannot copy WT_UserData");
00061     }
00062 
00063     WT_UserData & operator= (WT_UserData const &)
00064     {
00065         WD_Complain ("cannot assign WT_UserData");
00066         return *this;
00067     }
00068 
00069 public:
00070 
00072 
00073     WT_UserData ()
00074                 : m_data_size(0)
00075                 , m_data(WD_Null)
00076                 , m_local_data_copy(WD_False)
00077                 , m_stage(Starting)
00078             { }
00080     WT_UserData (const WT_String & data_description)
00081                 : m_data_description(data_description)
00082                 , m_data_size(0)
00083                 , m_data(WD_Null)
00084                 , m_local_data_copy(WD_False)
00085                 , m_stage(Starting)
00086             { }
00088     WT_UserData(
00089             const WT_String &           data_description, 
00090             WT_Integer32                data_size, 
00091             WT_Byte *                   data, 
00092             WT_Boolean                  copy 
00093             );
00095     ~WT_UserData()
00096     {
00097         if (m_local_data_copy)
00098             delete [] m_data;
00099     }
00101 
00103 
00104     WT_Byte const * data() const
00105     {   return m_data;  }
00107     const WT_String & data_description() const
00108     {   return m_data_description;  }
00110     WT_Integer32 data_size() const
00111     {   return m_data_size; }
00113 
00115     WT_Result        materialize(WT_Opcode const & opcode, WT_File & file);
00116     WT_ID            object_id() const;
00117     WT_Type          object_type() const;
00118     WT_Result        process(WT_File & file);
00119     WT_Result        serialize(WT_File & file) const;
00120     WT_Result        skip_operand(WT_Opcode const & opcode, WT_File & file);
00122 
00124 
00126     static WT_Result default_process(
00127         WT_UserData & item, 
00128         WT_File & file 
00129         );
00130 };
00131 
00133 
00134 #endif // USER_DATA_HEADER

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