This class outputs xml-tags and end-tags. More...

#include <cxxtools/xmltag.h>

Public Member Functions

 Xmltag (const std::string &tag, std::ostream &out=*default_out)
 prints start-tag and remember tag
 Xmltag (const std::string &tag, const std::string &parameter, std::ostream &out=*default_out)
 prints start-tag with parameters and remember tag
 ~Xmltag ()
 closes tag
const std::string & get () const
void close ()
void clear ()

Static Public Member Functions

static void setDefaultOutstream (std::ostream &out)
static std::ostream & getDefaultOutstream ()

Detailed Description

This class outputs xml-tags and end-tags.

When the class is put on the stack it prints the start-tag to the outputstream and when leaving scope prints end-tag. The end-tag is the start tag with '/' inserted at the second position.

Tags are specified by text including or not including '<' and '>'. These brackets are recognized and printed also when not passed. Parameters in the tag can be passed as a separate parameter or delimited by space. After the first space everything is parameter and not repeated in the closing tag.

Tags are closed in the destructor, if not already closed explicitely by calling the close()-method.

Constructor & Destructor Documentation

cxxtools::Xmltag::Xmltag ( const std::string &  tag,
std::ostream &  out = *default_out 
)

prints start-tag and remember tag

cxxtools::Xmltag::Xmltag ( const std::string &  tag,
const std::string &  parameter,
std::ostream &  out = *default_out 
)

prints start-tag with parameters and remember tag

cxxtools::Xmltag::~Xmltag ( )
inline

closes tag

Member Function Documentation

void cxxtools::Xmltag::clear ( )
inline
void cxxtools::Xmltag::close ( )
const std::string& cxxtools::Xmltag::get ( ) const
inline
static std::ostream& cxxtools::Xmltag::getDefaultOutstream ( )
inlinestatic
static void cxxtools::Xmltag::setDefaultOutstream ( std::ostream &  out)
inlinestatic

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