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

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: FileWrite.cpp

Opening a file for reading: FileRead.cpp

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 153 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

Construction / destruction.
 WT_File ()
 Constructs a WT_File object.
 ~WT_File ()
 Destroys a WT_File object.
I/O startup / shutdown / status methods
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.
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.
int toolkit_major_revision () const
 Returns the major revision of the toolkit.
int toolkit_minor_revision () const
 Returns the minor revision of the toolkit.
Data access methods
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().
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.).
WT_Renditiondesired_rendition ()
 Returns the write-mode optimizing WT_Rendition object for this file.
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.).
WT_Renditionrendition ()
 Returns the read-mode current WT_Rendition object for this file.
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().
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.).
void set_stream_user_data (void *stream_user_data)
 Sets a pointer to store a user-defined data item.
void * stream_user_data ()
 Retrieves the pointer to a user-defined data item.
Reader state machine methods
WT_Result get_next_object ()
 Reads the next object from the file stream (but does not process it.).
WT_Result get_next_object_shell ()
 Reads the next object opcode and determines the object type, creates an empty (default) object.
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.

CALLBACK_LIST 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.
I/O customization propreties


Member Enumeration Documentation

enum WT_File::WT_File_mode
 

The mode used for reading or writing.

Enumeration values:
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 158 of file file.h.


Member Function Documentation

WT_Rendition& WT_File::desired_rendition  )  [inline]
 

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 224 of file file.h.

WT_Result WT_File::get_next_object  ) 
 

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.

WT_Result WT_File::get_next_object_shell  ) 
 

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).

WT_Result WT_File::open  ) 
 

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.

WT_Result WT_File::process_next_object  ) 
 

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.

WT_Rendition& WT_File::rendition  )  [inline]
 

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.)

Definition at line 231 of file file.h.

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

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.

Definition at line 241 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 203 of file file.h.

int WT_File::toolkit_major_revision  )  const [inline]
 

Returns the major revision of the toolkit.

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

Definition at line 207 of file file.h.

int WT_File::toolkit_minor_revision  )  const [inline]
 

Returns the minor revision of the toolkit.

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

Definition at line 211 of file file.h.


The documentation for this class was generated from the following file:
Generated on Tue May 17 12:07:51 2005 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.1