Describes a XML markup. More...
#include <CeylanXMLElement.h>
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 AttributeMap & | getAttributes () |
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. | |
XMLMarkup & | operator= (const XMLMarkup &source) |
Assignment operator made private to ensure that it will never be called. |
Describes a XML markup.
A markup has a name and can have attributes, which are pairs of name and value.
Definition at line 167 of file CeylanXMLElement.h.
enum Ceylan::TextDisplayable::TextOutputFormat [inherited] |
Defines what text output formats for TextDisplayable instances are available.
Definition at line 124 of file CeylanTextDisplayable.h.
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.
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.
void XMLMarkup::accept | ( | Visitor & | visitor | ) | [virtual] |
Allows given visitor to visit this object, thanks to a callback: 'visitor.visit( *this ) ;'.
Implements the Visitable interface.
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.
name | the attribute name. |
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.
name | the attribute name. |
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] |
Returns the current overall text format to be used by TextDisplayable instances.
Definition at line 63 of file CeylanTextDisplayable.cc.
References Ceylan::TextDisplayable::_OutputFormat.
Referenced by Ceylan::formatStringList(), Ceylan::formatStringMap(), toString(), Ceylan::Maths::Linear::Vector3::toString(), Ceylan::Maths::Linear::Vector2::toString(), Ceylan::Maths::Linear::Tripoint::toString(), Ceylan::Module::toString(), Ceylan::Maths::Linear::Matrix3::toString(), Ceylan::Maths::Linear::Matrix2::toString(), Ceylan::Maths::Linear::HomogeneousMatrix3::toString(), and Ceylan::Maths::Linear::Bipoint::toString().
bool XMLMarkup::hasAttribute | ( | const AttributeName & | name | ) | const [virtual] |
Returns whether this attribute, specified by its name, is defined in this markup.
name | the attribute name. |
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.
input | the input stream from which the state will be read. |
SerializationException | if the operation failed. |
Implements Ceylan::Serializable.
Definition at line 193 of file CeylanXMLElement.cc.
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.
output | the output stream to which the state will be written. |
SerializationException | if the operation failed. |
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.
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.
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.
displayables | a list of pointers to TextDisplayable instances/ | |
level | the requested verbosity level. |
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.
level | the requested verbosity level. |
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().
AttributeMap Ceylan::XML::XMLMarkup::_attributes [protected] |
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().
MarkupName Ceylan::XML::XMLMarkup::_name [protected] |
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.
Definition at line 158 of file CeylanTextDisplayable.h.
Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().