GVectors::XMLWriter Class Reference

The class writing a VectorStore to disk. More...

#include <xmlfilewriter.h>

Inheritance diagram for GVectors::XMLWriter:

GVectors::FileWriter List of all members.

Public Member Functions

 XMLWriter (const std::string fn, bool tab=false)
 Constructor.
 XMLWriter (const XMLWriter &xfw)
 Copy constructor.
virtual ~XMLWriter ()
 Destructor.
void write (vslevel_t level, const vv_ref_t visualvector)
 Write the item in XML format.

Protected Member Functions

void put_tabs (vslevel_t no)
 Write tabs to file.

Private Attributes

FILE * file
 Pointer to the 'object' controlling the stream.
std::string filename
 The filename of the XML file.
vslevel_t lastlevel
 Holds the last level written.
bool firstrun
 Indicates whether or not XMLWriter::write() was called the first time.
bool tabify
 Flag indicating whether or not output should be tabified.

Detailed Description

The class writing a VectorStore to disk.

See xmlfilereader.h for the DTD used.


Constructor & Destructor Documentation

XMLWriter::XMLWriter ( const std::string  fn,
bool  tab = false 
)

Constructor.

Parameters:
fn A string holding the filename.
tab Set to true in order ot tabify the output.
Exceptions:
GVEXMLFileWrite Upon file i/o error.

XMLWriter::XMLWriter ( const XMLWriter xfw  ) 

Copy constructor.

Parameters:
xfw A const reference to a XMLWriter object.
Exceptions:
GVEXMLFileWrite Upon file i/o error.

XMLWriter::~XMLWriter (  )  [virtual]

Destructor. Writes the remaining closing tags and closes the file.


Member Function Documentation

void XMLWriter::put_tabs ( vslevel_t  no  )  [protected]

Puts the number of tabs specified to the file.

Parameters:
no The number of tabs to put on the output stream.

void XMLWriter::write ( vslevel_t  level,
const vv_ref_t  visualvector 
) [virtual]

Remarks:
This method is called for each item to store.
Writes the VisualVector passed to the XML file.

Parameters:
level The level of the item in the tree. This value is not written to XML file. The nesting of the tags represents the level.
visualvector The VisualVector to store in the file.

Implements GVectors::FileWriter.


Member Data Documentation

FILE* GVectors::XMLWriter::file [private]

Pointer to the 'object' controlling the stream obtained by calling fopen().

std::string GVectors::XMLWriter::filename [private]

The filename of the XML file.

vslevel_t GVectors::XMLWriter::lastlevel [private]

Holds the last level written. Used for writing closing tags.

bool GVectors::XMLWriter::firstrun [private]

Indicates whether or not XMLWriter::write() was called the first time. Also used for writing closing tags.

bool GVectors::XMLWriter::tabify [private]

When set to true, the output has tabs in order to indent, else, if set false, the output is pretty unpretty.


The documentation for this class was generated from the following files:
Generated on Sat Sep 8 19:37:31 2007 for libgvectors by  doxygen 1.4.7