dashpat.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 DASHPAT_HEADER
00020 #define DASHPAT_HEADER
00021 
00025 
00030 
00031 
00044 class WHIPTK_API WT_Dash_Pattern : public WT_Attribute, public WT_Item
00045 {
00046         friend class WT_Rendition;
00047         friend class WT_PDFRendition;
00048         friend class WT_Class_Factory;
00049         friend class WT_W2D_Class_Factory;
00050         friend class WT_Opcode;
00051         friend class WT_Dash_Pattern_List;
00052 
00053 private:
00054     WT_Integer16* m_data;
00055     WT_Integer16  m_size;
00056     WT_Integer16  m_allocated;
00057     WT_Integer32  m_number;
00058     enum WT_Materialize_Stage
00059     {   Eating_Initial_Whitespace,
00060         Getting_Number,
00061         Checking_For_Attribute_End,
00062         Getting_Size,
00063         Getting_Data,
00064         Getting_Separator,
00065         Eating_End_Whitespace
00066     } m_stage;
00067 
00068     void _deleteObject(void *object)
00069     {
00070         delete (WT_Dash_Pattern*)object;
00071     }
00072 
00073 public:
00074 
00076 
00079     static const WT_Dash_Pattern kNull;
00080 
00081 public:
00083 
00084     WT_Dash_Pattern()
00085     : m_data(0)
00086     , m_size(0)
00087     , m_allocated(0)
00088     , m_number(-1)
00089     , m_stage(Eating_Initial_Whitespace)
00090     {}
00091 
00093 
00096     WT_Dash_Pattern(
00100         WT_Integer32 id_number,
00101         WT_Integer16 length, 
00102         WT_Integer16 const * pArray 
00103         ) throw(WT_Result)
00104     : m_data(0)
00105     , m_size(0)
00106     , m_allocated(0)
00107     , m_number(-1)
00108     , m_stage(Eating_Initial_Whitespace)
00109     { 
00110                 WT_Result res = set(id_number,length,pArray);   
00111                 if(res != WT_Result::Success)
00112                         throw res;
00113         }
00114 
00116     WT_Dash_Pattern(
00117         WT_Dash_Pattern const & r ) throw(WT_Result)
00118     : WT_Attribute()
00119     , WT_Item()
00120     , m_data(0)
00121     , m_size(0)
00122     , m_allocated(0)
00123     , m_number(-1)
00124     , m_stage(Eating_Initial_Whitespace)
00125     {           
00126                 WT_Result res = set(r); 
00127                 if(res != WT_Result::Success)
00128                         throw res;
00129         }
00130 
00132     virtual ~WT_Dash_Pattern()
00133     { set(0,0,0); }
00134 
00136 public:
00138 
00139     inline WT_Integer16 length()  const { return m_size; }
00141     inline WT_Integer32 number()  const { return m_number; }
00143     inline WT_Integer32& number() { return m_number; }
00145     inline WT_Integer16 const * pattern() const { return m_data; }
00147     WT_Result set( WT_Dash_Pattern const & pattern);
00149     WT_Result set(
00153         WT_Integer32 id_number,
00154         WT_Integer16 length=0, 
00155         WT_Integer16 const * pArray=0 
00156         );
00158     inline void set_pattern(
00159         WT_Integer16 length, 
00160         WT_Integer16 const * pArray 
00161         ) { set(m_number, length, pArray); }
00163     virtual inline WT_Dash_Pattern& operator= ( WT_Dash_Pattern const & r ) throw(WT_Result)
00164         {
00165                 WT_Result res = set(r);         
00166                 if(res == WT_Result::Success)
00167                         return *this;
00168                 else
00169                         throw res;              
00170         }
00172     virtual inline WT_Dash_Pattern& operator=(
00176         WT_Integer32 id_number
00177         ) throw(WT_Result)
00178         { 
00179                 WT_Result res = set(id_number);
00180                 if(res == WT_Result::Success)
00181                         return *this;
00182                 else
00183                         throw res;       
00184                 
00185                                 
00186         }
00187 
00189     WT_Integer16& operator[](
00190         WT_Integer16 index 
00191         );
00193 
00195     WT_ID            object_id() const;
00196     WT_Result        materialize(WT_Opcode const & opcode, WT_File & file);
00197     WT_Result        process(WT_File & file);
00198     WT_Result        skip_operand(WT_Opcode const & opcode, WT_File & file);
00199     WT_Result        serialize (WT_File & file) const;
00200     WT_Result        sync (WT_File & file) const;
00201     WT_Boolean       operator== (WT_Attribute const & attrib) const;
00203 
00205 
00207     static WT_Result default_process(
00208         WT_Dash_Pattern & item, 
00209         WT_File & file 
00210         );
00211 
00212 private:
00213     WT_Result serialize_pattern_definition( WT_File& ) const;
00214 
00215 };
00216 
00218 
00219 #endif // DASHPAT_HEADER

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