Ceylan::XML::XMLMarkup Class Reference

Describes a XML markup. More...

#include <CeylanXMLElement.h>

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

List of all members.

Public Types

enum  TextOutputFormat { rawText, html }
 

Defines what text output formats for TextDisplayable instances are available.

More...

Public Member Functions

 XMLMarkup ()
 Creates an empty XML markup.
 XMLMarkup (const MarkupName &name)
 Creates a named XML markup.
virtual ~XMLMarkup () throw ()
 Virtual destructor.
virtual MarkupName getMarkupName () const
virtual std::string getClosingMarkup () const
virtual bool hasAttribute (const AttributeName &name) const
 Returns whether this attribute, specified by its name, is defined in this markup.
virtual AttributeValue getAttribute (const AttributeName &name) const
 Returns the value of the attribute, specified by its name.
virtual AttributeValue getExistingAttribute (const AttributeName &name) const
 Returns the value of the attribute, specified by its name.
virtual void setAttribute (const AttributeName &name, const AttributeValue &value)
 Adds specified name-value pair as an attribute of this markup.
virtual AttributeMapgetAttributes ()
 Returns a reference to the internal attribute map.
virtual void loadFrom (System::InputStream &input)
 Loads a new instance state from specified stream.
virtual void accept (Visitor &visitor)
 Allows given visitor to visit this object, thanks to a callback: 'visitor.visit( *this ) ;'.
virtual void saveTo (System::OutputStream &output) const
 Saves the instance state to specified 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.

Protected Attributes

MarkupName _name
 Name of the markup.
AttributeMap _attributes
 Attributes of a XML markup, sort of tagged values, i.e.

Static Protected Attributes

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

Private Member Functions

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

Detailed Description

Describes a XML markup.

A markup has a name and can have attributes, which are pairs of name and value.

Note:
The fact that it can enclose any number of XML elements is represented through the XML tree.

Definition at line 167 of file CeylanXMLElement.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

XMLMarkup::XMLMarkup (  ) 

Creates an empty XML markup.

Definition at line 96 of file CeylanXMLElement.cc.

XMLMarkup::XMLMarkup ( const MarkupName name  )  [explicit]

Creates a named XML markup.

Parameters:
name the markup name, for example 'para' for markup

.

Definition at line 104 of file CeylanXMLElement.cc.

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

Virtual destructor.

Definition at line 112 of file CeylanXMLElement.cc.

Ceylan::XML::XMLMarkup::XMLMarkup ( const XMLMarkup 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 XMLMarkup::accept ( Visitor visitor  )  [virtual]

Allows given visitor to visit this object, thanks to a callback: 'visitor.visit( *this ) ;'.

Implements the Visitable interface.

Note:
The specified visitor must be a XML visitor, otherwise a VisitException is thrown.

Implements Ceylan::Visitable.

Definition at line 203 of file CeylanXMLElement.cc.

References Ceylan::Visitor::toString(), and Ceylan::XML::XMLVisitor::visit().

string XMLMarkup::getAttribute ( const AttributeName name  )  const [virtual]

Returns the value of the attribute, specified by its name.

Parameters:
name the attribute name.
Returns:
the value associated with the attribute name, or an empty string if the attribute is not defined in this markup.

Definition at line 146 of file CeylanXMLElement.cc.

References _attributes.

AttributeMap & XMLMarkup::getAttributes (  )  [virtual]

Returns a reference to the internal attribute map.

This method may be used to manage the attributes of a markup from outside, for example when reading an XML file.

Definition at line 184 of file CeylanXMLElement.cc.

References _attributes.

Referenced by Ceylan::XML::XMLParser::handleNextElement().

string XMLMarkup::getClosingMarkup (  )  const [virtual]

Definition at line 128 of file CeylanXMLElement.cc.

References _name.

Referenced by Ceylan::XML::XMLSavingVisitor::visit().

string XMLMarkup::getExistingAttribute ( const AttributeName name  )  const [virtual]

Returns the value of the attribute, specified by its name.

Parameters:
name the attribute name.
Returns:
the value associated with the attribute name.
Exceptions:
XMLElementException if no such attribute could be found.

Definition at line 160 of file CeylanXMLElement.cc.

References _attributes.

MarkupName XMLMarkup::getMarkupName (  )  const [virtual]

Definition at line 119 of file CeylanXMLElement.cc.

References _name.

Referenced by Ceylan::XML::XMLSearchingVisitor::visit().

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]
bool XMLMarkup::hasAttribute ( const AttributeName name  )  const [virtual]

Returns whether this attribute, specified by its name, is defined in this markup.

Parameters:
name the attribute name.
Returns:
true iff an attribute with this name already exists for this markup.

Definition at line 137 of file CeylanXMLElement.cc.

References _attributes.

void XMLMarkup::loadFrom ( System::InputStream input  )  [virtual]

Loads a new instance state from specified stream.

Parameters:
input the input stream from which the state will be read.
Exceptions:
SerializationException if the operation failed.

Implements Ceylan::Serializable.

Definition at line 193 of file CeylanXMLElement.cc.

XMLMarkup& Ceylan::XML::XMLMarkup::operator= ( const XMLMarkup 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 XMLMarkup::saveTo ( System::OutputStream output  )  const [virtual]

Saves the instance state to specified stream.

Parameters:
output the output stream to which the state will be written.
Exceptions:
SerializationException if the operation failed.
Note:
The toString is not used as they do not serve the same purpose, and differ in terms of encoding.

Implements Ceylan::XML::XMLElement.

Definition at line 219 of file CeylanXMLElement.cc.

References _attributes, _name, and Ceylan::System::OutputStream::write().

Referenced by Ceylan::XML::XMLSavingVisitor::visit().

void XMLMarkup::setAttribute ( const AttributeName name,
const AttributeValue value 
) [virtual]

Adds specified name-value pair as an attribute of this markup.

Parameters:
name the attribute name.
value the attribute value.

If an attribute with the same name was already existing, its value is updated with this newer value.

Definition at line 175 of file CeylanXMLElement.cc.

References _attributes.

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 XMLMarkup::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

Implements Ceylan::TextDisplayable.

Definition at line 237 of file CeylanXMLElement.cc.

References _attributes, _name, Ceylan::encodeToHTML(), Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::html.

Referenced by Ceylan::XML::XMLParser::handleNextElement().


Member Data Documentation

Attributes of a XML markup, sort of tagged values, i.e.

pair of name-value.

Definition at line 381 of file CeylanXMLElement.h.

Referenced by getAttribute(), getAttributes(), getExistingAttribute(), hasAttribute(), saveTo(), setAttribute(), and toString().

Name of the markup.

Definition at line 363 of file CeylanXMLElement.h.

Referenced by getClosingMarkup(), getMarkupName(), saveTo(), and toString().

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


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 13:43:22 2010 for Ceylan by  doxygen 1.6.3