System documentation of the GNU Image-Finding Tool

Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
CXMLElement Class Reference

This class captures the structure of an XML element. More...

#include <CXMLElement.h>

Inheritance diagram for CXMLElement:
CMagic CNoDelete CAlgorithm

List of all members.

Public Types

typedef list< CXMLElement * > lCChildren
 a typedef for simple convenience

Public Member Functions

CXMLElementgetFather () const
 read the father of this
void addAttribute (const string &inAttribute, long inValue)
 adding an attribute for integers using the function for strings
void addAttribute (const string &inAttribute, double inValue)
 adding an attribute for doubles using using the function for strings
void addAttribute (const string &inAttribute, const string &inValue)
 adding an attribute
pair< bool, bool > boolReadAttribute (const string &inAttribute) const
 reading an attribute for booleans using stringReadAttribute it supports several pairs: yes/no true/false y/n
pair< bool, long > longReadAttribute (const string &inAttribute) const
 reading an attribute for integers using stringReadAttribute
pair< bool, double > doubleReadAttribute (const string &inAttribute) const
 reading an attribute for doubles using stringReadAttribute
virtual pair< bool, string > stringReadAttribute (const string &inAttribute) const
 reading an attribute for strings
CXMLElementclone (bool inDeep=true) const
 clone this element with all its content
void toXML (string &outString, const int=0) const
 Convert this into an XML string.
void traverse (CXMLElementVisitor &inoutVisitor) const
 Visit the subtree using a visitor.
void traverse (CXMLElementVisitor &inoutVisitor)
 Visit the subtree using a visitor (non-const version)
list< CXMLElement * >
::const_iterator 
child_list_begin () const
 For interoperating with the STL.
list< CXMLElement * >
::const_iterator 
child_list_end () const
 For interoperating with the STL.
list< CXMLElement * >::iterator child_list_begin ()
 For interoperating with the STL.
list< CXMLElement * >::iterator child_list_end ()
 For interoperating with the STL.
virtual void addChild (CXMLElement *inChild)
 Like above.
virtual void addChild (const string &, const char *const *const inAttributeList=0)
 Add a child with the given attributes to the current node, and MAKE THIS CHILD THE NEW CURRENT NODE.
void moveUp ()
 make the father of the current node the new current node.
bool isSubtreeFinished () const
 A subtree is finished if the current child is identical with itself.
 CXMLElement (const string &, const char *const *const inAttributeList=0)
 Constructing this from a list which is built from what we get from expat.
virtual ~CXMLElement ()
 delete this by first deleting the children
 CXMLElement (const int inType, const string &)
 Constructing a text node from what expat gives us.
 CXMLElement (const string &inString, const list< pair< string, string > > &inList)
 Constructing this from more c++-like structures.
 CXMLElement (const string &inString, const CAttributeList &inList)
 Constructing this from more c++-like structures.
 CXMLElement (const CXMLElement &in)
 Make this a deep copy of the input.
list< pair< string, string > > * createNamedValueList () const
 For doing flat configuration, we need to find out all attributes which are visible in this algorithm.
string getText () const
 get the text of this
string getName () const
 get the name of this
int getTypeOfNode () const
 get the name of this
int getNumberOfAttributes () const
 get the number of attributes in this
void check () const
 checks consistency of attributes
- Public Member Functions inherited from CMagic
void checkNPrint () const
 as check(), but it also prints a small message to cout, saying that the check worked.
 CMagic ()
 sets the magic number to 42
 ~CMagic ()
 sets the magic number to another value (36)
- Public Member Functions inherited from CNoDelete
INLINE void activate ()
 activate this.
INLINE void deActivate ()
 activate this.
INLINE CNoDelete ()
 activate this.
INLINE ~CNoDelete ()
 activate this.

Static Public Attributes

static int const cTextNode
 This constant is destined to be a value of mTypeOfNode.
static int const cElementNode
 This constant is destined to be a value of mTypeOfNode.

Protected Member Functions

void setFather (CXMLElement *)
 change the father of this

Protected Attributes

CXMLElementmFather
 the father of this
CXMLElementmCurrentChild
 The child-grandchild-etc.
lCChildren mChildren
 a list containing the children of this element
CAttributeList mAttributes
 the content: attributes
string mName
 the name of this element
string mText
 The text/CData contained in this element FIXME: look at zero characters.
const int mTypeOfNode
 The kind of this node: Stroustrup would kill me for that, but I think doing some inheritance here is not really what I want, so I do some if-ing.
- Protected Attributes inherited from CNoDelete
bool mIsActivated
 is this activated

Detailed Description

This class captures the structure of an XML element.

An Element has children and attributes.

The way a Document tree is built:

AddChildToCurrent: Adds a child, AND MAKES THE CHILD THE NEW CURRENT NODE. moveUp: Makes the father the new current node.

Author:
Wolfgang Müller

Member Function Documentation

virtual void CXMLElement::addChild ( CXMLElement inChild)
virtual

Like above.

Hovewer, here we would like to add anything inherited from CXMLElement.

Reimplemented in CAlgorithm.

CXMLElement* CXMLElement::clone ( bool  inDeep = true) const

clone this element with all its content

inDeep if true, this function clones deeply, i.e. children will be cloned, instead of just cloning the pointers to the children and the attributes.

virtual pair<bool,string> CXMLElement::stringReadAttribute ( const string &  inAttribute) const
virtual

reading an attribute for strings

All the attribute functions implement a primitive version of inheritance: We look also at the parents of this, if we do not find a given attribute in this.

this is virtual in order to plug in other methods of inheritance


Member Data Documentation

CXMLElement* CXMLElement::mCurrentChild
protected

The child-grandchild-etc.

which has just been inserted


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

Need for discussion? Want to contribute? Contact
help-gift@gnu.org Generated using Doxygen