#include <ticpp.h>
Public Member Functions | |
template<class T> | |
void | GetValue (T *value) const |
Get the value of this node Uses Base::FromString to convert TiXmlNode::ValueStr from a std::string, and puts it in the passed pointer. | |
std::string | Value () const |
Get the value of this node. | |
template<class T> | |
void | SetValue (const T &value) |
Set the value of this node. | |
void | Clear () |
Clear all Nodes below this. | |
Node * | Parent (bool throwIfNoParent=true) const |
The Parent of this Node. | |
Node * | FirstChild (bool throwIfNoChildren=true) const |
The first child of this node. | |
Node * | FirstChild (const std::string &value, bool throwIfNoChildren=true) const |
The first child of this node with the matching value. | |
Node * | LastChild (bool throwIfNoChildren=true) const |
The last child of this node. | |
Node * | LastChild (const std::string &value, bool throwIfNoChildren=true) const |
The last child of this node with the matching value. | |
Node * | IterateChildren (Node *previous) const |
An alternate way to walk the children of a node. | |
Node * | IterateChildren (const std::string &value, Node *previous) const |
This flavor of IterateChildren searches for children with a particular value. | |
Node * | InsertEndChild (Node &addThis) |
Adds a child past the LastChild. | |
Node * | LinkEndChild (Node *childNode) |
Adds a child past the LastChild. | |
Node * | InsertBeforeChild (Node *beforeThis, Node &addThis) |
Adds a child before the specified child. | |
Node * | InsertAfterChild (Node *afterThis, Node &addThis) |
Adds a child after the specified child. | |
Node * | ReplaceChild (Node *replaceThis, Node &withThis) |
Replace a child of this node. | |
void | RemoveChild (Node *removeThis) |
Delete a child of this node. | |
Node * | PreviousSibling (bool throwIfNoSiblings=true) const |
Navigate to a sibling node. | |
Node * | PreviousSibling (const std::string &value, bool throwIfNoSiblings=true) const |
Navigate to a sibling node with the given value. | |
Node * | NextSibling (bool throwIfNoSiblings=true) const |
Navigate to a sibling node. | |
Node * | NextSibling (const std::string &value, bool throwIfNoSiblings=true) const |
Navigate to a sibling node with the given value. | |
Element * | NextSiblingElement (bool throwIfNoSiblings=true) const |
Navigate to a sibling element. | |
Element * | NextSiblingElement (const std::string &value, bool throwIfNoSiblings=true) const |
Navigate to a sibling element with the given value. | |
Element * | FirstChildElement (bool throwIfNoChildren=true) const |
The first child element of this node. | |
Element * | FirstChildElement (const std::string &value, bool throwIfNoChildren=true) const |
The first child element of this node with the matching value. | |
int | Type () const |
Query the type (as TiXmlNode::NodeType ) of this node. | |
Document * | GetDocument (bool throwIfNoDocument=true) const |
Return a pointer to the Document this node lives in. | |
bool | NoChildren () const |
Check if this node has no children. | |
template<class T> | |
T * | To () const |
Pointer conversion ( NOT OBJECT CONVERSION ) - replaces TiXmlNode::ToElement, TiXmlNode::ToDocument, TiXmlNode::ToComment, etc. | |
Document * | ToDocument () const |
Pointer conversion - replaces TiXmlNode::ToDocument. | |
Element * | ToElement () const |
Pointer conversion - replaces TiXmlNode::ToElement. | |
Comment * | ToComment () const |
Pointer conversion - replaces TiXmlNode::ToComment. | |
Text * | ToText () const |
Pointer conversion - replaces TiXmlNode::ToText. | |
Declaration * | ToDeclaration () const |
Pointer conversion - replaces TiXmlNode::ToDeclaration. | |
StylesheetReference * | ToStylesheetReference () const |
Pointer conversion - replaces TiXmlNode::ToStylesheetReference. | |
std::auto_ptr< Node > | Clone () const |
Create an exact duplicate of this node and return it. | |
bool | Accept (TiXmlVisitor *visitor) const |
Accept a hierchical visit the nodes in the TinyXML DOM. | |
Friends | |
std::istream & | operator>> (std::istream &in, Node &base) |
Stream input operator. | |
std::ostream & | operator<< (std::ostream &out, const Node &base) |
Stream output operator. |
void ticpp::Node::GetValue | ( | T * | value | ) | const [inline] |
Get the value of this node Uses Base::FromString to convert TiXmlNode::ValueStr from a std::string, and puts it in the passed pointer.
value | [OUT] A pointer to fill with the value |
References ticpp::Base::FromString().
std::string ticpp::Node::Value | ( | ) | const |
void ticpp::Node::SetValue | ( | const T & | value | ) | [inline] |
Set the value of this node.
Uses Base::ToString to convert value to a std::string, then calls TiXmlNode::SetValue.
value | The value to set |
References TiXmlNode::SetValue(), and ticpp::Base::ToString().
void ticpp::Node::Clear | ( | ) |
Clear all Nodes below this.
Simple wrapper for TiXmlNode::Clear.
Node* ticpp::Node::Parent | ( | bool | throwIfNoParent = true |
) | const |
The Parent of this Node.
Simple wrapper for TiXmlNode::Parent.
throwIfNoParent | [DEF] If true, throws when Parent = NULL. |
Exception | When throwIfNoParent is true, and TiXmlNode::Parent returns Null. |
Node* ticpp::Node::FirstChild | ( | bool | throwIfNoChildren = true |
) | const |
The first child of this node.
throwIfNoChildren | [DEF] If true, will throw an exception if there are no children. |
Exception | When throwIfNoChildren is true, and TiXmlNode::FirstChild returns Null. |
Node* ticpp::Node::FirstChild | ( | const std::string & | value, | |
bool | throwIfNoChildren = true | |||
) | const |
The first child of this node with the matching value.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
value | Value to match. | |
throwIfNoChildren | [DEF] If true, will throw an exception if there are no children. |
Node* ticpp::Node::LastChild | ( | bool | throwIfNoChildren = true |
) | const |
The last child of this node.
throwIfNoChildren | [DEF] If true, will throw an exception if there are no children. |
Exception | When throwIfNoChildren is true, and TiXmlNode::LastChild returns Null. |
Node* ticpp::Node::LastChild | ( | const std::string & | value, | |
bool | throwIfNoChildren = true | |||
) | const |
The last child of this node with the matching value.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
value | Value to match. | |
throwIfNoChildren | [DEF] If true, will throw an exception if there are no children. |
An alternate way to walk the children of a node.
Simple wrapper for TiXmlNode::IterateChildren.
previous | The previous Node* that was returned from IterateChildren. |
This flavor of IterateChildren searches for children with a particular value.
Simple wrapper for TiXmlNode::IterateChildren.
value | The value you want to search for. | |
previous | The previous Node* that was returned from IterateChildren. |
Adds a child past the LastChild.
Throws if you try to insert a document.
addThis | Node to insert. |
Exception | When TiXmlNode::InsertEndChild returns Null |
Adds a child past the LastChild.
Throws if you try to link a document.
childNode | Node to link. |
Exception | When TiXmlNode::LinkEndChild returns Null. |
Adds a child before the specified child.
Throws if you try to insert a document.
Exception | When TiXmlNode::InsertBeforeChild returns Null. |
Adds a child after the specified child.
Throws if you try to insert a document.
Exception | When TiXmlNode::InsertAfterChild returns Null. |
Replace a child of this node.
Throws if you try to replace with a document.
Exception | When TiXmlNode::ReplaceChild returns Null. |
void ticpp::Node::RemoveChild | ( | Node * | removeThis | ) |
Node* ticpp::Node::PreviousSibling | ( | bool | throwIfNoSiblings = true |
) | const |
Navigate to a sibling node.
Wrapper around TiXmlNode::PreviousSibling.
throwIfNoSiblings | [DEF] If true, will throw an exception if there are no siblings. |
Exception | When TiXmlNode::PreviousSibling returns Null and 'throwIfNoSiblings' is true. |
Node* ticpp::Node::PreviousSibling | ( | const std::string & | value, | |
bool | throwIfNoSiblings = true | |||
) | const |
Navigate to a sibling node with the given value.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
value | The value of the node to look for. | |
throwIfNoSiblings | [DEF] If true, will throw an exception if there are no siblings. |
Node* ticpp::Node::NextSibling | ( | bool | throwIfNoSiblings = true |
) | const |
Navigate to a sibling node.
Wrapper around TiXmlNode::NextSibling.
throwIfNoSiblings | [DEF] If true, will throw an exception if there are no siblings. |
Exception | When TiXmlNode::NextSibling returns Null and 'throwIfNoSiblings' is true. |
Node* ticpp::Node::NextSibling | ( | const std::string & | value, | |
bool | throwIfNoSiblings = true | |||
) | const |
Navigate to a sibling node with the given value.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
value | The value of the node to look for. | |
throwIfNoSiblings | [DEF] If true, will throw an exception if there are no siblings. |
Element* ticpp::Node::NextSiblingElement | ( | bool | throwIfNoSiblings = true |
) | const |
Navigate to a sibling element.
Wrapper around TiXmlNode::NextSibling.
throwIfNoSiblings | [DEF] If true, will throw an exception if there are no sibling element. |
Exception | When TiXmlNode::NextSibling returns Null and 'throwIfNoSiblings' is true. |
Element* ticpp::Node::NextSiblingElement | ( | const std::string & | value, | |
bool | throwIfNoSiblings = true | |||
) | const |
Navigate to a sibling element with the given value.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
value | The value of the element to look for. | |
throwIfNoSiblings | [DEF] If true, will throw an exception if there are no sibling elements. |
Element* ticpp::Node::FirstChildElement | ( | bool | throwIfNoChildren = true |
) | const |
The first child element of this node.
throwIfNoChildren | [DEF] If true, will throw an exception if there are no element children. |
Exception | When throwIfNoChildren is true, and TiXmlNode::FirstChildElement returns Null. |
Element* ticpp::Node::FirstChildElement | ( | const std::string & | value, | |
bool | throwIfNoChildren = true | |||
) | const |
The first child element of this node with the matching value.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
value | Value to match. | |
throwIfNoChildren | [DEF] If true, will throw an exception if there are no element children. |
Document* ticpp::Node::GetDocument | ( | bool | throwIfNoDocument = true |
) | const |
bool ticpp::Node::NoChildren | ( | ) | const |
Check if this node has no children.
T* ticpp::Node::To | ( | ) | const [inline] |
Pointer conversion ( NOT OBJECT CONVERSION ) - replaces TiXmlNode::ToElement, TiXmlNode::ToDocument, TiXmlNode::ToComment, etc.
Exception | When the target is not an object of class T |
Document* ticpp::Node::ToDocument | ( | ) | const |
Pointer conversion - replaces TiXmlNode::ToDocument.
Element* ticpp::Node::ToElement | ( | ) | const |
Pointer conversion - replaces TiXmlNode::ToElement.
Comment* ticpp::Node::ToComment | ( | ) | const |
Pointer conversion - replaces TiXmlNode::ToComment.
Text* ticpp::Node::ToText | ( | ) | const |
Pointer conversion - replaces TiXmlNode::ToText.
Declaration* ticpp::Node::ToDeclaration | ( | ) | const |
Pointer conversion - replaces TiXmlNode::ToDeclaration.
Exception | When this node is not a Declaration. |
StylesheetReference* ticpp::Node::ToStylesheetReference | ( | ) | const |
Pointer conversion - replaces TiXmlNode::ToStylesheetReference.
Exception | When this node is not a StylesheetReference. |
std::auto_ptr< Node > ticpp::Node::Clone | ( | ) | const |
Create an exact duplicate of this node and return it.
// Now using clone ticpp::Document doc( "C:\\Test.xml" ); ticpp::Node* sectionToClone; sectionToClone = doc.FirstChild( "settings" ); std::auto_ptr< ticpp::Node > clonedNode = sectionToClone->Clone(); // Now you can use the clone. ticpp::Node* node2 = clonedNode->FirstChildElement()->FirstChild(); ... // After the variable clonedNode goes out of scope it will automatically be cleaned up.
bool ticpp::Node::Accept | ( | TiXmlVisitor * | visitor | ) | const |
Accept a hierchical visit the nodes in the TinyXML DOM.