Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages | Examples

fillpat.h

00001 //  Copyright (c) 2001 by Autodesk, Inc.
00002 //
00003 //  By using this code, you are agreeing to the terms and conditions of
00004 //  the License Agreement included in the documentation for this code.
00005 //
00006 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00007 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00008 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00009 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00010 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00011 //
00012 //  Use, duplication, or disclosure by the U.S. Government is subject to
00013 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00014 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00015 //  Data and Computer Software), as applicable.
00016 //
00017 
00018 #if !defined FILLPAT_HEADER
00019 #define FILLPAT_HEADER
00020 
00021 #include "whiptk/pattern_scale.h"
00022 
00027 
00028 
00032 class WHIPTK_API WT_Fill_Pattern
00033 : public WT_Attribute
00034 {
00035     friend class WT_Pattern_Scale;
00036 public:
00038     enum WT_Pattern_ID
00039     {
00040         Illegal = 0,      
00041         Solid,            
00042         Checkerboard,     
00043         Crosshatch,       
00044         Diamonds,         
00045         Horizontal_Bars,  
00046         Slant_Left,       
00047         Slant_Right,      
00048         Square_Dots,      
00049         Vertical_Bars,    
00050         User_Defined,     
00051         Count,            
00052         Undefined = -1    
00053     };
00054 
00056 
00058     WT_Fill_Pattern()
00059     : m_stage(Eating_Initial_Whitespace)
00060     , m_id(Solid)
00061     , m_fields_defined(0)
00062     {}
00064     WT_Fill_Pattern( WT_Pattern_ID n )
00065     : m_stage(Eating_Initial_Whitespace)
00066     , m_id(Solid)
00067     , m_fields_defined(0)
00068     { set(n); }
00070 
00072 
00073     void merge( WT_Fill_Pattern const & pattern );
00075     inline WT_Pattern_ID pattern_id() const { return m_id; }
00077     WT_Pattern_Scale const & pattern_scale() const {  return m_pattern_scale; }
00079     WT_Pattern_Scale& pattern_scale() {  m_fields_defined |= PATTERN_SCALE_BIT;  return m_pattern_scale; }
00081     inline void set( WT_Pattern_ID id ) { m_id = id; }
00083     inline operator WT_Pattern_ID ()  const { return m_id; }
00085     inline WT_Fill_Pattern& operator= ( WT_Pattern_ID const & i ) { set(i); return *this; }
00087     inline WT_Fill_Pattern& operator= ( const WT_Fill_Pattern& fill_pattern ) {
00088         set(fill_pattern.pattern_id());
00089         m_pattern_scale = fill_pattern.pattern_scale();
00090         m_fields_defined = fill_pattern.m_fields_defined;
00091         return *this;
00092     }
00094 
00096 
00097     inline WT_Boolean operator == ( WT_Pattern_ID const & id ) const { return id == m_id; }
00099     WT_Boolean operator== ( WT_Fill_Pattern const & pattern ) const;
00101     WT_Boolean operator!= ( WT_Fill_Pattern const & pattern ) const;
00103 
00105     WT_ID            object_id() const;
00106     WT_Result        materialize(WT_Opcode const & opcode, WT_File & file);
00107     WT_Result        process(WT_File & file);
00108     WT_Result        skip_operand(WT_Opcode const & opcode, WT_File & file);
00109     WT_Result        serialize (WT_File & file) const;
00110     WT_Result        sync (WT_File & file) const;
00111     WT_Boolean       operator== (WT_Attribute const & attrib) const;
00113 
00115 
00117     static WT_Result default_process(
00118         WT_Fill_Pattern & item, 
00119         WT_File & file 
00120         );
00121 
00122 private:
00123 
00124     WT_Pattern_Scale m_pattern_scale;
00126     enum
00127     {
00128         PATTERN_SCALE_BIT = 0x0001
00129     };
00130 
00132     struct WT_Fill_Pattern_Option_Code
00133     : public WT_Optioncode
00134     {   enum WT_Fill_Pattern_Option_ID
00135         {   Unknown_Option, 
00136             Pattern_Scale_Option 
00137         };
00139         int option_id_from_optioncode();
00140     } m_optioncode;
00141 
00142     static WT_Result interpret( char const * , WT_Pattern_ID& );
00143     WT_Result materialize_ascii( WT_Opcode const & , WT_File& );
00144 
00145     enum WT_Materialize_Stage
00146     {   Eating_Initial_Whitespace,
00147         Getting_Pattern_ID,
00148         Checking_For_Attribute_End,
00149         Getting_Optioncode,
00150         Materializing_Option,
00151         // extended binary :
00152         Getting_Pattern_Scale,
00153         Eating_End_Whitespace
00154     } m_stage;
00155 
00156     static const char* m_names[Count];
00157     WT_Pattern_ID m_id;
00158     WT_Unsigned_Integer16 m_fields_defined;
00159 };
00160 
00161 #endif // FILLPAT_HEADER

Generated on Tue May 17 12:07:44 2005 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.1