WT_File Class Reference
[File I/O objects]

#include <file.h>

Inheritance diagram for WT_File:

Inheritance graph
[legend]
Collaboration diagram for WT_File:

Collaboration graph
[legend]
List of all members.

Detailed Description

Coordinates the reading and writing of WHIP! data and classic DWF files.

Opening a file for writing:

Opening a file for reading:

Examples:

WhipExamples/AppendBlocks.cpp, WhipExamples/Color.cpp, WhipExamples/ColorMap.cpp, WhipExamples/ContourSet.cpp, WhipExamples/DashPattern.cpp, WhipExamples/DataReading.cpp, WhipExamples/DrawingInfo.cpp, WhipExamples/FileRead.cpp, WhipExamples/FileWrite.cpp, WhipExamples/FilledEllipse.cpp, WhipExamples/FillPattern.cpp, WhipExamples/Font.cpp, WhipExamples/GouraudPolyline.cpp, WhipExamples/GouraudPolytriangle.cpp, WhipExamples/Layer.cpp, WhipExamples/LinePattern.cpp, WhipExamples/LineWeight.cpp, WhipExamples/Main.cpp, WhipExamples/ObjectNode.cpp, WhipExamples/OutlineEllipse.cpp, WhipExamples/OutputBlocks.cpp, WhipExamples/Polygon.cpp, WhipExamples/Polyline.cpp, WhipExamples/Polymarker.cpp, WhipExamples/Polytriangle.cpp, WhipExamples/ReadTwoBlocks.cpp, WhipExamples/SingleLine.cpp, WhipExamples/Text.cpp, WhipExamples/Url.cpp, WhipExamples/UserData.cpp, WhipExamples/View.cpp, WhipExamples/Viewport.cpp, WhipExamples/Visibility.cpp, WhipExamples/WriteBlocks.cpp, and WhipExamples/WriteRedline.cpp.

Definition at line 169 of file file.h.

Public Types

enum  WT_File_mode {
  File_Inactive, File_Read, File_Write, Block_Write,
  Block_Read, Block_Append
}
 The mode used for reading or writing. More...

Public Member Functions

 WT_File () throw (WT_Result)
 Constructs a WT_File object.
virtual ~WT_File ()
 Destroys a WT_File object.
const WT_Opcodecurrent_opcode () const
int data_decompression ()
int decrement_paren_count ()
int decrement_tab_level ()
WT_Drawabledelayed_drawable () const
WT_File_Statsfile_stats ()
WT_Boolean have_read_first_opcode () const
int increment_paren_count ()
int increment_tab_level ()
int next_incarnation ()
int paren_count () const
WT_Result put_back (WT_Byte const &a_byte)
void set_data_decompression (int decompression)
void set_delayed_drawable (WT_Drawable *drwbl)
void set_directory (WT_Directory directory)
void set_have_read_first_opcode (WT_Boolean state)
void set_paren_count (int count)
void set_tab_level (int count)
WT_Unsigned_Integer16 skip_byte_length () const
int tab_level () const
int this_opcode_start_position () const
virtual WT_Result close ()
 Close the file.
WT_File_mode file_mode () const
 Returns the file mode with which the file was opened (one of enum WT_File_mode.).
WT_String const & filename () const
 Returns the filename that was opened.
WT_File_Heuristicsheuristics ()
 Returns an accessor to the WT_File_Heuristics object for this file.
virtual WT_Result open ()
 Open the file based on the filename, file mode, and heuristics, which should be configured prior to calling open().
void set_file_mode (WT_File_mode mode)
 Sets the file mode to be used for opening the file.
void set_filename (char const *name)
 Sets the filename which is to be opened.
void set_filename (int length, WT_Unsigned_Integer16 const *name)
 Sets the filename which is to be opened.
void set_filename (WT_Unsigned_Integer16 const *name)
 Sets the filename which is to be opened.
int toolkit_decimal_revision () const
 Returns the decimal revision of the toolkit.
virtual int toolkit_major_revision () const
 Returns the major revision of the toolkit.
virtual int toolkit_minor_revision () const
 Returns the minor revision of the toolkit.
virtual WT_Object const * current_object () const
 Used when a file is opened for reading to return a read-only accessor to the current object set in get_next_object() -> get_next_object_shell().
virtual WT_Logical_Point current_point ()
virtual void set_current_object (WT_Object *pObj)
virtual WT_Dash_Pattern_Listdash_pattern_list ()
 Returns a writable reference to the local WT_Dash_Pattern_List object for this file (contains the set of WT_Dash_Pattern objects for this file.).
virtual WT_Renditiondesired_rendition ()
 Returns the write-mode optimizing WT_Rendition object for this file.
virtual WT_Layer_Listlayer_list ()
 Returns a writable reference to the local WT_Layer_List object for this file (contains the set of WT_Layer objects for this file.).
virtual WT_Renditionrendition ()
 Returns the read-mode current WT_Rendition object for this file.
virtual WT_Objectobject ()
 Used when a file is opened for reading to return an accessor to the current object set in get_next_object() -> get_next_object_shell().
virtual WT_Object_Node_Listobject_node_list ()
 Returns a writable reference to the local WT_Object_Node_List object for this file (contains the set of WT_Object_Node objects for this file.).
virtual void set_stream_user_data (void *stream_user_data)
 Sets a pointer to store a user-defined data item.
virtual void * stream_user_data ()
 Retrieves the pointer to a user-defined data item.
virtual WT_Result get_next_object ()
 Reads the next object from the file stream (but does not process it.).
virtual WT_Result get_next_object_shell ()
 Reads the next object opcode and determines the object type, creates an empty (default) object.
virtual WT_Result process_next_object ()
 Processes the next object.
I/O customization set/get methods
These methods allow client code to override how low-level file I/O works by allowing client code to selectively implement various I/O procedures.

void set_stream_close_action (WT_Stream_Close_Action action)
void set_stream_end_seek_action (WT_Stream_End_Seek_Action action)
void set_stream_open_action (WT_Stream_Open_Action action)
void set_stream_read_action (WT_Stream_Read_Action action)
void set_stream_seek_action (WT_Stream_Seek_Action action)
void set_stream_tell_action (WT_Stream_Tell_Action action)
void set_stream_write_action (WT_Stream_Write_Action action)
WT_Stream_Close_Action stream_close_action ()
WT_Stream_End_Seek_Action stream_end_seek_action ()
WT_Stream_Open_Action stream_open_action ()
WT_Stream_Read_Action stream_read_action ()
WT_Stream_Seek_Action stream_seek_action ()
WT_Stream_Tell_Action stream_tell_action ()
WT_Stream_Write_Action stream_write_action ()
BlockRef and Directory methods
Deprecated:
These methods are available only for backward compatibility to allow client code to continue to write DWF 00.55 files which contain WT_BlockRef objects.


WT_Result add_blockref (WT_BlockRef &blockref)
 Adds a new WT_BlockRef object to the local WT_Directory.
WT_Result is_file_type_binary (WT_Boolean &bBinaryFileType, int &end_byte_length)
 Sets the bBinaryFileType to WD_True if the file is binary and sets end_byte_length to the length of the last opcode (EndOfDWF).
WT_Directory const get_directory ()
 Returns the local WT_Directory object for this file (contains the set of WT_BlockRef objects for this file.).
WT_Result get_to_the_directory ()
 Moves the file pointer to the beginning of the directory for this file.

Protected Attributes

void * m_stream_user_data
 Holds a pointer to a user-defined data item.
Reader processing handler properties
CALLBACK_LIST WT_Stream_End_Seek_Action m_stored_stream_end_seek_action
WT_Stream_Read_Action m_stored_stream_read_action
WT_Stream_Seek_Action m_stored_stream_seek_action
WT_Stream_Close_Action m_stream_close_action
WT_Stream_End_Seek_Action m_stream_end_seek_action
WT_Stream_Open_Action m_stream_open_action
WT_Stream_Read_Action m_stream_read_action
WT_Stream_Seek_Action m_stream_seek_action
WT_Stream_Tell_Action m_stream_tell_action
WT_Stream_Write_Action m_stream_write_action

Friends

class WT_W2D_Class_Factory
class WT_Class_Factory
class WT_Macro_Definition


Member Enumeration Documentation

enum WT_File::WT_File_mode
 

The mode used for reading or writing.

Enumerator:
File_Inactive  Default mode - nothing can be done with the file in this mode.
File_Read  Open file for writing.
File_Write  Open file for writing.
Block_Write 
Deprecated:
Block writing is only available for classic DWF files of version 00.55.
Block_Read 
Deprecated:
Block reading is only available for classic DWF files of version 00.55.
Block_Append 
Deprecated:
Block appending is only available for classic DWF files of version 00.55.

Definition at line 178 of file file.h.


Member Function Documentation

virtual WT_Rendition& WT_File::desired_rendition  )  [inline, virtual]
 

Returns the write-mode optimizing WT_Rendition object for this file.

Warning:
Clients should use this when setting rendition attributes and should never use this during read operations (use rendition() when reading.)
See also:
Rendition attributes
Examples:
WhipExamples/AppendBlocks.cpp, WhipExamples/Color.cpp, WhipExamples/ColorMap.cpp, WhipExamples/DashPattern.cpp, WhipExamples/DrawingInfo.cpp, WhipExamples/FillPattern.cpp, WhipExamples/Font.cpp, WhipExamples/Layer.cpp, WhipExamples/LinePattern.cpp, WhipExamples/LineWeight.cpp, WhipExamples/ObjectNode.cpp, WhipExamples/SingleLine.cpp, WhipExamples/Url.cpp, WhipExamples/Viewport.cpp, WhipExamples/Visibility.cpp, WhipExamples/WriteBlocks.cpp, and WhipExamples/WriteRedline.cpp.

Definition at line 246 of file file.h.

virtual WT_Result WT_File::get_next_object  )  [virtual]
 

Reads the next object from the file stream (but does not process it.).

This calls get_next_object_shell() then WT_Object::materialize() to fully create and populate the object contents from the file. The file pointer is moved to the next object/opcode.

Return values:
WT_Result::Success The operation was successful.

virtual WT_Result WT_File::get_next_object_shell  )  [virtual]
 

Reads the next object opcode and determines the object type, creates an empty (default) object.

This method does not move the file pointer beyond the opcode of the object. If the object is not materialized through a call to the WT_Object::materialize() method (typically by the framework,) then upon retriving the next object shell, the current object is skipped through a call to WT_Object::skip_operand().

Warning:
Dangerous when used by client code and especially with deferred delete.
See also:
WT_Object::skip_operand(), WT_File_Heuristics::set_deferred_delete().

WT_Result WT_File::get_to_the_directory  ) 
 

Moves the file pointer to the beginning of the directory for this file.

Available when a file is opened as Block_Append or Block_Read

WT_Result WT_File::is_file_type_binary WT_Boolean bBinaryFileType,
int &  end_byte_length
 

Sets the bBinaryFileType to WD_True if the file is binary and sets end_byte_length to the length of the last opcode (EndOfDWF).

If the file mode is opened as Block_Append or Block_Read, this method will help in determining the file type (whether the file is in ascii or binary format).

virtual WT_Result WT_File::open  )  [virtual]
 

Open the file based on the filename, file mode, and heuristics, which should be configured prior to calling open().

Return values:
WT_Result::Success The operation was successful.
WT_Result::Out_Of_Memory_Error An internal object could not be created.
Examples:
WhipExamples/AppendBlocks.cpp, WhipExamples/DataReading.cpp, WhipExamples/FileRead.cpp, WhipExamples/FileWrite.cpp, WhipExamples/OutputBlocks.cpp, WhipExamples/ReadTwoBlocks.cpp, WhipExamples/SingleLine.cpp, WhipExamples/WriteBlocks.cpp, and WhipExamples/WriteRedline.cpp.

virtual WT_Result WT_File::process_next_object  )  [virtual]
 

Processes the next object.

This calls get_next_object(), and then calls the object's processing handler if configured or the object's default_process() method.

Return values:
WT_Result::Success The operation was successful.
Examples:
WhipExamples/DataReading.cpp, and WhipExamples/FileRead.cpp.

virtual WT_Rendition& WT_File::rendition  )  [inline, virtual]
 

Returns the read-mode current WT_Rendition object for this file.

Warning:
Clients should use this during read operations when reading the current rendition attributes, but should never use this during write operations (use desired_rendition() when writing.)
Examples:
WhipExamples/DataReading.cpp.

Definition at line 253 of file file.h.

virtual void WT_File::set_stream_user_data void *  stream_user_data  )  [inline, virtual]
 

Sets a pointer to store a user-defined data item.

Warning:
When the default stream action handlers are used, this is used internally to store the FILE pointer used to read/write the file. Users wishing to store a custom pointer and still use the default stream action handlers can use the WT_Heuristics::set_user_data() method.
Examples:
WhipExamples/DataReading.cpp.

Definition at line 263 of file file.h.

int WT_File::toolkit_decimal_revision  )  const [inline]
 

Returns the decimal revision of the toolkit.

The version is calculated as follows: (major_version * 100) + minor_version. For example, if the toolkit is version 00.55, the decimal revision is 55; for version 06.00, the decimal revision is 600.

Definition at line 223 of file file.h.

virtual int WT_File::toolkit_major_revision  )  const [inline, virtual]
 

Returns the major revision of the toolkit.

For example, if the toolkit is version 06.00, the major revision is 6.

Definition at line 227 of file file.h.

virtual int WT_File::toolkit_minor_revision  )  const [inline, virtual]
 

Returns the minor revision of the toolkit.

For example, if the toolkit is version 06.00, the minor revision is 0.

Definition at line 231 of file file.h.


The documentation for this class was generated from the following file:
Generated on Tue Jan 6 22:41:17 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5