userdata.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 
00019 #if !defined USER_DATA_HEADER
00020 #define USER_DATA_HEADER
00021 
00025 
00026 #include "whiptk/whipcore.h"
00027 #include "whiptk/file.h"
00028 #include "whiptk/drawable.h"
00029 
00035 
00036 
00039 class WHIPTK_API WT_UserData : public WT_Object
00040 {
00041         friend class WT_W2D_Class_Factory;
00042         friend class WT_Opcode;
00043 
00044 private:
00045 
00046     WT_String               m_data_description;
00047     WT_Integer32            m_data_size;
00048     WT_Byte *               m_data;
00049     WT_Boolean              m_local_data_copy;
00050 
00051     enum
00052     {
00053         Starting,
00054         Getting_Data_Description,
00055         Getting_Data_Size,
00056         Getting_Data,
00057         Getting_Close
00058     }   m_stage;
00059     WT_UserData (WT_UserData const &)
00060       : WT_Object()
00061       , m_data_description()
00062       , m_data_size(0)
00063       , m_data(WD_Null)
00064       , m_local_data_copy(WD_False)
00065       , m_stage(Starting)
00066     {
00067         WD_Complain ("cannot copy WT_UserData");
00068     }
00069 
00070     WT_UserData & operator= (WT_UserData const &)
00071     {
00072         WD_Complain ("cannot assign WT_UserData");
00073         return *this;
00074     }
00075 
00076 public:
00077 
00079 
00080     WT_UserData ()
00081                 : m_data_size(0)
00082                 , m_data(WD_Null)
00083                 , m_local_data_copy(WD_False)
00084                 , m_stage(Starting)
00085             { }
00087     WT_UserData (const WT_String & data_description)
00088                 : m_data_description(data_description)
00089                 , m_data_size(0)
00090                 , m_data(WD_Null)
00091                 , m_local_data_copy(WD_False)
00092                 , m_stage(Starting)
00093             { }
00095     WT_UserData(
00096             const WT_String &           data_description, 
00097             WT_Integer32                data_size, 
00098             WT_Byte *                   data, 
00099             WT_Boolean                  copy 
00100             ) throw(WT_Result);
00102     virtual ~WT_UserData()
00103     {
00104         if (m_local_data_copy)
00105             delete [] m_data;
00106     }
00108 public:
00110 
00111     WT_Byte const * data() const
00112     {   return m_data;  }
00114     const WT_String & data_description() const
00115     {   return m_data_description;  }
00116     WT_String&  data_description()
00117     {   return m_data_description;  }
00119     WT_Integer32 const& data_size() const
00120     {   return m_data_size; }
00121     WT_Integer32& data_size()
00122     {   return m_data_size; }
00123     WT_Result   set_data(WT_Integer32 size,WT_Byte* data);
00125 
00127     WT_Result        materialize(WT_Opcode const & opcode, WT_File & file);
00128     WT_ID            object_id() const;
00129     WT_Type          object_type() const;
00130     WT_Result        process(WT_File & file);
00131     WT_Result        serialize(WT_File & file) const;
00132     WT_Result        skip_operand(WT_Opcode const & opcode, WT_File & file);
00134 
00136 
00138     static WT_Result default_process(
00139         WT_UserData & item, 
00140         WT_File & file 
00141         );
00142 };
00143 
00145 
00146 #endif // USER_DATA_HEADER

Generated on Tue Jan 6 22:41:13 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5