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

file.h

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

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