unknown.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 UNKNOWN_HEADER
00020 #define UNKNOWN_HEADER
00021 
00025 
00026 #include "whiptk/whipcore.h"
00027 #include "whiptk/object.h"
00028 
00029 class WT_File;
00030 
00032 
00033 class WHIPTK_API WT_Unknown : public WT_Object
00034 {
00035     friend class WT_W2D_Class_Factory;
00036     friend class WT_Opcode;
00037 
00038 private:
00039     WT_Byte *pass_thru_bytes;
00040     WT_Unsigned_Integer16 total_opcode_size;
00041 
00042     WT_Unknown (WT_Unknown const &)
00043       : WT_Object()
00044       , pass_thru_bytes()
00045       , total_opcode_size()
00046     {
00047         WD_Complain ("cannot copy WT_Unknown");
00048     }  // prohibited
00049 
00050 public:
00051 
00053 
00054     WT_Unknown()
00055     {
00056         pass_thru_bytes = WD_Null;
00057         total_opcode_size = 0;
00058     }
00060     virtual ~WT_Unknown()
00061     {
00062         if(pass_thru_bytes != WD_Null)
00063             delete []pass_thru_bytes;
00064         pass_thru_bytes = WD_Null;
00065         total_opcode_size = 0;
00066     }
00067 public:
00069 
00070     WT_Unsigned_Integer16 const& get_pass_thru_byte_length() const { return total_opcode_size; }
00071     WT_Unsigned_Integer16& get_pass_thru_byte_length() { return total_opcode_size; }
00072     WT_Byte* get_pass_thru_bytes(void) { return pass_thru_bytes; }
00073     WT_Result   set_pass_thru_bytes(WT_Unsigned_Integer16 size,WT_Byte* data);
00074 
00076     void release_pass_thru_bytes() {
00077         if(pass_thru_bytes != WD_Null)
00078             delete []pass_thru_bytes;
00079         pass_thru_bytes = WD_Null;
00080         total_opcode_size = 0;
00081     }
00082 
00084     inline WT_Unknown const & operator= (WT_Unknown const & unknown_object) throw(WT_Result)
00085     {
00086         WT_Unknown *punknown;
00087         punknown = (WT_Unknown *) &unknown_object;
00088         pass_thru_bytes = new WT_Byte[punknown->get_pass_thru_byte_length()];
00089         if(!pass_thru_bytes)
00090             throw WT_Result::Out_Of_Memory_Error;
00091         memcpy(pass_thru_bytes, punknown->get_pass_thru_bytes(),
00092             punknown->get_pass_thru_byte_length());
00093 
00094         return *this;
00095     }
00097 
00099     WT_ID            object_id() const;
00100     WT_Type          object_type() const;
00101     WT_Result        materialize(WT_Opcode const & opcode, WT_File & file);
00102     WT_Result        process(WT_File & file);
00103     WT_Result        skip_operand(WT_Opcode const & opcode, WT_File & file);
00104     WT_Result        serialize (WT_File & file) const;
00106 
00108 
00110     static WT_Result default_process(
00111         WT_Unknown & item, 
00112         WT_File & file 
00113         );
00114 
00115 };
00116 
00117 #endif // UNKNOWN_HEADER

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