The Micro C++ Library
|
The Formatter class defines an interface to emit potentially nested content. More...
#include <micxx/traits/Formatter.hxx>
Inherited by micxx::XMLFormatter.
Public Member Functions | |
virtual | ~Formatter () |
virtual void | clear ()=0 |
Reset the internal kept state. | |
virtual void | endElement ()=0 |
Close the last element that has not been closed already. | |
virtual void | flush (std::ostream &stream)=0 |
If supported, flush the formatted content to the output stream stream. | |
virtual void | startElement (const std::string &name)=0 |
Start a new (nested) element with specified name. | |
virtual void | text (const std::string &str)=0 |
Format text str (necessary output escaping is done appropriately). | |
virtual void | text (const char *chars)=0 |
Format text chars (necessary output escaping is done appropriately). | |
virtual void | text (unsigned long long value)=0 |
Format value as text (necessary output escaping is done appropriately). | |
virtual void | text (long long value)=0 |
Format value as text (necessary output escaping is done appropriately). | |
virtual void | text (const SYSTEMTIME &systemTime)=0 |
Format systemTime as text (necessary output escaping is done appropriately). | |
virtual Formatter & | operator<< (const std::string &plainText)=0 |
Format plainText as verbatim text content (no output escaping should be performed in any way) | |
virtual Formatter & | operator<< (const char *plainChars)=0 |
Format plainChars as verbatim text content (no output escaping should be performed in any way) |
The Formatter class defines an interface to emit potentially nested content.
Nested content is formatted into nested elements. Each element may have an arbitrary name. A nested element is started, than the content for this element is formatted by either formatting text or by recursively formatting another nested element. Finally each element must be closed properly:
void foo(micxx::traits::Formatter * formatter) { formatter->startElement("A"); formatter->text("Text"); formatter->startElement("B"); // nested element within A formatter->text("Nested Text"); formatter->endElement(); // close nested element B formatter->endElement(); // close element A formatter->flush(cout); }
virtual micxx::traits::Formatter::~Formatter | ( | ) | [inline, virtual] |
{}
virtual void micxx::traits::Formatter::clear | ( | ) | [pure virtual] |
Reset the internal kept state.
Implemented in micxx::XMLFormatter.
virtual void micxx::traits::Formatter::endElement | ( | ) | [pure virtual] |
Close the last element that has not been closed already.
Implemented in micxx::XMLFormatter.
virtual void micxx::traits::Formatter::flush | ( | std::ostream & | stream | ) | [pure virtual] |
If supported, flush the formatted content to the output stream stream.
Implemented in micxx::XMLFormatter.
virtual Formatter& micxx::traits::Formatter::operator<< | ( | const char * | plainChars | ) | [pure virtual] |
Format plainChars as verbatim text content (no output escaping should be performed in any way)
Implemented in micxx::XMLFormatter.
virtual Formatter& micxx::traits::Formatter::operator<< | ( | const std::string & | plainText | ) | [pure virtual] |
Format plainText as verbatim text content (no output escaping should be performed in any way)
Implemented in micxx::XMLFormatter.
virtual void micxx::traits::Formatter::startElement | ( | const std::string & | name | ) | [pure virtual] |
Start a new (nested) element with specified name.
Implemented in micxx::XMLFormatter.
virtual void micxx::traits::Formatter::text | ( | const char * | chars | ) | [pure virtual] |
Format text chars (necessary output escaping is done appropriately).
Implemented in micxx::XMLFormatter.
virtual void micxx::traits::Formatter::text | ( | const SYSTEMTIME & | systemTime | ) | [pure virtual] |
Format systemTime as text (necessary output escaping is done appropriately).
Implemented in micxx::XMLFormatter.
virtual void micxx::traits::Formatter::text | ( | long long | value | ) | [pure virtual] |
Format value as text (necessary output escaping is done appropriately).
Implemented in micxx::XMLFormatter.
virtual void micxx::traits::Formatter::text | ( | const std::string & | str | ) | [pure virtual] |
Format text str (necessary output escaping is done appropriately).
Implemented in micxx::XMLFormatter.
virtual void micxx::traits::Formatter::text | ( | unsigned long long | value | ) | [pure virtual] |
Format value as text (necessary output escaping is done appropriately).
Implemented in micxx::XMLFormatter.