Plus  - Minimal XML for C++ (Version 0.9.2) Giancarlo Niccolai
Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MXML::Element Class Reference

XML element abstract base class. More...

#include <mxml_element.h>

Inheritance diagram for MXML::Element:

Inheritance graph
[legend]
List of all members.

Public Member Functions

void nextLine ()
 Increments current processing line and set current position in line to 0.

void nextChar ()
 Increments current position in line by one.

void setPosition (const int line, const int character)
 Set current position to the given value.

const int line () const
 Returns current line in processing file, or last line processed by this object.

const int character () const
 Returns current position in line in processing file, or last position processed by this object.

const int beginLine () const
 Returns the line where this object begun.

const int beginChar () const
 Returns the position in line where this object begun.

void markBegin ()
 Marks current position as the begin of current item.

virtual void write (std::ostream &stream, const int style) const=0
 Serializes current object to the stream.


Protected Member Functions

 Element (const int line=1, const int pos=0)

Private Attributes

int m_line
 Current processing line in input file.

int m_char
 Current processing character in current line of input file.

int m_beginLine
 Line at which the current element begun.

int m_beginChar
 Character in Line at which the current element begun.


Friends

std::ostream & operator<< (std::ostream &stream, const Element &elem)
 Serializes the object on a stream.


Detailed Description

XML element abstract base class.

This class provides basic functionality for XML parsing; in particular, it provides a way to keep track of current line/position while parsing the document, and declares a pure virtual write method (that is called then by the << operator).


Constructor & Destructor Documentation

MXML::Element::Element const int  line = 1,
const int  pos = 0
[inline, protected]
 


Member Function Documentation

const int MXML::Element::beginChar  )  const [inline]
 

Returns the position in line where this object begun.

const int MXML::Element::beginLine  )  const [inline]
 

Returns the line where this object begun.

const int MXML::Element::character  )  const [inline]
 

Returns current position in line in processing file, or last position processed by this object.

const int MXML::Element::line  )  const [inline]
 

Returns current line in processing file, or last line processed by this object.

void MXML::Element::markBegin  )  [inline]
 

Marks current position as the begin of current item.

The constructor caller will set a default starting line and position, but it is possible that i.e. due blanks, the real initial position of the current object is later discovered to be elsewhere. Call this method to update the current position as the real begin of the object in the input stream.

void MXML::Element::nextChar  )  [inline]
 

Increments current position in line by one.

void MXML::Element::nextLine  )  [inline]
 

Increments current processing line and set current position in line to 0.

void MXML::Element::setPosition const int  line,
const int  character
[inline]
 

Set current position to the given value.

virtual void MXML::Element::write std::ostream &  stream,
const int  style
const [pure virtual]
 

Serializes current object to the stream.

Notice that the << operator won't allow to set style, so using stream << element you will not able to set the output style. Anyway, the MXML::Document class can set the default style for its hyerarcy, and it will take care to pass the given style to all the objects, in case you want to serialize it with << operator.

Parameters:
stream the stream where the object will be written
style the style of the serialization
See also:
MXML::Document::setStyle()

Implemented in MXML::Attribute, MXML::Document, and MXML::Node.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  stream,
const Element elem
[friend]
 

Serializes the object on a stream.

See write() method for an in depth.


Member Data Documentation

int MXML::Element::m_beginChar [private]
 

Character in Line at which the current element begun.

int MXML::Element::m_beginLine [private]
 

Line at which the current element begun.

int MXML::Element::m_char [private]
 

Current processing character in current line of input file.

int MXML::Element::m_line [private]
 

Current processing line in input file.


The documentation for this class was generated from the following file:
Generated on Sun Apr 11 02:08:22 2004 for Mxml Plus by doxygen 1.3.5