SUMO - Simulation of Urban MObility
OutputFormatter Class Reference

Abstract base class for output formatters. More...

#include <OutputFormatter.h>

Inheritance diagram for OutputFormatter:
BinaryFormatter PlainXMLFormatter

Public Member Functions

virtual void closeOpener (std::ostream &into)=0
 Ends the most recently opened element start.
virtual bool closeTag (std::ostream &into, bool abbreviated=false)=0
 Closes the most recently opened tag.
virtual void openTag (std::ostream &into, const std::string &xmlElement)=0
 Opens an XML tag.
virtual void openTag (std::ostream &into, const SumoXMLTag &xmlElement)=0
 Opens an XML tag.
virtual void writeAttr (std::ostream &into, const std::string &attr, const std::string &val)=0
 writes an arbitrary attribute
virtual bool writeXMLHeader (std::ostream &into, const std::string &rootElement, const std::string xmlParams="", const std::string &attrs="", const std::string &comment="")=0
 Writes an XML header with optional configuration.
virtual ~OutputFormatter ()
 Destructor.

Detailed Description

Abstract base class for output formatters.

OutputFormatter format XML like output into the output stream. There are only two implementation at the moment, "normal" XML and binary XML.

Definition at line 58 of file OutputFormatter.h.


Constructor & Destructor Documentation

virtual OutputFormatter::~OutputFormatter ( ) [inline, virtual]

Destructor.

Definition at line 61 of file OutputFormatter.h.


Member Function Documentation

virtual void OutputFormatter::closeOpener ( std::ostream &  into) [pure virtual]

Ends the most recently opened element start.

Writes more or less nothing but ">" and a line feed.

Parameters:
[in]intoThe output stream to use

Implemented in BinaryFormatter, and PlainXMLFormatter.

Referenced by OutputDevice::closeOpener().

virtual bool OutputFormatter::closeTag ( std::ostream &  into,
bool  abbreviated = false 
) [pure virtual]

Closes the most recently opened tag.

Parameters:
[in]intoThe output stream to use
[in]namewhether abbreviated closing is performed
Returns:
Whether a further element existed in the stack and could be closed
Todo:
it is not verified that the topmost element was closed

Implemented in BinaryFormatter, and PlainXMLFormatter.

Referenced by OutputDevice::closeTag().

virtual void OutputFormatter::openTag ( std::ostream &  into,
const std::string &  xmlElement 
) [pure virtual]

Opens an XML tag.

An indentation, depending on the current xml-element-stack size, is written followed by the given xml element ("<" + xmlElement) The xml element is added to the stack, then.

Parameters:
[in]intoThe output stream to use
[in]xmlElementName of element to open
Returns:
The OutputDevice for further processing

Implemented in BinaryFormatter, and PlainXMLFormatter.

Referenced by OutputDevice::openTag().

virtual void OutputFormatter::openTag ( std::ostream &  into,
const SumoXMLTag xmlElement 
) [pure virtual]

Opens an XML tag.

Helper method which finds the correct string before calling openTag.

Parameters:
[in]intoThe output stream to use
[in]xmlElementId of the element to open

Implemented in BinaryFormatter, and PlainXMLFormatter.

virtual void OutputFormatter::writeAttr ( std::ostream &  into,
const std::string &  attr,
const std::string &  val 
) [pure virtual]

writes an arbitrary attribute

Parameters:
[in]intoThe output stream to use
[in]attrThe attribute (name)
[in]valThe attribute value

Implemented in BinaryFormatter, and PlainXMLFormatter.

Referenced by OutputDevice::writeAttr().

virtual bool OutputFormatter::writeXMLHeader ( std::ostream &  into,
const std::string &  rootElement,
const std::string  xmlParams = "",
const std::string &  attrs = "",
const std::string &  comment = "" 
) [pure virtual]

Writes an XML header with optional configuration.

If something has been written (myXMLStack is not empty), nothing is written and false returned.

Parameters:
[in]intoThe output stream to use
[in]rootElementThe root element to use
[in]xmlParamsAdditional parameters (such as encoding) to include in the <?xml> declaration
[in]attrsAdditional attributes to save within the rootElement
[in]commentAdditional comment (saved in front the rootElement)
Todo:

Check which parameter is used herein

Describe what is saved

Implemented in BinaryFormatter, and PlainXMLFormatter.

Referenced by OutputDevice::writeXMLHeader().


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines