Ceylan::XML::XMLSavingVisitor Class Reference

XML visitor dedicated to the saving of an XML tree (in memory) to an output stream, for example a file. More...

#include <CeylanXMLVisitor.h>

Inheritance diagram for Ceylan::XML::XMLSavingVisitor:

Inheritance graph
[legend]
Collaboration diagram for Ceylan::XML::XMLSavingVisitor:

Collaboration graph
[legend]

List of all members.

Public Types

typedef std::string ClosingMarkup
enum  TextOutputFormat { rawText, html }
 Defines what text output formats for TextDisplayable instances are available. More...

Public Member Functions

 XMLSavingVisitor (System::OutputStream &output)
 Creates a XML visitor dedicated to the saving of a XML tree.
virtual ~XMLSavingVisitor () throw ()
 Virtual destructor.
virtual Height getHeight () const
 Returns current height.
virtual void incrementHeight ()
 Increments current height.
virtual void decrementHeight ()
 Decrements current height.
virtual void visit (XMLMarkup &xmlMarkup)
 Visits specified XML markup and saves it to the internal output stream.
virtual void visit (XMLText &xmlText)
 Visits specified XML text and saves it to the internal output stream.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns a user-friendly description of the state of this object.

Static Public Member Functions

static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Static Public Attributes

static std::string OffsetForMarkup = "\t"
 The offset for serialized XLM elements.

Protected Attributes

System::OutputStream_output
 The OutputStream where XML trees will be written.
std::stack< ClosingMarkup_markupsToClose

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Private Member Functions

 XMLSavingVisitor (const XMLSavingVisitor &source)
 Copy constructor made private to ensure that it will never be called.
XMLSavingVisitoroperator= (const XMLSavingVisitor &source)
 Assignment operator made private to ensure that it will never be called.


Detailed Description

XML visitor dedicated to the saving of an XML tree (in memory) to an output stream, for example a file.

Its role is to visit a XML tree and saves its nodes in order so that a well-formed XML document is serialized, included a starting XML header.

Definition at line 222 of file CeylanXMLVisitor.h.


Member Typedef Documentation

Definition at line 317 of file CeylanXMLVisitor.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

XMLSavingVisitor::XMLSavingVisitor ( System::OutputStream output  ) 

Creates a XML visitor dedicated to the saving of a XML tree.

Parameters:
output the output stream that should be used to save the XML tree. This visitor does not take ownership of this stream, it will not close nor delete it when itself destroyed.

Definition at line 101 of file CeylanXMLVisitor.cc.

XMLSavingVisitor::~XMLSavingVisitor (  )  throw () [virtual]

Virtual destructor.

Definition at line 109 of file CeylanXMLVisitor.cc.

Ceylan::XML::XMLSavingVisitor::XMLSavingVisitor ( const XMLSavingVisitor source  )  [private]

Copy constructor made private to ensure that it will never be called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.

Note:
Made to avoid unwanted hidden clone of the Singleton.


Member Function Documentation

void XMLSavingVisitor::decrementHeight (  )  [virtual]

Ceylan::Height XMLSavingVisitor::getHeight (  )  const [virtual]

Returns current height.

Reimplemented from Ceylan::TreeHeightAwareVisitor< XMLElement >.

Definition at line 133 of file CeylanXMLVisitor.cc.

References _markupsToClose.

Referenced by decrementHeight(), and visit().

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]

void XMLSavingVisitor::incrementHeight (  )  [virtual]

Increments current height.

Reimplemented from Ceylan::TreeHeightAwareVisitor< XMLElement >.

Definition at line 118 of file CeylanXMLVisitor.cc.

XMLSavingVisitor& Ceylan::XML::XMLSavingVisitor::operator= ( const XMLSavingVisitor source  )  [private]

Assignment operator made private to ensure that it will never be called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const string XMLSavingVisitor::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

Returns a user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
TextDisplayable

Reimplemented from Ceylan::XML::XMLVisitor.

Definition at line 212 of file CeylanXMLVisitor.cc.

References _markupsToClose, _output, Ceylan::low, and Ceylan::System::OutputStream::toString().

void XMLSavingVisitor::visit ( XMLText xmlText  )  [virtual]

Visits specified XML text and saves it to the internal output stream.

Parameters:
xmlText the XML text to save.
Exceptions:
VisitException if this saving failed.
Note:
If the signature was not inherited, the specified text would by 'const'.

Implements Ceylan::XML::XMLVisitor.

Definition at line 188 of file CeylanXMLVisitor.cc.

References _markupsToClose, _output, Ceylan::XML::EndOfLine, getHeight(), OffsetForMarkup, Ceylan::XML::XMLText::saveTo(), Ceylan::System::OutputStream::write(), and Ceylan::System::OutputStream::writeUint8().

void XMLSavingVisitor::visit ( XMLMarkup xmlMarkup  )  [virtual]

Visits specified XML markup and saves it to the internal output stream.

Parameters:
xmlMarkup the XML markup to save.
Exceptions:
VisitException if this saving failed.
Note:
If the signature was not inherited, the specified markup would by 'const'.

Implements Ceylan::XML::XMLVisitor.

Definition at line 164 of file CeylanXMLVisitor.cc.

References _markupsToClose, _output, Ceylan::XML::EndOfLine, Ceylan::XML::XMLMarkup::getClosingMarkup(), getHeight(), OffsetForMarkup, Ceylan::XML::XMLMarkup::saveTo(), Ceylan::System::OutputStream::write(), and Ceylan::System::OutputStream::writeUint8().


Member Data Documentation

Definition at line 338 of file CeylanXMLVisitor.h.

Referenced by decrementHeight(), getHeight(), toString(), and visit().

The OutputStream where XML trees will be written.

Definition at line 326 of file CeylanXMLVisitor.h.

Referenced by decrementHeight(), toString(), and visit().

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().

string XMLSavingVisitor::OffsetForMarkup = "\t" [static]

The offset for serialized XLM elements.

Definition at line 314 of file CeylanXMLVisitor.h.

Referenced by decrementHeight(), and visit().


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

Generated on Thu Jun 4 20:41:13 2009 for Ceylan by  doxygen 1.5.8