CLAM-Development  1.3
Public Member Functions | Static Public Member Functions
CLAM::XmlWriteContext Class Reference

This class provides primitives to write an XML document to a target stream and to keep track of the writting state. More...

#include <XmlWriteContext.hxx>

List of all members.

Public Member Functions

 XmlWriteContext (std::ostream &targetStream)
 ~XmlWriteContext ()
std::ostream & GetTarget ()
template<typename T >
void InsertContent (const T &content)
void OpenElement (const std::string &name)
void CloseElement (const std::string &name)
template<typename T >
void InsertAttribute (const std::string &name, const T &content)
bool LastWasAContent ()
bool ElementInserted ()
unsigned int CurrentLevel ()
void UseIndentation (bool useIt)

Static Public Member Functions

static XmlWriteContext & CurrentContext ()

Detailed Description

This class provides primitives to write an XML document to a target stream and to keep track of the writting state.

You can only have an instance of that class at a time. Instances of this class are created normally by as members of a root Scoped object like XmlDocument or XmlFragment. You can also instanciate this class directly whenever you want to use its primitives without intermediates.

Todo:

Indentation

Explicit namespaces (now are supported by hand)

Checks on element levels

Definition at line 43 of file XmlWriteContext.hxx.


Constructor & Destructor Documentation

CLAM::XmlWriteContext::XmlWriteContext ( std::ostream &  targetStream) [inline]

Definition at line 46 of file XmlWriteContext.hxx.

References CLAM_ASSERT.

Definition at line 59 of file XmlWriteContext.hxx.


Member Function Documentation

void CLAM::XmlWriteContext::CloseElement ( const std::string &  name) [inline]

Definition at line 97 of file XmlWriteContext.hxx.

Referenced by CLAM::XmlElement::~XmlElement().

Definition at line 64 of file XmlWriteContext.hxx.

References CLAM_ASSERT.

Definition at line 133 of file XmlWriteContext.hxx.

Returns:
true when an element has been inserted on the current node.

Definition at line 128 of file XmlWriteContext.hxx.

std::ostream& CLAM::XmlWriteContext::GetTarget ( ) [inline]

Definition at line 70 of file XmlWriteContext.hxx.

template<typename T >
void CLAM::XmlWriteContext::InsertAttribute ( const std::string &  name,
const T &  content 
) [inline]

Definition at line 109 of file XmlWriteContext.hxx.

References CLAM_ASSERT.

Referenced by CLAM::XmlAttribute::XmlAttribute().

template<typename T >
void CLAM::XmlWriteContext::InsertContent ( const T &  content) [inline]

Definition at line 76 of file XmlWriteContext.hxx.

Referenced by CLAM::XmlContent::XmlContent().

Returns:
true when the last thing inserted on the current node has been plain content.

Definition at line 120 of file XmlWriteContext.hxx.

void CLAM::XmlWriteContext::OpenElement ( const std::string &  name) [inline]

Definition at line 85 of file XmlWriteContext.hxx.

Referenced by CLAM::XmlElement::XmlElement().

void CLAM::XmlWriteContext::UseIndentation ( bool  useIt) [inline]

Definition at line 138 of file XmlWriteContext.hxx.


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