VR-Vantage 2.7 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
clXMLNode Class Reference

Public Member Functions

 clXMLNode (void)
virtual ~clXMLNode (void)
 clXMLNode (const clXMLNode &obj)
 clXMLNode (const char *nodeName, const char *nodeData=NULL, clXMLNodeAttribute *nodeAtributeList=NULL, int nAttributes=0)
clXMLNodeoperator= (const clXMLNode &obj)
virtual bool GetNodeData (int &nodeData, const char *byName=NULL)
virtual bool GetNodeData (bool &nodeData, const char *byName=NULL)
virtual bool GetNodeData (double &nodeData, const char *byName=NULL)
virtual bool GetNodeData (char *(&nodeData), const char *byName=NULL)
virtual bool SetNodeData (const int nodeData, const char *byName=NULL)
virtual bool SetNodeData (const bool nodeData, const char *byName=NULL)
virtual bool SetNodeData (const double nodeData, const char *byName=NULL)
virtual bool SetNodeData (const char *nodeData, const char *byName=NULL)
virtual char * GetNodeAttribute (const char *byName)
virtual bool GetNodeAttribute (char *(&attributeData), const char *byName)
virtual bool GetNodeAttribute (int &attributeData, const char *byName)
virtual bool GetNodeAttribute (bool &attributeData, const char *byName)
virtual bool GetNodeAttribute (double &attributeData, const char *byName)
virtual void SetNodeAttribute (char *attributeData, const char *byName)
virtual void SetNodeAttribute (int attributeData, const char *byName)
virtual void SetNodeAttribute (bool attributeData, const char *byName)
virtual void SetNodeAttribute (double attributeData, const char *byName)
virtual void reset ()
virtual void setProlog ()
virtual char * parse (char *XMLNodeString)
virtual char * parseAttributes (char *XMLNodeAttributeString)
virtual void setNodeName (const char *str)
virtual void setNodeName (const std::string str)
virtual char * getNodeName ()
virtual std::string getNodeNameStd ()
virtual int setNodeAttributes (clXMLNodeAttribute *nodeAttribute,...)
virtual int addNodeAttribute (clXMLNodeAttribute nodeAttribute)
virtual int addNodeAttribute (const char *attributeName, const char *attributeValue)
virtual int addNodeAttribute (const char *attributeName, const int attributeValue)
virtual int addNodeAttribute (const char *attributeName, const bool attributeValue)
virtual int addNodeAttribute (const char *attributeName, const double attributeValue)
virtual clXMLNodeAttributegetNodeAttribute (const int idx)
virtual int getNumberOfNodeAttributes ()
virtual void setNodeContent (const char *str)
virtual void setNodeContent (const std::string str)
virtual void setNodeContent (const int value)
virtual void setNodeContent (const double value)
virtual char * getNodeContent ()
virtual std::string getNodeContentStd ()
virtual int insertChild (const clXMLNode &child, int idx=-1, clXMLNode **added=NULL)
virtual int addChild (const clXMLNode &child, clXMLNode **added=NULL)
virtual void removeChild (const char *byName, bool searchChildren=true)
virtual void removeChild (clXMLNode *byNode)
virtual void removeChild (int idx)
virtual void destroyChildren ()
virtual bool hasChildren ()
virtual int getNumberOfChildren ()
virtual clXMLNodegetChild (int idx)
virtual void setDefaultIndent (const char defaultIndent= ' ')
virtual clXMLNodefindChild (const char *byName, bool searchChildren=true)
virtual void setParent (clXMLNode *parentNode)
virtual clXMLNodegetParent ()
virtual void clearContent ()
virtual bool archive (ofstream &fout, const char *indent=NULL)
virtual char * updateDocument (char *dataStream, const char *indent=NULL)
virtual bool serialize (ifstream &fin, bool seekBegining=false)

Static Public Member Functions

static void DestroySafeTextBuffer ()
static char * CvtXMLtoText (const char *str)
static char * CvtTexttoXML (const char *str)

Protected Member Functions

void init ()
void destroy ()
void copy (clXMLNode *targ, const clXMLNode &src)
clXMLNode ** createChildren ()
clXMLNodeAttribute ** createAttributes ()
void destroyNodeAttributes ()

Protected Attributes

char * m_nodeName
clXMLNodeAttribute ** m_nodeAttributes
int m_numNodeAttributes
char * m_nodeContent
clXMLNode ** m_childrenNodes
int m_numChildrenNodes
clXMLNodem_parentNode
char m_defaultIndent [3]
bool m_nodeIsProlog
char * m_XMLToken

Static Protected Attributes

static char * m_safeTextBuffer

Friends

char CLXML_APIcvtXMLtoText (char *(&str))
char CLXML_APIcvtTexttoXML (char *(&str))

Constructor & Destructor Documentation

clXMLNode::clXMLNode ( void  )
virtual clXMLNode::~clXMLNode ( void  )
virtual
clXMLNode::clXMLNode ( const clXMLNode obj)
clXMLNode::clXMLNode ( const char *  nodeName,
const char *  nodeData = NULL,
clXMLNodeAttribute nodeAtributeList = NULL,
int  nAttributes = 0 
)

Member Function Documentation

clXMLNode& clXMLNode::operator= ( const clXMLNode obj)
static void clXMLNode::DestroySafeTextBuffer ( )
static
Description:
Frees the static safe text buffer array. Should be called after any non instanced use of CvtXMLtoText or CvtTexttoXML.
Parameters
str- string to convert.
Returns
void.
See Also
CvtTexttoXML, CvtXMLtoText.
static char* clXMLNode::CvtXMLtoText ( const char *  str)
static
Description:
Removes the from the XML string and replaces it with a space.
Parameters
str- string to convert.
Returns
pointer to the safe text buffer argument. This pointer is temporary and should not be stored.
Note
I may add other special characters as needed in the future.
static char* clXMLNode::CvtTexttoXML ( const char *  str)
static
Description:
Replaces the space characters in the text string with a character combination.
Parameters
str- string to convert.
Returns
pointer to the safe text buffer argument. This pointer is temporary and should not be stored.
Note
I may add other special characters as needed in the future.
virtual bool clXMLNode::GetNodeData ( int nodeData,
const char *  byName = NULL 
)
virtual
Description:
Attempts get the data from an node.
Parameters
nodeData- data to get.
byName- if specified, searches the node's children for the named data.
Returns
true if successful. False if not found, or the node is a parent.
virtual bool clXMLNode::GetNodeData ( bool nodeData,
const char *  byName = NULL 
)
virtual
Description:
Attempts get the data from an node.
Parameters
nodeData- data to get.
byName- if specified, searches the node's children for the named data.
Returns
true if successful. False if not found, or the node is a parent.
virtual bool clXMLNode::GetNodeData ( double &  nodeData,
const char *  byName = NULL 
)
virtual
Description:
Attempts get the data from an node.
Parameters
nodeData- data to get.
byName- if specified, searches the node's children for the named data.
Returns
true if successful. False if not found, or the node is a parent.
virtual bool clXMLNode::GetNodeData ( char *&  nodeData,
const char *  byName = NULL 
)
virtual
Description:
Attempts get the data from an node.
Parameters
nodeData- data to get.
byName- if specified, searches the node's children for the named data.
Returns
true if successful. False if not found, or the node is a parent.
Note
The pointer to nodeData may be temporary, and should not be stored.
virtual bool clXMLNode::SetNodeData ( const int  nodeData,
const char *  byName = NULL 
)
virtual
Description:
Attempts set the data for an node.
Parameters
nodeData- data to set.
byName- if specified, searches the node's children for the named data.
Returns
true if successful. False if not found, or the node is a parent.
virtual bool clXMLNode::SetNodeData ( const bool  nodeData,
const char *  byName = NULL 
)
virtual
Description:
Attempts set the data for an node.
Parameters
nodeData- data to set.
byName- if specified, searches the node's children for the named data.
Returns
true if successful. False if not found, or the node is a parent.
virtual bool clXMLNode::SetNodeData ( const double  nodeData,
const char *  byName = NULL 
)
virtual
Description:
Attempts set the data for an node.
Parameters
nodeData- data to set.
byName- if specified, searches the node's children for the named data.
Returns
true if successful. False if not found, or the node is a parent.
virtual bool clXMLNode::SetNodeData ( const char *  nodeData,
const char *  byName = NULL 
)
virtual
Description:
Attempts set the data for an node.
Parameters
nodeData- data to set.
byName- if specified, searches the node's children for the named data.
Returns
true if successful. False if not found, or the node is a parent.
virtual char* clXMLNode::GetNodeAttribute ( const char *  byName)
virtual
Description:
Attempts get the attribute from an node.
Parameters
byName- if specified, searches the node's attributes for the named data.
Returns
true if successful. False if not found.
Note
The pointer to nodeData may be temporary, and should not be stored.
virtual bool clXMLNode::GetNodeAttribute ( char *&  attributeData,
const char *  byName 
)
virtual
Description:
Attempts get the attribute from an node.
Parameters
attributeData- data to get.
byName- if specified, searches the node's attributes for the named data.
Returns
true if successful. False if not found.
Note
The pointer to nodeData may be temporary, and should not be stored.
virtual bool clXMLNode::GetNodeAttribute ( int attributeData,
const char *  byName 
)
virtual
Description:
Attempts get the attribute from an node.
Parameters
attributeData- data to get.
byName- if specified, searches the node's attributes for the named data.
Returns
true if successful. False if not found.
Note
The pointer to nodeData may be temporary, and should not be stored.
virtual bool clXMLNode::GetNodeAttribute ( bool attributeData,
const char *  byName 
)
virtual
Description:
Attempts get the attribute from an node.
Parameters
attributeData- data to get.
byName- if specified, searches the node's attributes for the named data.
Returns
true if successful. False if not found.
Note
The pointer to nodeData may be temporary, and should not be stored.
virtual bool clXMLNode::GetNodeAttribute ( double &  attributeData,
const char *  byName 
)
virtual
Description:
Attempts get the attribute from an node.
Parameters
attributeData- data to get.
byName- if specified, searches the node's attributes for the named data.
Returns
true if successful. False if not found.
Note
The pointer to nodeData may be temporary, and should not be stored.
virtual void clXMLNode::SetNodeAttribute ( char *  attributeData,
const char *  byName 
)
virtual
Description:
Attempts set the attribute of a node. If not found, adds the attribute.
Parameters
attributeData- data to get.
byName- if specified, searches the node's attributes for the named data.
virtual void clXMLNode::SetNodeAttribute ( int  attributeData,
const char *  byName 
)
virtual
Description:
Attempts set the attribute of a node. If not found, adds the attribute.
Parameters
attributeData- data to get.
byName- if specified, searches the node's attributes for the named data.
virtual void clXMLNode::SetNodeAttribute ( bool  attributeData,
const char *  byName 
)
virtual
Description:
Attempts set the attribute of a node. If not found, adds the attribute.
Parameters
attributeData- data to get.
byName- if specified, searches the node's attributes for the named data.
virtual void clXMLNode::SetNodeAttribute ( double  attributeData,
const char *  byName 
)
virtual
Description:
Attempts set the attribute of a node. If not found, adds the attribute.
Parameters
attributeData- data to get.
byName- if specified, searches the node's attributes for the named data.
virtual void clXMLNode::reset ( )
virtual
Description:
Resets the XML node to its initial state.
Returns
void.
virtual void clXMLNode::setProlog ( )
virtual
Description:
Sets the node to the xml version prolog.
Returns
void.
virtual char* clXMLNode::parse ( char *  XMLNodeString)
virtual
Description:
Parses an XML string and builds the XML tree objects.
Parameters
XMLNodeString- character data stream to parse.
Returns
A pointer to the XML document token.
Note
It is presumed that the XML string represents a complete node.
virtual char* clXMLNode::parseAttributes ( char *  XMLNodeAttributeString)
virtual
Description:
Parses an XML string and builds the node's attributes.
Parameters
XMLNodeAttributeString- character data stream to parse.
Returns
A pointer to the XML document token.
Note
It is presumed that the XML string represents a complete node.
virtual void clXMLNode::setNodeName ( const char *  str)
virtual
Description:
Sets the node's name.
Parameters
str- string to copy into the node's name.
Returns
void.
virtual void clXMLNode::setNodeName ( const std::string  str)
virtual
Description:
Sets the node's name.
Parameters
str- string to copy into the node's name.
Returns
void.
virtual char* clXMLNode::getNodeName ( )
virtual
Description:
Gets the node's name.
Parameters
str- string to copy into the node's name.
Returns
void.
virtual std::string clXMLNode::getNodeNameStd ( )
virtual
Description:
Gets the node's name.
Parameters
str- string to copy into the node's name.
Returns
void.
virtual int clXMLNode::setNodeAttributes ( clXMLNodeAttribute nodeAttribute,
  ... 
)
virtual
Description:
Sets the list of node attributes.
Parameters
nodeAttribute- a node attribute object containing the name and value of the attribute.
Returns
The number of node attributes added.
Note
The final argument in the list MUST be NULL!
virtual int clXMLNode::addNodeAttribute ( clXMLNodeAttribute  nodeAttribute)
virtual
Description:
Adds to the list of node attributes.
Parameters
nodeAttribute- a node attribute object containing the name and value of the attribute.
Returns
The current number of node attributes added.
virtual int clXMLNode::addNodeAttribute ( const char *  attributeName,
const char *  attributeValue 
)
virtual
Description:
Adds to the list of node attributes.
Parameters
attributeName- name of the new attribute.
attributeValue- value of the new attribute.
Returns
The current number of node attributes added.
virtual int clXMLNode::addNodeAttribute ( const char *  attributeName,
const int  attributeValue 
)
virtual
Description:
Adds to the list of node attributes.
Parameters
attributeName- name of the new attribute.
attributeValue- value of the new attribute.
Returns
The current number of node attributes added.
virtual int clXMLNode::addNodeAttribute ( const char *  attributeName,
const bool  attributeValue 
)
virtual
Description:
Adds to the list of node attributes.
Parameters
attributeName- name of the new attribute.
attributeValue- value of the new attribute.
Returns
The current number of node attributes added.
virtual int clXMLNode::addNodeAttribute ( const char *  attributeName,
const double  attributeValue 
)
virtual
Description:
Adds to the list of node attributes.
Parameters
attributeName- name of the new attribute.
attributeValue- value of the new attribute.
Returns
The current number of node attributes added.
virtual clXMLNodeAttribute* clXMLNode::getNodeAttribute ( const int  idx)
virtual
Description:
Gets an index referenced node attribute.
Parameters
idx- index of the requested node attribute.
Returns
A pointer to indexed node attribute, or NULL.
virtual int clXMLNode::getNumberOfNodeAttributes ( )
virtual
Description:
Gets the number of defined node attributes.
Returns
The number of defined node attributes.
virtual void clXMLNode::setNodeContent ( const char *  str)
virtual
Description:
Sets the node's content.
Parameters
str- string to copy into the node's content.
Returns
void.
virtual void clXMLNode::setNodeContent ( const std::string  str)
virtual
Description:
Sets the node's content.
Parameters
str- string to copy into the node's content.
Returns
void.
virtual void clXMLNode::setNodeContent ( const int  value)
virtual
Description:
Sets the node's content.
Parameters
value- data to set to content.
Returns
void.
virtual void clXMLNode::setNodeContent ( const double  value)
virtual
Description:
Sets the node's content.
Parameters
value- data to set to content.
Returns
void.
virtual char* clXMLNode::getNodeContent ( )
virtual
Description:
Gets the node's content.
Parameters
str- string to copy into the node's content.
Returns
void.
virtual std::string clXMLNode::getNodeContentStd ( )
virtual
Description:
Gets the node's content.
Parameters
str- string to copy into the node's content.
Returns
void.
virtual int clXMLNode::insertChild ( const clXMLNode child,
int  idx = -1,
clXMLNode **  added = NULL 
)
virtual
Description:
Inserts a child node.
Parameters
child- child XML node to insert into the node's child content.
idx- indexed location of the new child.
added- if specified as non-NULL, this is set to reference the newly-added node.
Returns
The index of the inserted child, or -1.
Note
If idx = -1, the insert will add the node to the tail of the list.
virtual int clXMLNode::addChild ( const clXMLNode child,
clXMLNode **  added = NULL 
)
virtual
Description:
Adds a child node to the end of the list.
Parameters
child- child XML node to insert into the node's child content.
added- if specified as non-NULL, this is set to reference the newly-added node.
Returns
The index of the inserted child, or -1.
See Also
insertChild
virtual void clXMLNode::removeChild ( const char *  byName,
bool  searchChildren = true 
)
virtual
Description:
Removes the child node at the given index.
Parameters
byName- name of the element node to remove.
searchChildren- specifies the search to look in children nodes.
Returns
void.
virtual void clXMLNode::removeChild ( clXMLNode byNode)
virtual
Description:
Removes the child node.
Parameters
byNode- pointer to the child node to remove.
Returns
void.
virtual void clXMLNode::removeChild ( int  idx)
virtual
Description:
Removes the child node.
Parameters
idx- index to the child node to remove.
Returns
void.
virtual void clXMLNode::destroyChildren ( )
virtual
Description:
Destroys the child node object list and releases all memory allocated for it.
Returns
void.
virtual bool clXMLNode::hasChildren ( )
virtual
Description:
Checks to see if the node has children nodes.
Returns
true if the node has children.
virtual int clXMLNode::getNumberOfChildren ( )
virtual
Description:
Gets the number of child nodes.
Returns
The number of children.
virtual clXMLNode* clXMLNode::getChild ( int  idx)
virtual
Description:
Gets the child node located at the given index.
Parameters
idx- index of the child node.
Returns
A pointer to the child node, or NULL.
Note
The pointer returned may be temporary, and should not be stored.
virtual void clXMLNode::setDefaultIndent ( const char  defaultIndent = ' ')
virtual
Description:
Sets the default indention character.
Parameters
defaultIndent- default indention character.
Returns
void.
virtual clXMLNode* clXMLNode::findChild ( const char *  byName,
bool  searchChildren = true 
)
virtual
Description:
Attempts to locate a XML child node element by name.
Parameters
byName- name of the element being searched for.
searchChildren- specifies the search to look in possible children nodes.
Returns
A pointer to the located node, or NULL.
Note
The pointer returned may be temporary, and should not be stored.
virtual void clXMLNode::setParent ( clXMLNode parentNode)
virtual
Description:
Sets the parent node of the child.
Parameters
parentNode- pointer to the parent node.
Returns
void.
virtual clXMLNode* clXMLNode::getParent ( )
virtual
Description:
Gets the parent node of the child.
Returns
A pointer to the parent node, or NULL.
Note
The pointer returned may be temporary, and should not be stored.
virtual void clXMLNode::clearContent ( )
virtual
Description:
Clears the content of the node. If the content is data, the data pointer is released.
Returns
void.
virtual bool clXMLNode::archive ( ofstream &  fout,
const char *  indent = NULL 
)
virtual
Description:
Attempts to locate a XML child node element by node.
Parameters
byNode- pointer to the node of the element being searched for.
searchChildren- specifies the search to look in possible children nodes.
Returns
A pointer to the located node, or NULL.
Note
The pointer returned may be temporary, and should not be stored.
Description:
Saves the node object data to file stream.
Parameters
fout- file stream to write data to.
indent- indent string.
Returns
true if sucessful
virtual char* clXMLNode::updateDocument ( char *  dataStream,
const char *  indent = NULL 
)
virtual
Description:
Saves the node object data to character data stream.
Parameters
dataStream- char stream to write data to.
indent- indent string.
Returns
A pointer to the current data stream.
virtual bool clXMLNode::serialize ( ifstream &  fin,
bool  seekBegining = false 
)
virtual
Description:
Loads the node object data from file stream.
Parameters
fin- file stream to read data from.
seekBegining- forces the serialization to begin at the begining of the file stream.
Returns
true if sucessful
void clXMLNode::init ( )
protected
Description:
Initializes the class attributes.
Returns
void.
void clXMLNode::destroy ( )
protected
Description:
Destroys the class object. Releases all memory in the target object and sets the memory space to 0.
Returns
void.
void clXMLNode::copy ( clXMLNode targ,
const clXMLNode src 
)
protected
Description:
Copies the src object onto the target object.
Parameters
targ- target object to copy into.
src- src object data.
Returns
void.
clXMLNode** clXMLNode::createChildren ( )
protected
Description:
Creates an empty list.
Returns
returns the pointer to the newly created list.
clXMLNodeAttribute** clXMLNode::createAttributes ( )
protected
Description:
Creates an empty list.
Returns
returns the pointer to the newly created list.
void clXMLNode::destroyNodeAttributes ( )
protected
Description:
Destroys the m_nodeAttributes object and releases all memory allocated for it.
Returns
void.

Friends And Related Function Documentation

char CLXML_API* cvtXMLtoText ( char *&  str)
friend
Description:
Removes the from the XML string and replaces it with a space.
Parameters
str- string to convert.
Returns
pointer to the str argument. This may be re-allocated.
Note
I may add other special characters as needed in the future.
char CLXML_API* cvtTexttoXML ( char *&  str)
friend
Description:
Replaces the space characters in the text string with a character combination.
Parameters
str- string to convert.
Returns
pointer to the str argument. This may be re-allocated.
Note
I may add other special characters as needed in the future.

Member Data Documentation

char* clXMLNode::m_nodeName
protected
clXMLNodeAttribute** clXMLNode::m_nodeAttributes
protected
int clXMLNode::m_numNodeAttributes
protected
char* clXMLNode::m_nodeContent
protected
clXMLNode** clXMLNode::m_childrenNodes
protected
int clXMLNode::m_numChildrenNodes
protected
clXMLNode* clXMLNode::m_parentNode
protected
char clXMLNode::m_defaultIndent[3]
protected
bool clXMLNode::m_nodeIsProlog
protected
char* clXMLNode::m_XMLToken
protected
char* clXMLNode::m_safeTextBuffer
staticprotected

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


Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)