signdata.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 
00020 #if !defined SIGNDATA_HEADER
00021 #define SIGNDATA_HEADER
00022 
00026 
00027 #include "whiptk/whipcore.h"
00028 #include "whiptk/file.h"
00029 #include "whiptk/drawable.h"
00030 #include "whiptk/guid_list.h"
00031 
00037 
00038 
00045 class WHIPTK_API WT_SignData : public WT_Object
00046 {
00047 private:
00048 
00049     WT_Guid_List            m_block_guid_list;
00050     WT_Integer32            m_data_size;
00051     WT_Byte *               m_data;
00052     WT_Boolean              m_local_data_copy;
00053 
00054     enum
00055     {
00056         Starting,
00057         Getting_Block_List_Flag,
00058         Getting_Block_List,
00059         Getting_Data_Size,
00060         Getting_Data,
00061         Getting_Close
00062     }   m_stage;
00063 
00064 public:
00065 
00066     WT_SignData ()
00067     : m_block_guid_list()
00068     , m_data_size(0)
00069     , m_data(WD_Null)
00070     , m_local_data_copy(WD_False)
00071     , m_stage(Starting)
00072     { }
00073 
00074     WT_SignData (
00075         WT_Guid_List block_guid_list
00076         )
00077     : m_data_size(0)
00078     , m_data(WD_Null)
00079     , m_local_data_copy(WD_False)
00080     , m_stage(Starting)
00081     {
00082         m_block_guid_list = block_guid_list;
00083     }
00084 
00085     WT_SignData(
00086             WT_Guid_List                block_guid_list,
00087             WT_Integer32                data_size,
00088             WT_Byte *                   data,
00089             WT_Boolean                  copy) throw(WT_Result);
00090 
00091     WT_SignData(const WT_SignData & signdata) throw(WT_Result)
00092     : WT_Object() 
00093     {
00094         *this = signdata;
00095     }
00096 
00097     virtual ~WT_SignData()
00098     {
00099         if (m_local_data_copy)
00100             delete [] m_data;
00101     }
00102 
00103     WT_BlockRef_List get_blockref_list(
00104         WT_Guid_List & guid_list, WT_File & file);
00105 
00106     WT_Integer32 data_size() const
00107     {   return m_data_size; }
00108 
00109     WT_Byte const * data() const
00110     {   return m_data;  }
00111 
00112     WT_Guid_List const block_guid_list() const
00113     {   return m_block_guid_list;  }
00114 
00115     WT_SignData const & operator=(WT_SignData const & signdata) throw(WT_Result)
00116         {
00117         m_block_guid_list = signdata.block_guid_list();
00118         m_data_size = signdata.data_size();
00119         m_data = WD_Null;
00120         if(m_data_size) {
00121             m_local_data_copy = WD_True;
00122             m_data = new WT_Byte[m_data_size];
00123             if(!m_data)
00124                 throw WT_Result::Out_Of_Memory_Error;
00125             memcpy((void *) &m_data, signdata.m_data,
00126                 sizeof(WT_Byte) * m_data_size);
00127         }
00128 
00129         return *this;
00130     }
00131 
00132     WT_ID            object_id() const;
00133     WT_Type          object_type() const;
00134     WT_Result        materialize(WT_Opcode const & opcode, WT_File & file);
00135     WT_Result        process(WT_File & file);
00136     WT_Result        serialize(WT_File & file) const;
00137     WT_Result        skip_operand(WT_Opcode const & opcode, WT_File & file);
00138 
00139     static WT_Result default_process( WT_SignData & item, WT_File & file );
00140 
00141 };
00142 
00144 
00145 #endif // SIGNDATA_HEADER

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