xmlWriter_c Class Reference

a simple class for xml file generation More...

#include <xml.h>

Collaboration diagram for xmlWriter_c:

Collaboration graph
[legend]

List of all members.

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


Detailed Description

a simple class for xml file generation

Member Enumeration Documentation

anonymous enum [private]

the internal state of the writer

Enumerator:
StBase  right after start
StInTag  inside an open tag
StInContent  inside a text


Constructor & Destructor Documentation

xmlWriter_c::xmlWriter_c ( std::ostream &  str  ) 

open an XML writer, wirte header

References stream.

xmlWriter_c::~xmlWriter_c ( void   ) 

all tags must be closed by now, otherwise an exception is thrown

References tagStack.


Member Function Documentation

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]

References addContent().

Referenced by addContent().

void xmlWriter_c::addContent ( unsigned int  val  )  [inline]

References addContent().

Referenced by addContent().

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  ) 

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]

References newAttrib().

Referenced by newAttrib().

void xmlWriter_c::newAttrib ( const std::string &  attrib,
unsigned int  value 
) [inline]

References newAttrib().

Referenced by newAttrib().

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 
)

void xmlWriter_c::newTag ( const std::string &  name  ) 


Member Data Documentation

enum { ... } xmlWriter_c::state [private]

the internal state of the writer

Referenced by addContent(), endTag(), newAttrib(), and newTag().

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]

the stack of currently open tags

Referenced by endTag(), newTag(), and ~xmlWriter_c().


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

Generated on Sun Oct 10 10:03:23 2010 for BurrTools by  doxygen 1.5.8