fillpat.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 FILLPAT_HEADER
00020 #define FILLPAT_HEADER
00021 
00025 
00026 #include "whiptk/pattern_scale.h"
00027 
00032 
00033 
00037 class WHIPTK_API WT_Fill_Pattern
00038 : public WT_Attribute
00039 {
00040     friend class WT_Pattern_Scale;
00041         friend class WT_Rendition;
00042         friend class WT_W2D_Class_Factory;
00043         friend class WT_Opcode;
00044 
00045 public:
00047     enum WT_Pattern_ID
00048     {
00049         Illegal = 0,      
00050         Solid,            
00051         Checkerboard,     
00052         Crosshatch,       
00053         Diamonds,         
00054         Horizontal_Bars,  
00055         Slant_Left,       
00056         Slant_Right,      
00057         Square_Dots,      
00058         Vertical_Bars,    
00059         User_Defined,     
00060         Count,            
00061         Undefined = -1    
00062     };
00063 public:
00065 
00067     WT_Fill_Pattern()
00068     : m_stage(Eating_Initial_Whitespace)
00069     , m_id(Solid)
00070     , m_fields_defined(0)
00071     {}
00073     WT_Fill_Pattern( WT_Pattern_ID n )
00074     : m_stage(Eating_Initial_Whitespace)
00075     , m_id(Solid)
00076     , m_fields_defined(0)
00077     { set(n); }
00078 
00080         WT_Fill_Pattern(WT_Fill_Pattern const& pattern)
00081         {
00082                 *this = pattern;
00083         }
00084 
00085         virtual ~WT_Fill_Pattern()
00086         {}
00087 
00089 public:
00091 
00092     void merge( WT_Fill_Pattern const & pattern );
00094     inline WT_Pattern_ID pattern_id() const { return m_id; }
00096     WT_Pattern_Scale const & pattern_scale() const {  return m_pattern_scale; }
00098     WT_Pattern_Scale& pattern_scale() {  m_fields_defined |= PATTERN_SCALE_BIT;  return m_pattern_scale; }
00100     inline void set( WT_Pattern_ID id ) { m_id = id; }
00102     inline operator WT_Pattern_ID ()  const { return m_id; }
00104     virtual inline WT_Fill_Pattern& operator= ( WT_Pattern_ID const & i ) { set(i); return *this; }
00106     virtual inline WT_Fill_Pattern& operator= ( const WT_Fill_Pattern& fill_pattern ) {
00107         set(fill_pattern.pattern_id());
00108         m_pattern_scale = fill_pattern.pattern_scale();
00109         m_fields_defined = fill_pattern.m_fields_defined;
00110         return *this;
00111     }
00113 
00115 
00116     inline WT_Boolean operator == ( WT_Pattern_ID const & id ) const { return id == m_id; }
00118     WT_Boolean operator== ( WT_Fill_Pattern const & pattern ) const;
00120     WT_Boolean operator!= ( WT_Fill_Pattern const & pattern ) const;
00122 
00124     WT_ID            object_id() const;
00125     WT_Result        materialize(WT_Opcode const & opcode, WT_File & file);
00126     WT_Result        process(WT_File & file);
00127     WT_Result        skip_operand(WT_Opcode const & opcode, WT_File & file);
00128     WT_Result        serialize (WT_File & file) const;
00129     WT_Result        sync (WT_File & file) const;
00130     WT_Boolean       operator== (WT_Attribute const & attrib) const;
00132 
00134 
00136     static WT_Result default_process(
00137         WT_Fill_Pattern & item, 
00138         WT_File & file 
00139         );
00140 
00141 protected:
00142 
00143     WT_Pattern_Scale m_pattern_scale;
00145     enum
00146     {
00147         PATTERN_SCALE_BIT = 0x0001
00148     };
00149 
00151     struct WHIPTK_API WT_Fill_Pattern_Option_Code
00152     : public WT_Optioncode
00153     {   
00154         enum WT_Fill_Pattern_Option_ID
00155         {   Unknown_Option, 
00156             Pattern_Scale_Option 
00157         };
00159         int option_id_from_optioncode();
00160     } m_optioncode;
00161 
00162     static WT_Result interpret( char const * , WT_Pattern_ID& );
00163     WT_Result materialize_ascii( WT_Opcode const & , WT_File& );
00164 
00165     enum WT_Materialize_Stage
00166     {   Eating_Initial_Whitespace,
00167         Getting_Pattern_ID,
00168         Checking_For_Attribute_End,
00169         Getting_Optioncode,
00170         Materializing_Option,
00171         // extended binary :
00172         Getting_Pattern_Scale,
00173         Eating_End_Whitespace
00174     } m_stage;
00175 
00176     static const char* m_names[Count];
00177     WT_Pattern_ID m_id;
00178     WT_Unsigned_Integer16 m_fields_defined;
00179 };
00180 
00182 
00183 #endif // FILLPAT_HEADER

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