file.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 FILE_HEADER
00020 #define FILE_HEADER
00021 
00025 
00026 #include "whiptk/allclass.h"
00027 #include "whiptk/wversion.h"
00028 #include "whiptk/whipcore.h"
00029 #include "whiptk/rendition.h"
00030 #include "whiptk/opcode.h"
00031 #include "whiptk/drawable.h"
00032 #include "whiptk/fifo.h"
00033 #include "whiptk/heuristics.h"
00034 #include "whiptk/layer_list.h"
00035 #include "whiptk/dpat_list.h"
00036 #include "whiptk/object_node_list.h"
00037 #include "whiptk/group_begin.h"
00038 #include "whiptk/group_end.h"
00039 #include "whiptk/blockref_defs.h"
00040 #include "whiptk/filetime.h"
00041 #include "whiptk/inked_area.h"
00042 #include "whiptk/directory.h"
00043 #include "whiptk/penpat_options.h"
00044 
00045 #define CALLBACK_LIST\
00046     CALLBACK_MACRO(Alignment,alignment)\
00047     CALLBACK_MACRO(Attribute_URL,attribute_url)\
00048     CALLBACK_MACRO(Author,author)\
00049     CALLBACK_MACRO(Background,background)\
00050     CALLBACK_MACRO(Block_Meaning,block_meaning)\
00051     CALLBACK_MACRO(BlockRef,blockref)\
00052     CALLBACK_MACRO(Code_Page,code_page)\
00053     CALLBACK_MACRO(Color,color)\
00054     CALLBACK_MACRO(Color_Map,color_map)\
00055     CALLBACK_MACRO(Comments,comments)\
00056     CALLBACK_MACRO(Compressed_Data_Moniker,compressed_data_moniker)\
00057     CALLBACK_MACRO(Contour_Set,contour_set)\
00058     CALLBACK_MACRO(Contrast_Color,contrast_color)\
00059     CALLBACK_MACRO(Copyright,copyright)\
00060     CALLBACK_MACRO(Creation_Time,creation_time)\
00061     CALLBACK_MACRO(Creator,creator)\
00062     CALLBACK_MACRO(Dash_Pattern,dash_pattern)\
00063     CALLBACK_MACRO(Delineate,delineate)\
00064     CALLBACK_MACRO(Description,description)\
00065     CALLBACK_MACRO(Directory,directory)\
00066     CALLBACK_MACRO(Drawing_Info,drawing_info)\
00067     CALLBACK_MACRO(DWF_Header,dwf_header)\
00068     CALLBACK_MACRO(Embed,embed)\
00069     CALLBACK_MACRO(Embedded_Font,embedded_font)\
00070     CALLBACK_MACRO(Encryption,encryption)\
00071     CALLBACK_MACRO(End_Of_DWF,end_of_dwf)\
00072     CALLBACK_MACRO(FileTime,filetime)\
00073     CALLBACK_MACRO(Fill,fill)\
00074     CALLBACK_MACRO(Fill_Pattern,fill_pattern)\
00075     CALLBACK_MACRO(Filled_Ellipse,filled_ellipse)\
00076     CALLBACK_MACRO(Font,font)\
00077     CALLBACK_MACRO(Font_Extension,font_extension)\
00078     CALLBACK_MACRO(Gouraud_Polyline,gouraud_polyline)\
00079     CALLBACK_MACRO(Gouraud_Polytriangle,gouraud_polytriangle)\
00080     CALLBACK_MACRO(Group_Begin,group_begin)\
00081     CALLBACK_MACRO(Group_End,group_end)\
00082     CALLBACK_MACRO(Guid,guid)\
00083     CALLBACK_MACRO(Guid_List,guid_list)\
00084     CALLBACK_MACRO(Image,image)\
00085     CALLBACK_MACRO(Inked_Area,inked_area)\
00086     CALLBACK_MACRO(Keywords,keywords)\
00087     CALLBACK_MACRO(Layer,layer)\
00088     CALLBACK_MACRO(Line_Pattern,line_pattern)\
00089     CALLBACK_MACRO(Line_Style,line_style)\
00090     CALLBACK_MACRO(Line_Weight,line_weight)\
00091     CALLBACK_MACRO(Macro_Definition,macro_definition)\
00092     CALLBACK_MACRO(Macro_Draw,macro_draw)\
00093     CALLBACK_MACRO(Macro_Scale,macro_scale)\
00094     CALLBACK_MACRO(Macro_Index,macro_index)\
00095     CALLBACK_MACRO(Marker_Size,marker_size)\
00096     CALLBACK_MACRO(Marker_Symbol,marker_symbol)\
00097     CALLBACK_MACRO(Merge_Control,merge_control)\
00098     CALLBACK_MACRO(Modification_Time,modification_time)\
00099     CALLBACK_MACRO(Named_View,named_view)\
00100     CALLBACK_MACRO(Named_View_List,named_view_list)\
00101     CALLBACK_MACRO(Object_Node,object_node)\
00102     CALLBACK_MACRO(Orientation,orientation)\
00103     CALLBACK_MACRO(Origin,origin)\
00104     CALLBACK_MACRO(Outline_Ellipse,outline_ellipse)\
00105     CALLBACK_MACRO(Overpost,overpost)\
00106     CALLBACK_MACRO(Password,password)\
00107     CALLBACK_MACRO(Pen_Pattern,pen_pattern)\
00108     CALLBACK_MACRO(PenPat_Options,penpat_options)\
00109     CALLBACK_MACRO(Plot_Info,plot_info)\
00110     CALLBACK_MACRO(Plot_Optimized,plot_optimized)\
00111     CALLBACK_MACRO(PNG_Group4_Image,png_group4_image)\
00112     CALLBACK_MACRO(Polygon,polygon)\
00113     CALLBACK_MACRO(Polyline,polyline)\
00114     CALLBACK_MACRO(Polymarker,polymarker)\
00115     CALLBACK_MACRO(Polytriangle,polytriangle)\
00116     CALLBACK_MACRO(Projection,projection)\
00117     CALLBACK_MACRO(SignData,signdata)\
00118     CALLBACK_MACRO(Source_Creation_Time,source_creation_time)\
00119     CALLBACK_MACRO(Source_Filename,source_filename)\
00120     CALLBACK_MACRO(Source_Modification_Time,source_modification_time)\
00121     CALLBACK_MACRO(Subject,subject)\
00122     CALLBACK_MACRO(Text,text)\
00123     CALLBACK_MACRO(Text_Background,text_background)\
00124     CALLBACK_MACRO(Text_HAlign,text_halign)\
00125     CALLBACK_MACRO(Text_VAlign,text_valign)\
00126     CALLBACK_MACRO(Title,title)\
00127     CALLBACK_MACRO(Trusted_Font_List,trusted_font_list)\
00128     CALLBACK_MACRO(Units,units)\
00129     CALLBACK_MACRO(Unknown,unknown)\
00130     CALLBACK_MACRO(URL,url)\
00131     CALLBACK_MACRO(UserData,userdata)\
00132     CALLBACK_MACRO(User_Fill_Pattern,user_fill_pattern)\
00133     CALLBACK_MACRO(User_Hatch_Pattern,user_hatch_pattern)\
00134     CALLBACK_MACRO(View,view)\
00135     CALLBACK_MACRO(Viewport,viewport)\
00136     CALLBACK_MACRO(Visibility,visibility)
00137 
00138 class WT_File_Stats;
00139 class WT_File;
00140 
00141 typedef WT_Result (* WT_Stream_Open_Action) (WT_File & file);
00142 typedef WT_Result (* WT_Stream_Close_Action)(WT_File & file);
00143 typedef WT_Result (* WT_Stream_Read_Action) (WT_File & file,int bytes_desired,int & bytes_read,void * buffer);
00144 typedef WT_Result (* WT_Stream_Write_Action)(WT_File & file,int size,void const * buffer);
00145 typedef WT_Result (* WT_Stream_Seek_Action)(WT_File & file, int distance, int & amount_seeked);
00146 typedef WT_Result (* WT_Stream_End_Seek_Action)(WT_File & file);
00147 typedef WT_Result (* WT_Stream_Tell_Action)(WT_File & file, unsigned long *current_file_pointer_position);
00148 
00149 // public typedefs
00150 #define CALLBACK_MACRO(class_name, class_lower) \
00151     typedef WT_Result (* WT_##class_name##_Action)(WT_##class_name & class_lower, WT_File & file);
00152 CALLBACK_LIST
00153 #undef CALLBACK_MACRO
00154 
00164 
00165 
00169 class WHIPTK_API WT_File
00170 {
00171         friend class WT_W2D_Class_Factory;
00172     friend class WT_Class_Factory;
00173         friend class WT_Macro_Definition;
00174 
00175 public:
00176 
00178     enum WT_File_mode
00179     {
00180         File_Inactive, 
00181         File_Read, 
00182         File_Write, 
00183         Block_Write, 
00184         Block_Read, 
00185         Block_Append 
00186     };
00187 public:
00189 
00190     WT_File() throw(WT_Result);
00191 
00193     virtual ~WT_File();
00195 public:
00197 
00198     virtual WT_Result            close();
00200     WT_File_mode                 file_mode() const;
00202     WT_String const &            filename() const;
00204     WT_File_Heuristics &         heuristics()    { return m_heuristics;              }
00206 
00209     virtual WT_Result             open();
00211     void                         set_file_mode(WT_File_mode mode);
00213     void                         set_filename(char const * name);
00215     void                         set_filename(int length, WT_Unsigned_Integer16 const * name);
00217     void                         set_filename(WT_Unsigned_Integer16 const * name);
00219 
00223     int                          toolkit_decimal_revision() const  {    return (toolkit_major_revision() * 100) + toolkit_minor_revision();    }
00225 
00227     virtual int                  toolkit_major_revision() const    {    return WD_Toolkit_Major_Revision;    }
00229 
00231     virtual int                  toolkit_minor_revision() const    {    return WD_Toolkit_Minor_Revision;    }
00233 
00235 
00236     virtual WT_Object const *            current_object() const    { return m_current_object;}
00237         virtual WT_Logical_Point                         current_point() { return m_current_point; }
00238         virtual void                                             set_current_object( WT_Object* pObj) { m_current_object = pObj; }
00240     virtual WT_Dash_Pattern_List &       dash_pattern_list() { return m_dpat_list; }
00242 
00246     virtual WT_Rendition &               desired_rendition()    {return m_desired_rendition;}
00248     virtual WT_Layer_List &              layer_list()   { return m_layer_list; }
00250 
00253     virtual WT_Rendition &               rendition()    {        return *m_rendition;    }
00255     virtual WT_Object *                  object() { return m_current_object; }
00257     virtual WT_Object_Node_List &        object_node_list() { return m_object_node_list; }
00259 
00263     virtual void                         set_stream_user_data(void * stream_user_data) {    m_stream_user_data = stream_user_data;    }
00265     virtual void *                       stream_user_data() {    return m_stream_user_data;    }
00267 
00269 
00270 
00276     virtual WT_Result                    get_next_object();
00278 
00285     virtual WT_Result                    get_next_object_shell();
00287 
00292     virtual WT_Result                    process_next_object();
00294 
00301     #define CALLBACK_MACRO(class_name, class_lower) \
00302         void set_##class_lower##_action(WT_##class_name##_Action action) \
00303                     {m_##class_lower##_action = action;}
00304     CALLBACK_LIST
00305     #undef CALLBACK_MACRO
00306 
00307 
00314     #define CALLBACK_MACRO(class_name, class_lower) \
00315         WT_##class_name##_Action class_lower##_action() \
00316             {return m_##class_lower##_action;}
00317     CALLBACK_LIST
00318     #undef CALLBACK_MACRO
00319 
00320 
00326     void                         set_stream_close_action(WT_Stream_Close_Action action) {    m_stream_close_action = action;    }
00327     void                         set_stream_end_seek_action(WT_Stream_End_Seek_Action action) {    m_stream_end_seek_action = action;    }
00328     void                         set_stream_open_action(WT_Stream_Open_Action action) {    m_stream_open_action = action;    }
00329     void                         set_stream_read_action(WT_Stream_Read_Action action) {    m_stream_read_action = action;    }
00330     void                         set_stream_seek_action(WT_Stream_Seek_Action action) {    m_stream_seek_action = action;    }
00331     void                         set_stream_tell_action(WT_Stream_Tell_Action action) {    m_stream_tell_action = action;    }
00332     void                         set_stream_write_action(WT_Stream_Write_Action action) {    m_stream_write_action = action;    }
00333     WT_Stream_Close_Action       stream_close_action() {    return m_stream_close_action;    }
00334     WT_Stream_End_Seek_Action    stream_end_seek_action() {    return m_stream_end_seek_action;    }
00335     WT_Stream_Open_Action        stream_open_action() {    return m_stream_open_action;    }
00336     WT_Stream_Read_Action        stream_read_action() {    return m_stream_read_action;    }
00337     WT_Stream_Seek_Action        stream_seek_action() {    return m_stream_seek_action;    }
00338     WT_Stream_Tell_Action        stream_tell_action(){    return m_stream_tell_action;    }
00339     WT_Stream_Write_Action       stream_write_action() {    return m_stream_write_action;    }
00341 
00347 
00348     WT_Result                    add_blockref(WT_BlockRef & blockref) { return m_directory.add(blockref); }
00350 
00353     WT_Result                    is_file_type_binary(WT_Boolean & bBinaryFileType, int & end_byte_length);
00355     WT_Directory const           get_directory() { return m_directory; }
00357 
00359     WT_Result                    get_to_the_directory();
00361 
00362     // We don't want to document the following methods.  They're for internal use only,
00363     // but public so that we are not force to make every object a friend.
00364 #ifndef DOXYGEN_IGNORE
00365 
00366     // Internal Reader state machine stuff that's just plain dangerous to use.
00367     WT_Result                    get_next_object(WT_File *p_uncompressed_file);
00368     WT_Result                    process_next_object(WT_File *p_uncompressed_file);
00369 
00370     // Internal reader / writer functions only used by WT_Object derivatives, not by client code.
00371     virtual WT_Result            compress_write(int count, void const * data);
00372     const WT_Opcode &            current_opcode() const { return m_opcode; }
00373     int                          data_decompression() {    return m_data_decompression;    }
00374     WT_Result                    decompress_read(int count, int & num_read, void * data);
00375     WT_Result                    decompress_seek(int count, int & num_seeked);
00376     int                          decrement_paren_count()    {   return --m_paren_count;}
00377     int                          decrement_tab_level()    {   return --m_tab_level;    }
00378     virtual WT_Logical_Point     de_update_current_point(WT_Logical_Point const & delta);
00379     WT_Drawable *                delayed_drawable() const { return m_delayed_drawable; }
00380     virtual WT_Result            dump_delayed_drawable();
00381     WT_Result                    eat_whitespace();
00382     WT_File_Stats *              file_stats() { return m_file_stats; }
00383     WT_Result                    handle_leftover_decompressor_stream_read_data(int avail_in, WT_Byte const * next_in);
00384     WT_Boolean                   have_read_first_opcode() const    { return m_have_read_first_opcode;    }
00385     int                          increment_paren_count()    { return ++m_paren_count; }
00386     int                          increment_tab_level()    {   return ++m_tab_level;    }
00387     WT_Result                    merge_or_delay_drawable(WT_Drawable const & current);
00388     int                          next_incarnation()    {        return m_next_incarnation++;    }
00389     int                          paren_count() const    {   return m_paren_count;    }
00390     WT_Result                    put_back(int size, WT_Byte const * buffer);
00391     WT_Result                    put_back(WT_Byte const & a_byte)  { return put_back(sizeof(WT_Byte), & a_byte);    }
00392     WT_Result                    read(char * & string, int max_size, WT_Boolean allow_initial_open_paren = WD_False); // Too big to
00393     WT_Result                    read(int count, WT_Logical_Point    * points);
00394     WT_Result                    read(int count, WT_Logical_Point_16 * points);
00395     WT_Result                    read(int count, WT_RGBA32 * colors);
00396     WT_Result                    read(int count, WT_Unsigned_Integer16 * buffer);
00397     WT_Result                    read(int size, char * buffer);
00398     WT_Result                    read(int size, WT_Byte * buffer);
00399     WT_Result                    read(WT_Byte & a_byte);
00400     WT_Result                    read(WT_Integer16 & a_word);
00401     WT_Result                    read(WT_Integer32 & a_word);
00402     WT_Result                    read(WT_RGBA32 & a_color);
00403     WT_Result                    read(WT_Unsigned_Integer16 & a_word);
00404     WT_Result                    read(WT_Unsigned_Integer32 & a_word);
00405     WT_Result                    read_ascii(double & a_word);
00406     WT_Result                    read_ascii(int count, WT_RGBA32 * colors);
00407     WT_Result                    read_ascii(WT_Color & a_color, WT_Boolean allow_indexed_color = WD_True);
00408     WT_Result                    read_ascii(WT_Integer16 & a_word);
00409     WT_Result                    read_ascii(WT_Integer32 & a_word);
00410     WT_Result                    read_ascii(WT_Logical_Box & a_box);
00411     WT_Result                    read_ascii(WT_Logical_Point & a_point);
00412     WT_Result                    read_ascii(WT_RGBA32 & a_color);
00413     WT_Result                    read_ascii(WT_Unsigned_Integer16 & a_word);
00414     WT_Result                    read_ascii(WT_Unsigned_Integer32 & a_dword);
00415     WT_Result                    read_block(WT_File & block_file, WT_BlockRef & blockref);
00416     WT_Result                    read_count (WT_Integer32 & count);
00417     WT_Result                    read_hex(int count, WT_Byte * data);
00418     WT_Result                    read_hex(WT_Byte & byte);
00419     WT_Result                    read_index_tree(int max_size, WT_Boolean allow_initial_open_paren = WD_False); // Too big to
00420     WT_Result                    set_block_size_for_tail_blockref(WT_Unsigned_Integer32 current_blockref_file_offset);
00421     void                         set_data_decompression(int decompression) {    m_data_decompression = decompression;    }
00422     void                         set_delayed_drawable(WT_Drawable * drwbl) {   WD_Assert(!m_delayed_drawable); m_delayed_drawable = drwbl; }
00423     void                         set_directory(WT_Directory directory) { m_directory = directory; } /* in the default_process of WT_Directory, we set the file directory member value to the directory that we might have materialized from the file opened in Block_Append, Block_Read or File_Read mode. */
00424     void                         set_have_read_first_opcode(WT_Boolean state)    { m_have_read_first_opcode = state;    }
00425     void                         set_paren_count(int count)    {   m_paren_count = count;    }
00426     void                         set_tab_level(int count)    {        m_tab_level = count;    }
00427     WT_Result                    skip(int size);
00428     WT_Unsigned_Integer16        skip_byte_length() const { return m_skip_byte_length; }
00429     WT_Result                    skip_past_matching_paren(int terminating_paren_level);
00430     int                          tab_level() const    {        return m_tab_level;    }
00431     int                          this_opcode_start_position() const { return m_this_opcode_start_position; }
00432     virtual WT_Logical_Point     update_current_point(WT_Logical_Point const & new_point);
00433     WT_Result                    write(char const * str);
00434     WT_Result                    write(int count, WT_Byte const * data);
00435     WT_Result                    write(int count, WT_Logical_Point    const * points);
00436     WT_Result                    write(int count, WT_Logical_Point_16 const * points);
00437     WT_Result                    write(int count, WT_Unsigned_Integer16 const * data);
00438     WT_Result                    write(WT_Byte a_byte);
00439     WT_Result                    write(WT_Integer16 a_word);
00440     WT_Result                    write(WT_Integer32 a_word);
00441     WT_Result                    write(WT_RGBA32 a_color);
00442     WT_Result                    write(WT_Unsigned_Integer16 a_word);
00443     WT_Result                    write(WT_Unsigned_Integer32 a_dword);
00444     WT_Result                    write_ascii(double val);
00445     WT_Result                    write_ascii(int count, WT_Logical_Point const * points);
00446     WT_Result                    write_ascii(WT_Integer16 a_word);
00447     WT_Result                    write_ascii(WT_Integer32 a_word);
00448     WT_Result                    write_ascii(WT_Logical_Point const & point);
00449     WT_Result                    write_ascii(WT_RGBA32 a_color);
00450     WT_Result                    write_ascii(WT_Unsigned_Integer16 a_word);
00451     WT_Result                    write_ascii(WT_Unsigned_Integer32 a_dword);
00452     WT_Result                    write_block(WT_File & file);
00453     WT_Result                    write_count(int count);
00454     WT_Result                    write_geom_tab_level();
00455     WT_Result                    write_hex(int count, WT_Byte const * data);
00456     WT_Result                    write_hex(WT_Byte data);
00457     WT_Result                    write_padded_ascii(double a_double);
00458     WT_Result                    write_padded_ascii(int count, WT_Logical_Point const * points);
00459     WT_Result                    write_padded_ascii(WT_Integer16 a_word);
00460     WT_Result                    write_padded_ascii(WT_Integer32 a_word);
00461     WT_Result                    write_padded_ascii(WT_Logical_Point const & point);
00462     WT_Result                    write_padded_ascii(WT_Unsigned_Integer16 a_word);
00463     WT_Result                    write_padded_ascii(WT_Unsigned_Integer32 a_word);
00464     WT_Result                    write_quoted_string(char const * str, WT_Boolean force_quotes = WD_False);
00465     WT_Result                    write_quoted_string(WT_Unsigned_Integer16 const * str);
00466     WT_Result                    write_tab_level();
00467 
00468         void                                             set_write_ascii_format(char const *strFormat);
00469 #endif
00470 
00471 protected:
00473     void *                      m_stream_user_data;
00474 
00480     #define CALLBACK_MACRO(class_name, class_lower) \
00481         WT_##class_name##_Action    m_##class_lower##_action;
00482     CALLBACK_LIST
00483     #undef CALLBACK_MACRO
00484 
00485 
00487     WT_Stream_End_Seek_Action   m_stored_stream_end_seek_action;
00488     WT_Stream_Read_Action       m_stored_stream_read_action;
00489     WT_Stream_Seek_Action       m_stored_stream_seek_action;
00490     WT_Stream_Close_Action      m_stream_close_action;
00491     WT_Stream_End_Seek_Action   m_stream_end_seek_action;
00492     WT_Stream_Open_Action       m_stream_open_action;
00493     WT_Stream_Read_Action       m_stream_read_action;
00494     WT_Stream_Seek_Action       m_stream_seek_action;
00495     WT_Stream_Tell_Action       m_stream_tell_action;
00496     WT_Stream_Write_Action      m_stream_write_action;
00498 
00499     // Default I/O and decompression methods, document readers don't need to know about these
00500 #ifndef DOXYGEN_IGNORE
00501     static WT_Result default_close (WT_File & file);
00502     static WT_Result default_end_seek (WT_File & file);
00503     static WT_Result default_open (WT_File & file);
00504     static WT_Result default_read (WT_File & file,    int desired_bytes, int & bytes_read, void * buffer);
00505     static WT_Result default_seek (WT_File & file, int distance, int & amount_seeked);
00506     static WT_Result default_tell (WT_File & file, unsigned long *current_file_pointer_position);
00507     static WT_Result default_write(WT_File & file, int size, void const * buffer);
00508 #endif
00509 
00510 private:
00511 
00512     WT_String           m_filename;
00513     WT_File_mode        m_mode;
00514     WT_File_Heuristics  m_heuristics;
00515 
00516     WT_Rendition        m_desired_rendition;
00517     WT_Rendition *      m_rendition;
00518 
00519 
00520     WT_Opcode            m_opcode;
00521     WT_Object *          m_current_object;
00522     WT_Layer_List        m_layer_list;
00523     WT_Object_Node_List  m_object_node_list;
00524     WT_Dash_Pattern_List m_dpat_list;
00525 
00526 
00527     WT_Boolean          m_have_read_first_opcode;
00528     WT_Logical_Point    m_current_point;
00529     int                 m_next_incarnation;
00530     int                 m_actual_file_position;
00531     int                 m_paren_count;
00532     int                 m_tab_level;
00533     WT_FIFO<WT_Byte>    m_read_fifo;
00534 
00535     WT_Byte             m_quote;
00536     WT_Boolean          m_processing_quoted_string;
00537     WT_Boolean          m_processing_escaped_literal;
00538     WT_FIFO<WT_Byte>    m_string_accumulator;
00539 
00540     WT_Compressor *     m_compressor;
00541     WT_DeCompressor *   m_decompressor;
00542     int                 m_data_decompression;
00543     WT_FIFO<WT_Byte>    m_decomp_leftover_data_buffer;
00544 
00545     WT_Drawable *       m_delayed_drawable;
00546     WT_Boolean          m_currently_dumping_delayed_drawable;
00547 
00548     int                 m_current_file_position;
00549     int                 m_this_opcode_start_position;
00550     int                 m_number_of_opcodes_read;
00551     WT_File_Stats *     m_file_stats;
00552 
00553     // Persistant scratch values in case we run out of data
00554     WT_Integer32        m_read_colors_state;
00555     WT_Integer32        m_read_ascii_value;
00556     int                 m_read_ascii_sign;
00557     double              m_read_ascii_double_value;
00558     double              m_read_ascii_double_sign;
00559     double              m_read_ascii_double_divisor;
00560     WT_Logical_Point    m_read_ascii_logical_point_value;
00561     WT_Integer32        m_temp_index;
00562     WT_RGBA32           m_temp_rgba;
00563     WT_Logical_Box      m_temp_box;
00564     WT_Directory        m_directory;
00565 
00566         char                            m_write_ascii_format[0xf];
00567 
00568     //As we skip unknown extended ascii opcodes (possibly because, those opcodes
00569     //were added as part of a subsequent whip toolkit releases), we just accumulate
00570     //the unknown opcode's field length so that we can seek back and read them
00571     //when unknown opcode materializes as part of WT_Unknown::materialize.
00572     WT_Unsigned_Integer16 m_skip_byte_length;
00573 
00574     enum
00575     {
00576         Getting_Count_Byte,
00577         Getting_Extended_Count_Short
00578     }               m_read_count_state;
00579 
00580     enum
00581     {
00582         Eating_Initial_Whitespace,
00583         Getting_Sign,
00584         Eating_Post_Sign_Whitespace,
00585         Getting_First_Digit,
00586         Accumulating_Subsequent_Digits,
00587         Accumulating_Fractional_Digits,
00588         Accumulating_Exponent
00589     }               m_read_ascii_integer32_state,
00590                     m_read_ascii_double_state;
00591 
00592     enum
00593     {
00594         Getting_X_Coordinate,
00595         Getting_Comma,
00596         Getting_Y_Coordinate
00597     }               m_read_ascii_logical_point_state;
00598     enum
00599     {
00600         Getting_Min_Point,
00601         Eating_Middle_Whitespace,
00602         Getting_Max_Point
00603     }               m_read_ascii_logical_box_state;
00604     enum
00605     {
00606         Getting_First_Value,
00607         Getting_Separator,
00608         Getting_Green,
00609         Getting_Green_Comma,
00610         Getting_Blue,
00611         Getting_Blue_Comma,
00612         Getting_Alpha
00613     }               m_read_ascii_color_state;
00614 
00615     int m_read_hex_multiple_state;
00616 
00617     enum
00618     {
00619         Eating_Whitespace,
00620         Getting_Hex_Value
00621     }               m_read_hex_state;
00622 
00623 
00624                  WT_Result      shut_down_decompression();
00625 
00626 
00627 private:
00628     WT_File (WT_File const &)
00629     {
00630         WD_Complain ("cannot copy WT_File");
00631     } // prohibited
00632 
00633 
00634     WT_File & operator= (WT_File const &)
00635     {
00636         WD_Complain ("cannot assign WT_File");
00637         return *this;
00638     } // prohibited
00639 
00640     static WT_Result temporary_decomp_leftover_end_seek (WT_File & file);
00641     static WT_Result temporary_decomp_leftover_read (WT_File & file,    int desired_bytes, int & bytes_read, void * buffer);
00642     static WT_Result temporary_decomp_leftover_seek (WT_File & file,    int desired_bytes, int & bytes_seeked);
00643 
00644     WT_Result                    write_uncompressed_tab_level(void);
00645     WT_Result                    write_uncompressed        (char const * str);
00646     WT_Result                    write_uncompressed        (WT_Byte a_byte);
00647 
00648     /*
00649     Parent application would typically open a dwf file in Block_Append or
00650     Block_Read mode to append new blocks at the end and update the
00651     directory info. Read_Write mode of opening dwf file feature was
00652     primarily added for server side programming (non-streaming users). In
00653     such a scenario, initialize_open_for_read_write_mode function will set
00654     the file heuristics format type to either binary or ascii and read
00655     through the directory information and set the file pointer position to
00656     the begining file offset of the existing directory opcode information.
00657     So, a subseqeunt change in rendition blockref would signal addition of
00658     new block at the end with new drawables following it. Whip toolkit
00659     will finally take care of rewriting the updated directory information.
00660     Also, when opened in Block_Append mode, we read through the existing
00661     dwf data to make sure that we have the right rendition attribute
00662     data set before we start appending new information. Also, to properly
00663     transform the appended block information in to relativized dwf data,
00664     we need to read through existing information. We don't have to do
00665     this for Block_Read mode.
00666     */
00667     WT_Result       initialize_open_for_block_read_mode();
00668     WT_Result       initialize_open_for_block_append_mode();
00669 
00670     /*Since the block size for a already serialized block is not decided
00671     up until the next blockref gets serialized (as mentioned above in the
00672     comments for set_block_size_for_tail_blockref function), we wait till
00673     the file close time (when the block size for all blocks is pretty much
00674     decided) and seek back to the blockref serialized instances and
00675     re-serialize them with the updated block size information. */
00676     WT_Result       rewrite_blockref_instance(WT_BlockRef *blockref);
00677 
00678     /*rewrite_blockref_instance function updates an (one) already serialized
00679     blockref instance (which is not part of the directory instance).
00680     rewrite_block_sizes_for_all_blockrefs loops through and does the rewriting
00681     business for all of the previously serialized blockref instances.*/
00682     WT_Result       rewrite_block_sizes_for_all_blockrefs();
00683 
00684 };
00685 
00687 
00688 
00690 //extern WT_File  _WT_File_g_none;
00691 
00692 
00693 // This stuff collects statistics about the file being read into the viewer.
00694 // The class isn't used when writing to a file.
00695 
00696 #include "whiptk/file_stats.h"
00697 
00698 
00699 #endif // FILE_HEADER

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