#include <xml.h>
Public Member Functions | |
xmlWriter_c (std::ostream &str) | |
open an XML writer, wirte header | |
~xmlWriter_c (void) | |
all tags must be closed by now, otherwise an exception is thrown | |
void | newTag (const std::string &name) |
start a new tag | |
void | endTag (const std::string &name) |
ends the current tag and pops it off the tag stack when no content has been written to this tag, the short form is used otherwise a normal and tag is written | |
add an attribute to the current tag. | |
You may only call this function right after newTag, otherwise an exception is thrown. | |
void | newAttrib (const std::string &attrib, const std::string &value) |
void | newAttrib (const std::string &attrib, unsigned long value) |
void | newAttrib (const std::string &attrib, signed long value) |
void | newAttrib (const std::string &attrib, unsigned int value) |
void | newAttrib (const std::string &attrib, signed int value) |
adds text to the content of the current tag | |
void | addContent (const std::string &text) |
void | addContent (unsigned long val) |
void | addContent (signed long val) |
void | addContent (unsigned int val) |
void | addContent (signed int val) |
std::ostream & | addContent (void) |
get an outstream to output content You may use this stream to write out content if all the other functions are too unhandy. | |
Private Types | |
enum | { StBase, StInTag, StInContent } |
the internal state of the writer More... | |
Private Attributes | |
std::ostream & | stream |
all data is written to this stream | |
std::vector< std::string > | tagStack |
the stack of currently open tags | |
enum xmlWriter_c:: { ... } | state |
the internal state of the writer |
anonymous enum [private] |
xmlWriter_c::xmlWriter_c | ( | std::ostream & | str | ) |
xmlWriter_c::~xmlWriter_c | ( | void | ) |
std::ostream & xmlWriter_c::addContent | ( | void | ) |
get an outstream to output content You may use this stream to write out content if all the other functions are too unhandy.
Be careful to not use xml special characters (like <, >, &, and so on) or confert them properly. Also don't use this stream once you called any other function from this class You need to get it again using this function.
References state, StBase, StInContent, StInTag, and stream.
void xmlWriter_c::addContent | ( | signed int | val | ) | [inline] |
void xmlWriter_c::addContent | ( | unsigned int | val | ) | [inline] |
void xmlWriter_c::addContent | ( | signed long | val | ) |
References state, StBase, StInContent, StInTag, and stream.
void xmlWriter_c::addContent | ( | unsigned long | val | ) |
References state, StBase, StInContent, StInTag, and stream.
void xmlWriter_c::addContent | ( | const std::string & | text | ) |
References outString(), state, StBase, StInContent, StInTag, and stream.
Referenced by voxel_c::save(), puzzle_c::save(), problem_c::save(), separationInfo_c::save(), separation_c::save(), state_c::save(), assembly_c::save(), assembler_1_c::save(), and assembler_0_c::save().
void xmlWriter_c::endTag | ( | const std::string & | name | ) |
ends the current tag and pops it off the tag stack when no content has been written to this tag, the short form is used otherwise a normal and tag is written
References outIndent(), state, StBase, StInContent, StInTag, stream, and tagStack.
Referenced by voxel_c::save(), solution_c::save(), puzzle_c::save(), problem_c::save(), gridType_c::save(), separationInfo_c::save(), separation_c::save(), state_c::save(), assembly_c::save(), assembler_1_c::save(), assembler_0_c::save(), and assembler_c::save().
void xmlWriter_c::newAttrib | ( | const std::string & | attrib, | |
signed int | value | |||
) | [inline] |
void xmlWriter_c::newAttrib | ( | const std::string & | attrib, | |
unsigned int | value | |||
) | [inline] |
void xmlWriter_c::newAttrib | ( | const std::string & | attrib, | |
signed long | value | |||
) |
References state, StBase, StInContent, StInTag, and stream.
void xmlWriter_c::newAttrib | ( | const std::string & | attrib, | |
unsigned long | value | |||
) |
References state, StBase, StInContent, StInTag, and stream.
void xmlWriter_c::newAttrib | ( | const std::string & | attrib, | |
const std::string & | value | |||
) |
References outString(), state, StBase, StInContent, StInTag, and stream.
Referenced by voxel_c::save(), solution_c::save(), puzzle_c::save(), problem_c::save(), gridType_c::save(), separation_c::save(), assembler_1_c::save(), and assembler_0_c::save().
void xmlWriter_c::newTag | ( | const std::string & | name | ) |
start a new tag
References outIndent(), state, StBase, StInContent, StInTag, stream, and tagStack.
Referenced by voxel_c::save(), solution_c::save(), puzzle_c::save(), problem_c::save(), gridType_c::save(), separationInfo_c::save(), separation_c::save(), state_c::save(), assembly_c::save(), assembler_1_c::save(), assembler_0_c::save(), and assembler_c::save().
enum { ... } xmlWriter_c::state [private] |
std::ostream& xmlWriter_c::stream [private] |
all data is written to this stream
Referenced by addContent(), endTag(), newAttrib(), newTag(), and xmlWriter_c().
std::vector<std::string> xmlWriter_c::tagStack [private] |