HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FS_WriterStream Class Reference

#include <FS_WriterStream.h>

+ Inheritance diagram for FS_WriterStream:

Public Member Functions

 FS_WriterStream ()
 Default constructor, sets myStream to NULL. More...
 
 FS_WriterStream (const char *file)
 Convenience constructor for files on disk. Basically just calls init(). More...
 
virtual ~FS_WriterStream ()
 
virtual int64 getMemoryUsage (bool inclusive) const
 Get the amount of memory owned by this FS_WriterStream. More...
 
std::ostream * getStream () const
 Obtains the output stream. More...
 
bool removeFile ()
 Deletes the file, if possible. More...
 

Protected Member Functions

virtual bool init (const char *file)
 
virtual bool destroy (bool removefile)
 

Protected Attributes

UT_String myFile
 
UT_String myTempFile
 
std::ostream * myStream
 

Detailed Description

Examples:
FS/FS_HomeHelper.C, and FS/FS_HomeHelper.h.

Definition at line 29 of file FS_WriterStream.h.

Constructor & Destructor Documentation

FS_WriterStream::FS_WriterStream ( )

Default constructor, sets myStream to NULL.

FS_WriterStream::FS_WriterStream ( const char *  file)

Convenience constructor for files on disk. Basically just calls init().

virtual FS_WriterStream::~FS_WriterStream ( )
virtual

Destructor. Calls destroy() virtual, but since this is a destructor, any overriding destroy() methods in derived classes won't be called and should be explicitly invoked in derived class's destructor.

Member Function Documentation

virtual bool FS_WriterStream::destroy ( bool  removefile)
protectedvirtual

Destroys the output stream and removes file. If the stream refers to a section in an index file, the data is flushed out and the new section is embedded in the index file.

virtual int64 FS_WriterStream::getMemoryUsage ( bool  inclusive) const
virtual

Get the amount of memory owned by this FS_WriterStream.

std::ostream* FS_WriterStream::getStream ( ) const

Obtains the output stream.

virtual bool FS_WriterStream::init ( const char *  file)
protectedvirtual

Sets myFile member to file argument and creates myStream output stream. If file refers to a section in an index file (ie, using standard convention, the file name contains the '?' section separator character), then it creates a temporery file (whose path is stored in myTempFile) and a stream for that temporary file (represented by myStream), where the section data is being written out. In destroy(), the temp file is embedded into the final destination index file and then removed.

bool FS_WriterStream::removeFile ( )

Deletes the file, if possible.

Member Data Documentation

UT_String FS_WriterStream::myFile
protected

File path for the output stream. It can be an empty string if stream does not refer to a file.

Definition at line 69 of file FS_WriterStream.h.

std::ostream* FS_WriterStream::myStream
protected

The stream object used for writing out data. This class creates default stream for disk files, but derived classes can override init() and destroy() to create custom output streams.

Definition at line 79 of file FS_WriterStream.h.

UT_String FS_WriterStream::myTempFile
protected

Path to the temporary file, if the original file path refers to a section in an index file. This temp file holds new data written to that section.

Definition at line 74 of file FS_WriterStream.h.


The documentation for this class was generated from the following file: