aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
ticpp::Element Class Reference

Wrapper around TiXmlElement. More...

#include <ticpp.h>

Inheritance diagram for ticpp::Element:
Collaboration diagram for ticpp::Element:

Public Member Functions

 Element ()
 Default Constructor.
 Element (const std::string &value)
 Default Constructor.
 Element (const char *value)
 Default Constructor.
 Element (TiXmlElement *element)
 Constructor.
template<class T>
 Element (const std::string &value, const T &text)
 Constructor that allows you to set the element text.
AttributeFirstAttribute (bool throwIfNoAttributes=true) const
 Access the first attribute in this element.
AttributeLastAttribute (bool throwIfNoAttributes=true) const
 Access the last attribute in this element.
void IterateFirst (const std::string &, Attribute **first) const
template<class T>
void SetAttribute (const std::string &name, const T &value)
 Sets an attribute of name to a given value.
std::string GetText (bool throwIfNotFound=true) const
 Gets the text of an Element.
std::string GetTextOrDefault (const std::string &defaultValue) const
 Gets the text of an Element, if it doesn't exist it will return the defaultValue.
template<class T, class DefaultT>
void GetTextOrDefault (T *value, const DefaultT &defaultValue) const
 Gets the text value of an Element, if it doesn't exist it will return the defaultValue.
template<class T>
void GetText (T *value, bool throwIfNotFound=true) const
 Gets the text of an Element.
template<class T>
void SetText (const T &value)
 Convenience function to set the text of an element.
template<class T, class DefaulT>
void GetAttributeOrDefault (const std::string &name, T *value, const DefaulT &defaultValue) const
 Gets an attribute of name from an element, if it doesn't exist it will return the defaultValue.
std::string GetAttributeOrDefault (const std::string &name, const std::string &defaultValue) const
 Gets an attribute of name from an element, if it doesn't exist it will return the defaultValue.
template<class T>
GetAttribute (const std::string &name, bool throwIfNotFound=true) const
 Returns an attribute of name from an element.
template<class T>
void GetAttribute (const std::string &name, T *value, bool throwIfNotFound=true) const
 Gets an attribute of name from an element.
std::string GetAttribute (const std::string &name) const
 Gets an attribute of name from an element.
bool HasAttribute (const std::string &name) const
 Returns true, if attribute exists.
void RemoveAttribute (const std::string &name)
 Removes attribute from element.
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.
NodeParent (bool throwIfNoParent=true) const
 The Parent of this Node.
NodeFirstChild (bool throwIfNoChildren=true) const
 The first child of this node.
NodeFirstChild (const char *value, bool throwIfNoChildren=true) const
NodeFirstChild (const std::string &value, bool throwIfNoChildren=true) const
 The first child of this node with the matching value.
NodeLastChild (bool throwIfNoChildren=true) const
 The last child of this node.
NodeLastChild (const char *value, bool throwIfNoChildren=true) const
NodeLastChild (const std::string &value, bool throwIfNoChildren=true) const
 The last child of this node with the matching value.
NodeIterateChildren (Node *previous) const
 An alternate way to walk the children of a node.
NodeIterateChildren (const std::string &value, Node *previous) const
 This flavor of IterateChildren searches for children with a particular value.
NodeInsertEndChild (Node &addThis)
 Adds a child past the LastChild.
NodeLinkEndChild (Node *childNode)
 Adds a child past the LastChild.
NodeInsertBeforeChild (Node *beforeThis, Node &addThis)
 Adds a child before the specified child.
NodeInsertAfterChild (Node *afterThis, Node &addThis)
 Adds a child after the specified child.
NodeReplaceChild (Node *replaceThis, Node &withThis)
 Replace a child of this node.
void RemoveChild (Node *removeThis)
 Delete a child of this node.
NodePreviousSibling (bool throwIfNoSiblings=true) const
 Navigate to a sibling node.
NodePreviousSibling (const std::string &value, bool throwIfNoSiblings=true) const
 Navigate to a sibling node with the given value.
NodePreviousSibling (const char *value, bool throwIfNoSiblings=true) const
NodeNextSibling (bool throwIfNoSiblings=true) const
 Navigate to a sibling node.
NodeNextSibling (const std::string &value, bool throwIfNoSiblings=true) const
 Navigate to a sibling node with the given value.
NodeNextSibling (const char *value, bool throwIfNoSiblings=true) const
template<class T>
void IterateFirst (const std::string &value, T **first) const
template<class T>
void IterateNext (const std::string &value, T **next) const
template<class T>
void IteratePrevious (const std::string &value, T **previous) const
ElementNextSiblingElement (bool throwIfNoSiblings=true) const
 Navigate to a sibling element.
ElementNextSiblingElement (const std::string &value, bool throwIfNoSiblings=true) const
 Navigate to a sibling element with the given value.
ElementNextSiblingElement (const char *value, bool throwIfNoSiblings=true) const
ElementFirstChildElement (bool throwIfNoChildren=true) const
 The first child element of this node.
ElementFirstChildElement (const char *value, bool throwIfNoChildren=true) const
ElementFirstChildElement (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.
DocumentGetDocument (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.
DocumentToDocument () const
 Pointer conversion - replaces TiXmlNode::ToDocument.
ElementToElement () const
 Pointer conversion - replaces TiXmlNode::ToElement.
CommentToComment () const
 Pointer conversion - replaces TiXmlNode::ToComment.
TextToText () const
 Pointer conversion - replaces TiXmlNode::ToText.
DeclarationToDeclaration () const
 Pointer conversion - replaces TiXmlNode::ToDeclaration.
StylesheetReferenceToStylesheetReference () const
 Pointer conversion - replaces TiXmlNode::ToStylesheetReference.
std::unique_ptr< NodeClone () 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.
template<class T>
std::string ToString (const T &value) const
 Converts any class with a proper overload of the << opertor to a std::string.
std::string ToString (const std::string &value) const
template<class T>
void FromString (const std::string &temp, T *out) const
 Converts a std::string to any class with a proper overload of the >> opertor.
void FromString (const std::string &temp, std::string *out) const
 Specialization for std::string.
int Row () const
 Return the position, in the original source file, of this node or attribute.
int Column () const
 Return the position, in the original source file, of this node or attribute.
bool operator== (const Base &rhs) const
 Compare internal TiXml pointers to determine is both are wrappers around the same node.
bool operator!= (const Base &rhs) const
 Compare internal TiXml pointers to determine is both are wrappers around the same node.
std::string BuildDetailedErrorString () const
 Builds detailed error string using TiXmlDocument::Error() and others.

Protected Member Functions

TiXmlNodeGetTiXmlPointer () const
void SetTiXmlPointer (TiXmlElement *newPointer)
TiXmlBaseGetBasePointer () const
NodeNodeFactory (TiXmlNode *tiXmlNode, bool throwIfNull=true, bool rememberSpawnedWrapper=true) const
void SetImpRC (TiXmlBase *nodeBase)
void ValidatePointer () const

Protected Attributes

TiXmlElementm_tiXmlPointer
 Internal pointer to the TiXml Class which is being wrapped.
TiCppRCImpm_impRC
 Holds status of internal TiXmlPointer - use this to determine if object has been deleted already.

Private Member Functions

bool GetAttributeImp (const std::string &name, std::string *value) const
bool GetTextImp (std::string *value) const

Detailed Description

Wrapper around TiXmlElement.

Definition at line 1500 of file ticpp.h.

Constructor & Destructor Documentation

◆ Element() [1/5]

Element::Element ( )

Default Constructor.

Definition at line 747 of file ticpp.cpp.

748 : NodeImp< TiXmlElement >(new TiXmlElement(
749 "DefaultValueCausedByCreatingAnElementWithNoParameters")) {
750 m_impRC->InitRef();
751}
TiCppRCImp * m_impRC
Holds status of internal TiXmlPointer - use this to determine if object has been deleted already.
Definition ticpp.h:267
NodeImp(TiXmlElement *tiXmlPointer)
Definition ticpp.h:1292

References ticpp::NodeImp< TiXmlElement >::NodeImp(), and ticpp::NodeImp< TiXmlElement >::m_impRC.

Here is the call graph for this function:

◆ Element() [2/5]

Element::Element ( const std::string & value)

Default Constructor.

Initializes all the variables.

Parameters
valueThe value of the element.

Definition at line 753 of file ticpp.cpp.

754 : NodeImp< TiXmlElement >(new TiXmlElement(value)) {
755 m_impRC->InitRef();
756}

References ticpp::NodeImp< TiXmlElement >::NodeImp(), and ticpp::NodeImp< TiXmlElement >::m_impRC.

Here is the call graph for this function:

◆ Element() [3/5]

Element::Element ( const char * value)

Default Constructor.

Initializes all the variables.

Parameters
valueThe value of the element.

Definition at line 758 of file ticpp.cpp.

759 : NodeImp< TiXmlElement >(new TiXmlElement(value)) {
760 m_impRC->InitRef();
761}

References ticpp::NodeImp< TiXmlElement >::NodeImp(), and ticpp::NodeImp< TiXmlElement >::m_impRC.

Here is the call graph for this function:

◆ Element() [4/5]

Element::Element ( TiXmlElement * element)

Constructor.

Definition at line 763 of file ticpp.cpp.

764 : NodeImp< TiXmlElement >(element) {}

References ticpp::NodeImp< TiXmlElement >::NodeImp().

Here is the call graph for this function:

◆ Element() [5/5]

template<class T>
ticpp::Element::Element ( const std::string & value,
const T & text )
inline

Constructor that allows you to set the element text.

Parameters
valueThe value of the element.
textThe text to set.

Definition at line 1533 of file ticpp.h.

1534 : NodeImp< TiXmlElement >(new TiXmlElement(value)) {
1535 m_impRC->InitRef();
1536 SetText(text);
1537 }
void SetText(const T &value)
Convenience function to set the text of an element.
Definition ticpp.h:1724

References ticpp::NodeImp< TiXmlElement >::NodeImp(), ticpp::NodeImp< TiXmlElement >::m_impRC, and SetText().

Here is the call graph for this function:

Member Function Documentation

◆ Accept()

bool Node::Accept ( TiXmlVisitor * visitor) const
inherited

Accept a hierchical visit the nodes in the TinyXML DOM.

Returns
The boolean returned by the visitor.

Definition at line 650 of file ticpp.cpp.

650 {
651 return GetTiXmlPointer()->Accept(visitor);
652}
virtual bool Accept(TiXmlVisitor *visitor) const =0
Accept a hierchical visit the nodes in the TinyXML DOM.
virtual TiXmlNode * GetTiXmlPointer() const =0

References TiXmlNode::Accept(), and GetTiXmlPointer().

Here is the call graph for this function:

◆ BuildDetailedErrorString()

std::string ticpp::Base::BuildDetailedErrorString ( ) const
inlineinherited

Builds detailed error string using TiXmlDocument::Error() and others.

Definition at line 238 of file ticpp.h.

238 {
239 std::ostringstream full_message;
240#ifndef TICPP_NO_RTTI
241 TiXmlNode* node = dynamic_cast< TiXmlNode* >(GetBasePointer());
242
243 if (node != 0) {
244 TiXmlDocument* doc = node->GetDocument();
245
246 if (doc != 0) {
247 if (doc->Error()) {
248 full_message << "\nDescription: " << doc->ErrorDesc() << "\nFile: "
249 << (strlen(doc->Value()) > 0 ? doc->Value()
250 : "<unnamed-file>")
251 << "\nLine: " << doc->ErrorRow()
252 << "\nColumn: " << doc->ErrorCol();
253 }
254 }
255 }
256
257#endif
258 return full_message.str();
259 }
const char * ErrorDesc() const
Contains a textual (english) description of the error if one occurs.
Definition tinyxml.h:1743
int ErrorRow() const
Returns the location (if known) of the error.
Definition tinyxml.h:1761
bool Error() const
If an error occurs, Error will be set to true.
Definition tinyxml.h:1740
int ErrorCol() const
The column where the error occured. See ErrorRow().
Definition tinyxml.h:1762
const char * Value() const
The meaning of 'value' changes for the specific type of TiXmlNode.
Definition tinyxml.h:517
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition tinyxml.cpp:424
virtual TiXmlBase * GetBasePointer() const =0

References TiXmlDocument::Error(), TiXmlDocument::ErrorCol(), TiXmlDocument::ErrorDesc(), TiXmlDocument::ErrorRow(), GetBasePointer(), TiXmlNode::GetDocument(), and TiXmlNode::Value().

Here is the call graph for this function:

◆ Clear()

void Node::Clear ( )
inherited

Clear all Nodes below this.

Simple wrapper for TiXmlNode::Clear.

Definition at line 232 of file ticpp.cpp.

232{ GetTiXmlPointer()->Clear(); }
void Clear()
Delete all the children of this node. Does not affect 'this'.
Definition tinyxml.cpp:139

References TiXmlNode::Clear(), and GetTiXmlPointer().

Here is the call graph for this function:

◆ Clone()

std::unique_ptr< Node > Node::Clone ( ) const
inherited

Create an exact duplicate of this node and return it.

Note
Using auto_ptr to manage the memory declared on the heap by TiXmlNode::Clone.
// 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.
Wrapper around TiXmlDocument.
Definition ticpp.h:1409
Wrapper around TiXmlNode.
Definition ticpp.h:460
std::unique_ptr< Node > Clone() const
Create an exact duplicate of this node and return it.
Definition ticpp.cpp:635
Node * FirstChild(bool throwIfNoChildren=true) const
The first child of this node.
Definition ticpp.cpp:244
Returns
Pointer the duplicate node.

Definition at line 635 of file ticpp.cpp.

635 {
636 TiXmlNode* node = GetTiXmlPointer()->Clone();
637
638 if (0 == node) {
639 TICPPTHROW("Node could not be cloned");
640 }
641
642 std::unique_ptr< Node > temp(NodeFactory(node, false, false));
643
644 // Take ownership of the memory from TiXml
645 temp->m_impRC->InitRef();
646
647 return temp;
648}
virtual TiXmlNode * Clone() const =0
Create an exact duplicate of this node and return it.
Node * NodeFactory(TiXmlNode *tiXmlNode, bool throwIfNull=true, bool rememberSpawnedWrapper=true) const
Definition ticpp.cpp:181
#define TICPPTHROW(message)
This allows you to stream your exceptions in.
Definition ticpp.h:92

References TiXmlNode::Clone(), GetTiXmlPointer(), and TICPPTHROW.

Here is the call graph for this function:

◆ Column()

int ticpp::Base::Column ( ) const
inlineinherited

Return the position, in the original source file, of this node or attribute.

Wrapper around TiXmlBase::Row()

Definition at line 215 of file ticpp.h.

215{ return GetBasePointer()->Column(); }
int Column() const
See Row().
Definition tinyxml.h:276

References TiXmlBase::Column(), and GetBasePointer().

Here is the call graph for this function:

◆ FirstAttribute()

Attribute * Element::FirstAttribute ( bool throwIfNoAttributes = true) const

Access the first attribute in this element.

Parameters
throwIfNoAttributes[DEF] If true, throws when there are no attributes
Returns
The first attribute, nullptr if there are none and throwIfNoAttributes is true

Definition at line 766 of file ticpp.cpp.

766 {
768 TiXmlAttribute* attribute = m_tiXmlPointer->FirstAttribute();
769
770 if ((0 == attribute) && throwIfNoAttributes) {
771 TICPPTHROW("This Element (" << Value() << ") has no attributes")
772 }
773
774 if (0 == attribute) {
775 if (throwIfNoAttributes) {
776 TICPPTHROW("Element (" << Value() << ") has no attributes")
777 } else {
778 return 0;
779 }
780 }
781
782 Attribute* temp = new Attribute(attribute);
783 attribute->m_spawnedWrappers.push_back(temp);
784
785 return temp;
786}
std::vector< ticpp::Base * > m_spawnedWrappers
Remember all wrappers that we've created with 'new' - ( e.g.
Definition ticpprc.h:63
void ValidatePointer() const
Definition ticpp.h:281
TiXmlElement * m_tiXmlPointer
Definition ticpp.h:1262
std::string Value() const
Definition ticpp.cpp:230

References ticpp::NodeImp< TiXmlElement >::m_tiXmlPointer, TICPPTHROW, ticpp::NodeImp< TiXmlElement >::ValidatePointer(), and ticpp::NodeImp< TiXmlElement >::Value().

Referenced by IterateFirst().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FirstChild() [1/3]

Node * Node::FirstChild ( bool throwIfNoChildren = true) const
inherited

The first child of this node.

Parameters
throwIfNoChildren[DEF] If true, will throw an exception if there are no children.
Returns
Pointer to child, Null if no children and 'throwIfNoChildren' is false.
Exceptions
ExceptionWhen throwIfNoChildren is true, and TiXmlNode::FirstChild returns Null.
See also
TiXmlNode::FirstChild

Definition at line 244 of file ticpp.cpp.

244 {
245 return FirstChild("", throwIfNoChildren);
246}

References FirstChild().

Referenced by FirstChild(), FirstChild(), and IterateFirst().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FirstChild() [2/3]

Node * Node::FirstChild ( const char * value,
bool throwIfNoChildren = true ) const
inherited

Definition at line 252 of file ticpp.cpp.

252 {
253 TiXmlNode* childNode;
254
255 if (0 == strlen(value)) {
256 childNode = GetTiXmlPointer()->FirstChild();
257 } else {
258 childNode = GetTiXmlPointer()->FirstChild(value);
259 }
260
261 if ((0 == childNode) && throwIfNoChildren) {
262 TICPPTHROW("Child with the value of \"" << value << "\" not found");
263 }
264
265 return NodeFactory(childNode, false);
266}
const TiXmlNode * FirstChild() const
The first child of this node. Will be null if there are no children.
Definition tinyxml.h:552

References TiXmlNode::FirstChild(), GetTiXmlPointer(), NodeFactory(), and TICPPTHROW.

Here is the call graph for this function:

◆ FirstChild() [3/3]

Node * Node::FirstChild ( const std::string & value,
bool throwIfNoChildren = true ) const
inherited

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.

Parameters
valueValue to match.
throwIfNoChildren[DEF] If true, will throw an exception if there are no children.
See also
FirstChild( const char* value, bool throwIfNoChildren = true )

Definition at line 248 of file ticpp.cpp.

248 {
249 return FirstChild(value.c_str(), throwIfNoChildren);
250}

References FirstChild().

Here is the call graph for this function:

◆ FirstChildElement() [1/3]

Element * Node::FirstChildElement ( bool throwIfNoChildren = true) const
inherited

The first child element of this node.

Parameters
throwIfNoChildren[DEF] If true, will throw an exception if there are no element children.
Returns
Pointer to child, Null if no element children and 'throwIfNoChildren' is false.
Exceptions
ExceptionWhen throwIfNoChildren is true, and TiXmlNode::FirstChildElement returns Null.
See also
TiXmlNode::FirstChildElement

Definition at line 501 of file ticpp.cpp.

501 {
502 return FirstChildElement("", throwIfNoChildren);
503}
Element * FirstChildElement(bool throwIfNoChildren=true) const
The first child element of this node.
Definition ticpp.cpp:501

References FirstChildElement().

Referenced by FirstChildElement(), and FirstChildElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FirstChildElement() [2/3]

Element * Node::FirstChildElement ( const char * value,
bool throwIfNoChildren = true ) const
inherited

Definition at line 510 of file ticpp.cpp.

510 {
511 TiXmlElement* element;
512
513 if (0 == strlen(value)) {
514 element = GetTiXmlPointer()->FirstChildElement();
515 } else {
516 element = GetTiXmlPointer()->FirstChildElement(value);
517 }
518
519 if (0 == element) {
520 if (throwIfNoChildren) {
521 TICPPTHROW("Element (" << Value()
522 << ") does NOT contain a child with the value of '"
523 << value
524 << "'")
525 } else {
526 return 0;
527 }
528 }
529
530 Element* temp = new Element(element);
531 element->m_spawnedWrappers.push_back(temp);
532
533 return temp;
534}
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
Definition tinyxml.cpp:384

References TiXmlNode::FirstChildElement(), GetTiXmlPointer(), TICPPTHROW, and Value().

Here is the call graph for this function:

◆ FirstChildElement() [3/3]

Element * Node::FirstChildElement ( const std::string & value,
bool throwIfNoChildren = true ) const
inherited

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.

Parameters
valueValue to match.
throwIfNoChildren[DEF] If true, will throw an exception if there are no element children.
See also
FirstChildElement( const char* value, bool throwIfNoChildren = true )

Definition at line 505 of file ticpp.cpp.

506 {
507 return FirstChildElement(value.c_str(), throwIfNoChildren);
508}

References FirstChildElement().

Here is the call graph for this function:

◆ FromString() [1/2]

void ticpp::Base::FromString ( const std::string & temp,
std::string * out ) const
inlineinherited

Specialization for std::string.

Definition at line 201 of file ticpp.h.

201 {
202 *out = temp;
203 }

◆ FromString() [2/2]

template<class T>
void ticpp::Base::FromString ( const std::string & temp,
T * out ) const
inlineinherited

Converts a std::string to any class with a proper overload of the >> opertor.

Parameters
tempThe string to be converted
out[OUT] The container for the returned value
Exceptions
ExceptionWhen temp cannot be converted to the target type

Definition at line 189 of file ticpp.h.

189 {
190 std::istringstream val(temp);
191 val >> *out;
192
193 if (val.fail()) {
194 TICPPTHROW("Could not convert \"" << temp << "\" to target type");
195 }
196 }

References TICPPTHROW.

Referenced by ticpp::Attribute::GetName(), ticpp::Attribute::GetValue(), and ticpp::Node::GetValue().

Here is the caller graph for this function:

◆ GetAttribute() [1/3]

std::string Element::GetAttribute ( const std::string & name) const

Gets an attribute of name from an element.

Returns an empty string if the attribute does not exist.

Parameters
nameThe name of the attribute you are querying.
Returns
The value of the attribute, or an empty string if it does not exist.
See also
GetAttributeOrDefault

Definition at line 821 of file ticpp.cpp.

821 {
822 return GetAttributeOrDefault(name, std::string());
823}
void GetAttributeOrDefault(const std::string &name, T *value, const DefaulT &defaultValue) const
Gets an attribute of name from an element, if it doesn't exist it will return the defaultValue.
Definition ticpp.h:1756

References GetAttributeOrDefault().

Here is the call graph for this function:

◆ GetAttribute() [2/3]

template<class T>
T ticpp::Element::GetAttribute ( const std::string & name,
bool throwIfNotFound = true ) const
inline

Returns an attribute of name from an element.

Uses FromString to convert the string to the type of choice.

Parameters
nameThe name of the attribute you are querying.
throwIfNotFound[DEF] If true, will throw an exception if the attribute doesn't exist
Exceptions
ExceptionWhen the attribute doesn't exist and throwIfNotFound is true
See also
GetAttributeOrDefault

Definition at line 1799 of file ticpp.h.

1799 {
1800 // Get the attribute's value as a std::string
1801 std::string temp;
1802 T value;
1803
1804 if (!GetAttributeImp(name, &temp)) {
1805 if (throwIfNotFound) {
1806 const std::string error(std::string("Attribute '") + name +
1807 std::string("' does not exist"));
1808 TICPPTHROW(error);
1809 }
1810 } else {
1811 // Stream the value from the string to T
1812 FromString(temp, &value);
1813 }
1814
1815 return value;
1816 }
void FromString(const std::string &temp, TiXmlElement *out) const
Definition ticpp.h:189
bool GetAttributeImp(const std::string &name, std::string *value) const
Definition ticpp.cpp:835

References ticpp::NodeImp< TiXmlElement >::FromString(), GetAttributeImp(), and TICPPTHROW.

Here is the call graph for this function:

◆ GetAttribute() [3/3]

template<class T>
void ticpp::Element::GetAttribute ( const std::string & name,
T * value,
bool throwIfNotFound = true ) const
inline

Gets an attribute of name from an element.

Uses FromString to convert the string to the type of choice.

Parameters
nameThe name of the attribute you are querying.
value[OUT] The container for the returned value
throwIfNotFound[DEF] If true, will throw an exception if the attribute doesn't exist
Exceptions
ExceptionWhen the attribute doesn't exist and throwIfNotFound is true
See also
GetAttributeOrDefault

Definition at line 1833 of file ticpp.h.

1835 {
1836 // Get the attribute's value as a std::string
1837 std::string temp;
1838
1839 if (!GetAttributeImp(name, &temp)) {
1840 if (throwIfNotFound) {
1841 const std::string error(std::string("Attribute '") + name +
1842 std::string("' does not exist"));
1843 TICPPTHROW(error);
1844 } else {
1845 return;
1846 }
1847 }
1848
1849 // Stream the value from the string to T
1850 FromString(temp, value);
1851 }

References ticpp::NodeImp< TiXmlElement >::FromString(), GetAttributeImp(), and TICPPTHROW.

Here is the call graph for this function:

◆ GetAttributeImp()

bool Element::GetAttributeImp ( const std::string & name,
std::string * value ) const
private

Definition at line 835 of file ticpp.cpp.

835 {
837
838 // Get value from TinyXML, if the attribute exists
839 const char* retVal = m_tiXmlPointer->Attribute(name.c_str());
840
841 // TinyXML returns nullptr if the attribute doesn't exist
842 if (0 == retVal) {
843 return false;
844 } else {
845 *value = retVal;
846 return true;
847 }
848}

References ticpp::NodeImp< TiXmlElement >::m_tiXmlPointer, and ticpp::NodeImp< TiXmlElement >::ValidatePointer().

Referenced by GetAttribute(), GetAttribute(), GetAttributeOrDefault(), and GetAttributeOrDefault().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAttributeOrDefault() [1/2]

std::string Element::GetAttributeOrDefault ( const std::string & name,
const std::string & defaultValue ) const

Gets an attribute of name from an element, if it doesn't exist it will return the defaultValue.

Parameters
nameThe name of the attribute you are querying.
defaultValueWhat to put in value if there is no attribute in this element.
See also
GetAttribute

Definition at line 810 of file ticpp.cpp.

811 {
812 std::string value;
813
814 if (!GetAttributeImp(name, &value)) {
815 return defaultValue;
816 }
817
818 return value;
819}

References GetAttributeImp().

Here is the call graph for this function:

◆ GetAttributeOrDefault() [2/2]

template<class T, class DefaulT>
void ticpp::Element::GetAttributeOrDefault ( const std::string & name,
T * value,
const DefaulT & defaultValue ) const
inline

Gets an attribute of name from an element, if it doesn't exist it will return the defaultValue.

Uses FromString to convert the string to the type of choice.

Parameters
nameThe name of the attribute you are querying.
value[OUT] The container for the returned value.
defaultValueWhat to put in value if there is no attribute in this element.
Exceptions
Exception
See also
GetAttribute

Definition at line 1756 of file ticpp.h.

1758 {
1759 // Get the attribute's value as a std::string
1760 std::string temp;
1761
1762 if (!GetAttributeImp(name, &temp)) {
1763 // The attribute does not exist - set value to the default
1764 *value = defaultValue;
1765 return;
1766 }
1767
1768 // Stream the value from the string to T
1769 FromString(temp, value);
1770 }

References ticpp::NodeImp< TiXmlElement >::FromString(), and GetAttributeImp().

Referenced by GetAttribute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBasePointer()

TiXmlBase * ticpp::Node::GetBasePointer ( ) const
inlineprotectedvirtualinherited

Implements ticpp::Base.

Definition at line 1073 of file ticpp.h.

1073{ return GetTiXmlPointer(); }

References GetTiXmlPointer().

Here is the call graph for this function:

◆ GetDocument()

Document * Node::GetDocument ( bool throwIfNoDocument = true) const
inherited

Return a pointer to the Document this node lives in.

Parameters
throwIfNoDocument[DEF] If true, will throw an exception if this node is not linked under a Document.
Returns
A pointer to the Document this node lives in, nullptr if not linked under a Document, and 'throwIfNoDocument' is false.
Exceptions
ExceptionWhen this node is not linked under a Document and 'throwIfNoDocument' is true.

Definition at line 538 of file ticpp.cpp.

538 {
539 TiXmlDocument* doc = GetTiXmlPointer()->GetDocument();
540
541 if (0 == doc) {
542 if (throwIfNoDocument) {
543 TICPPTHROW("This node (" << Value() << ") is not linked under a document")
544 } else {
545 return 0;
546 }
547 }
548
549 Document* temp = new Document(doc);
550 doc->m_spawnedWrappers.push_back(temp);
551
552 return temp;
553}

◆ GetText() [1/2]

std::string ticpp::Element::GetText ( bool throwIfNotFound = true) const
inline

Gets the text of an Element.

Parameters
throwIfNotFound[DEF] If true, will throw an exception if there is no text in this element
Note
This only works if the Text is the FirstChild node
Exceptions
ExceptionWhen there is no text and throwIfNotFound is true
See also
GetText( T* value, bool throwIfNotFound = false )
GetTextOrDefault
GetTextOrDefault( T* value, const DefaultT& defaultValue )
TiXmlElement::GetText

Definition at line 1610 of file ticpp.h.

1610 {
1611 // Get the element's text value as a std::string
1612 std::string temp;
1613
1614 if (!GetTextImp(&temp)) {
1615 if (throwIfNotFound) {
1616 TICPPTHROW("Text does not exists in the current element");
1617 }
1618 }
1619
1620 return temp;
1621 }
bool GetTextImp(std::string *value) const
Definition ticpp.cpp:850

References GetTextImp(), and TICPPTHROW.

Here is the call graph for this function:

◆ GetText() [2/2]

template<class T>
void ticpp::Element::GetText ( T * value,
bool throwIfNotFound = true ) const
inline

Gets the text of an Element.

Uses FromString to convert the string to the type of choice.

Parameters
value[OUT] The container for the returned value
throwIfNotFound[DEF] If true, will throw an exception if there is no text in this element
Note
This is different than GetText() in that it will covert the text to what ever type you want
This only works if the Text is the FirstChild node
Exceptions
ExceptionWhen there is no text and throwIfNotFound is true
See also
GetText
GetTextOrDefault
GetTextOrDefault( T* value, const DefaultT& defaultValue )
TiXmlElement::GetText

Definition at line 1700 of file ticpp.h.

1700 {
1701 // Get the element's text value as a std::string
1702 std::string temp;
1703
1704 if (!GetTextImp(&temp)) {
1705 if (throwIfNotFound) {
1706 TICPPTHROW("Text does not exists in the current element");
1707 } else {
1708 return;
1709 }
1710 }
1711
1712 // Stream the value from the string to T
1713 FromString(temp, value);
1714 }

References ticpp::NodeImp< TiXmlElement >::FromString(), GetTextImp(), and TICPPTHROW.

Here is the call graph for this function:

◆ GetTextImp()

bool Element::GetTextImp ( std::string * value) const
private

Definition at line 850 of file ticpp.cpp.

850 {
852
853 // Get value from TinyXML, if the attribute exists
854 const char* retVal = m_tiXmlPointer->GetText();
855
856 // TinyXML returns nullptr if the attribute doesn't exist
857 if (0 == retVal) {
858 return false;
859 } else {
860 *value = retVal;
861 return true;
862 }
863}

References ticpp::NodeImp< TiXmlElement >::m_tiXmlPointer, and ticpp::NodeImp< TiXmlElement >::ValidatePointer().

Referenced by GetText(), GetText(), GetTextOrDefault(), and GetTextOrDefault().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTextOrDefault() [1/2]

std::string ticpp::Element::GetTextOrDefault ( const std::string & defaultValue) const
inline

Gets the text of an Element, if it doesn't exist it will return the defaultValue.

Parameters
defaultValueWhat to put in 'value' if there is no text in this element
Note
This only works if the Text is the FirstChild node
See also
GetText
GetText( T* value, bool throwIfNotFound = false )
GetTextOrDefault( T* value, const DefaultT& defaultValue )
TiXmlElement::GetText

Definition at line 1636 of file ticpp.h.

1636 {
1637 // Get the element's text value as a std::string
1638 std::string temp;
1639
1640 if (!GetTextImp(&temp)) {
1641 return defaultValue;
1642 }
1643
1644 return temp;
1645 }

References GetTextImp().

Here is the call graph for this function:

◆ GetTextOrDefault() [2/2]

template<class T, class DefaultT>
void ticpp::Element::GetTextOrDefault ( T * value,
const DefaultT & defaultValue ) const
inline

Gets the text value of an Element, if it doesn't exist it will return the defaultValue.

Uses FromString to convert the string to the type of choice

Parameters
value[OUT] The container for the returned value
defaultValueWhat to put in 'value' if there is no text in this element
Note
This is different than GetText() in that it will covert the text to what ever type you want.
This only works if the Text is the FirstChild node
See also
GetText
GetText( T* value, bool throwIfNotFound = false )
GetTextOrDefault( const std::string& defaultValue )
TiXmlElement::GetText

Definition at line 1666 of file ticpp.h.

1666 {
1667 // Get the element's text value as a std::string
1668 std::string temp;
1669
1670 if (!GetTextImp(&temp)) {
1671 // The text value does not exist - set value to the default
1672 *value = defaultValue;
1673 return;
1674 }
1675
1676 // Stream the value from the string to T
1677 FromString(temp, value);
1678 }

References ticpp::NodeImp< TiXmlElement >::FromString(), and GetTextImp().

Here is the call graph for this function:

◆ GetTiXmlPointer()

TiXmlNode * ticpp::NodeImp< TiXmlElement >::GetTiXmlPointer ( ) const
inlineprotectedvirtualinherited

Implements ticpp::Node.

Definition at line 1271 of file ticpp.h.

1271 {
1273 return m_tiXmlPointer;
1274 }
Implementation of Node wrapper.
Definition ticpp.h:1260

◆ GetValue()

template<class T>
void ticpp::Node::GetValue ( T * value) const
inlineinherited

Get the value of this node Uses Base::FromString to convert TiXmlNode::ValueStr from a std::string, and puts it in the passed pointer.

Parameters
value[OUT] A pointer to fill with the value

Definition at line 470 of file ticpp.h.

470 {
471 FromString(GetTiXmlPointer()->ValueStr(), value);
472 }

References ticpp::Base::FromString(), and GetTiXmlPointer().

Here is the call graph for this function:

◆ HasAttribute()

bool Element::HasAttribute ( const std::string & name) const

Returns true, if attribute exists.

Parameters
nameThe name of the attribute you are checking.
Returns
Existence of attribute

Definition at line 825 of file ticpp.cpp.

825 {
827 return (0 != m_tiXmlPointer->Attribute(name.c_str()));
828}

References ticpp::NodeImp< TiXmlElement >::m_tiXmlPointer, and ticpp::NodeImp< TiXmlElement >::ValidatePointer().

Here is the call graph for this function:

◆ InsertAfterChild()

Node * Node::InsertAfterChild ( Node * afterThis,
Node & addThis )
inherited

Adds a child after the specified child.

Throws if you try to insert a document.

Parameters
afterThisNode that will have addThis linked after.
addThisNode to insert after.
Exceptions
ExceptionWhen TiXmlNode::InsertAfterChild returns Null.
See also
InsertBeforeChild
TiXmlNode::InsertAfterChild

Definition at line 365 of file ticpp.cpp.

365 {
366 if (addThis.Type() == TiXmlNode::DOCUMENT) {
367 TICPPTHROW("Node is a Document and can't be inserted");
368 }
369
370 // Increment reference count when adding to the tree
371 addThis.m_impRC->IncRef();
372
373 TiXmlNode* pointer = GetTiXmlPointer()->InsertAfterChild(
374 afterThis->GetTiXmlPointer(), *addThis.GetTiXmlPointer());
375
376 if (0 == pointer) {
377 TICPPTHROW("Node can't be inserted");
378 }
379
380 return NodeFactory(pointer);
381}
void IncRef()
Increment Reference Count.
Definition ticpp.cpp:956
TiXmlNode * InsertAfterChild(TiXmlNode *afterThis, const TiXmlNode &addThis)
Add a new node related to this.
Definition tinyxml.cpp:231
int Type() const
Query the type (as TiXmlNode::NodeType ) of this node.
Definition ticpp.cpp:536

References TiXmlNode::DOCUMENT, GetTiXmlPointer(), TiCppRCImp::IncRef(), TiXmlNode::InsertAfterChild(), ticpp::Base::m_impRC, NodeFactory(), TICPPTHROW, and Type().

Here is the call graph for this function:

◆ InsertBeforeChild()

Node * Node::InsertBeforeChild ( Node * beforeThis,
Node & addThis )
inherited

Adds a child before the specified child.

Throws if you try to insert a document.

Parameters
beforeThisNode that will have addThis linked before.
addThisNode to insert before.
Exceptions
ExceptionWhen TiXmlNode::InsertBeforeChild returns Null.
See also
InsertAfterChild
TiXmlNode::InsertBeforeChild

Definition at line 347 of file ticpp.cpp.

347 {
348 if (addThis.Type() == TiXmlNode::DOCUMENT) {
349 TICPPTHROW("Node is a Document and can't be inserted");
350 }
351
352 // Increment reference count when adding to the tree
353 addThis.m_impRC->IncRef();
354
355 TiXmlNode* pointer = GetTiXmlPointer()->InsertBeforeChild(
356 beforeThis->GetTiXmlPointer(), *addThis.GetTiXmlPointer());
357
358 if (0 == pointer) {
359 TICPPTHROW("Node can't be inserted");
360 }
361
362 return NodeFactory(pointer);
363}
TiXmlNode * InsertBeforeChild(TiXmlNode *beforeThis, const TiXmlNode &addThis)
Add a new node related to this.
Definition tinyxml.cpp:197

References TiXmlNode::DOCUMENT, GetTiXmlPointer(), TiCppRCImp::IncRef(), TiXmlNode::InsertBeforeChild(), ticpp::Base::m_impRC, NodeFactory(), TICPPTHROW, and Type().

Here is the call graph for this function:

◆ InsertEndChild()

Node * Node::InsertEndChild ( Node & addThis)
inherited

Adds a child past the LastChild.

Throws if you try to insert a document.

Note
This takes a copy of addThis so it is not as efficiant as LinkEndChild.
Parameters
addThisNode to insert.
Exceptions
ExceptionWhen TiXmlNode::InsertEndChild returns Null
See also
LinkEndChild
TiXmlNode::InsertEndChild

Definition at line 317 of file ticpp.cpp.

317 {
318 if (addThis.Type() == TiXmlNode::DOCUMENT) {
319 TICPPTHROW("Node is a Document and can't be inserted");
320 }
321
322 TiXmlNode* pointer =
324
325 if (0 == pointer) {
326 TICPPTHROW("Node can't be inserted");
327 }
328
329 return NodeFactory(pointer);
330}
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Add a new node related to this.
Definition tinyxml.cpp:181

References TiXmlNode::DOCUMENT, GetTiXmlPointer(), TiXmlNode::InsertEndChild(), NodeFactory(), TICPPTHROW, and Type().

Here is the call graph for this function:

◆ IterateChildren() [1/2]

Node * Node::IterateChildren ( const std::string & value,
Node * previous ) const
inherited

This flavor of IterateChildren searches for children with a particular value.

Simple wrapper for TiXmlNode::IterateChildren.

Parameters
valueThe value you want to search for.
previousThe previous Node* that was returned from IterateChildren.
Returns
nullptr When there are no more children.

Definition at line 304 of file ticpp.cpp.

304 {
305 TiXmlNode* pointer;
306
307 if (0 == previous) {
308 pointer = GetTiXmlPointer()->IterateChildren(value, 0);
309 } else {
310 pointer =
311 GetTiXmlPointer()->IterateChildren(value, previous->GetTiXmlPointer());
312 }
313
314 return NodeFactory(pointer, false);
315}
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
An alternate way to walk the children of a node.
Definition tinyxml.cpp:331

References GetTiXmlPointer(), TiXmlNode::IterateChildren(), and NodeFactory().

Here is the call graph for this function:

◆ IterateChildren() [2/2]

Node * Node::IterateChildren ( Node * previous) const
inherited

An alternate way to walk the children of a node.

Simple wrapper for TiXmlNode::IterateChildren.

Parameters
previousThe previous Node* that was returned from IterateChildren.
Returns
nullptr When there are no more children.

Definition at line 292 of file ticpp.cpp.

292 {
293 TiXmlNode* pointer;
294
295 if (0 == previous) {
296 pointer = GetTiXmlPointer()->IterateChildren(0);
297 } else {
298 pointer = GetTiXmlPointer()->IterateChildren(previous->GetTiXmlPointer());
299 }
300
301 return NodeFactory(pointer, false);
302}

References GetTiXmlPointer(), TiXmlNode::IterateChildren(), and NodeFactory().

Here is the call graph for this function:

◆ IterateFirst() [1/2]

void ticpp::Element::IterateFirst ( const std::string & ,
Attribute ** first ) const
inlinevirtual

Reimplemented from ticpp::Node.

Definition at line 1568 of file ticpp.h.

1568 {
1569 *first = 0;
1570
1571 for (Attribute* child = FirstAttribute(false); child;
1572 child = child->Next(false)) {
1573 *first = dynamic_cast< Attribute* >(child);
1574
1575 if (0 != *first) {
1576 return;
1577 }
1578 }
1579 }
Attribute * Next(bool throwIfNoAttribute=true) const
Get the next sibling attribute in the DOM.
Definition ticpp.cpp:125
Attribute * FirstAttribute(bool throwIfNoAttributes=true) const
Access the first attribute in this element.
Definition ticpp.cpp:766

References FirstAttribute(), and ticpp::Attribute::Next().

Here is the call graph for this function:

◆ IterateFirst() [2/2]

template<class T>
void ticpp::Node::IterateFirst ( const std::string & value,
T ** first ) const
inlineinherited

Definition at line 783 of file ticpp.h.

783 {
784 *first = 0;
785
786 for (Node* child = FirstChild(value, false); child;
787 child = child->NextSibling(value, false)) {
788 *first = dynamic_cast< T* >(child);
789
790 if (0 != *first) {
791 return;
792 }
793 }
794 }
Node * NextSibling(bool throwIfNoSiblings=true) const
Navigate to a sibling node.
Definition ticpp.cpp:438

References FirstChild(), and NextSibling().

Referenced by ticpp::Iterator< T >::begin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IterateNext()

template<class T>
void ticpp::Node::IterateNext ( const std::string & value,
T ** next ) const
inlineinherited

Definition at line 808 of file ticpp.h.

808 {
809 Node* sibling = NextSibling(value, false);
810 *next = dynamic_cast< T* >(sibling);
811
812 while ((0 != sibling) && (0 == *next)) {
813 sibling = sibling->NextSibling(value, false);
814 *next = dynamic_cast< T* >(sibling);
815 }
816 }

References NextSibling().

Here is the call graph for this function:

◆ IteratePrevious()

template<class T>
void ticpp::Node::IteratePrevious ( const std::string & value,
T ** previous ) const
inlineinherited

Definition at line 826 of file ticpp.h.

826 {
827 Node* sibling = PreviousSibling(value, false);
828 *previous = dynamic_cast< T* >(sibling);
829
830 while ((0 != sibling) && (0 == *previous)) {
831 sibling = sibling->PreviousSibling(value, false);
832 *previous = dynamic_cast< T* >(sibling);
833 }
834 }
Node * PreviousSibling(bool throwIfNoSiblings=true) const
Navigate to a sibling node.
Definition ticpp.cpp:410

References PreviousSibling().

Here is the call graph for this function:

◆ LastAttribute()

Attribute * Element::LastAttribute ( bool throwIfNoAttributes = true) const

Access the last attribute in this element.

Parameters
throwIfNoAttributes[DEF] If true, throws when there are no attributes
Returns
The last attribute, nullptr if there are none and throwIfNoAttributes is true

Definition at line 788 of file ticpp.cpp.

788 {
790 TiXmlAttribute* attribute = m_tiXmlPointer->LastAttribute();
791
792 if ((0 == attribute) && throwIfNoAttributes) {
793 TICPPTHROW("This Element (" << Value() << ") has no attributes")
794 }
795
796 if (0 == attribute) {
797 if (throwIfNoAttributes) {
798 TICPPTHROW("Element (" << Value() << ") has no attributes")
799 } else {
800 return 0;
801 }
802 }
803
804 Attribute* temp = new Attribute(attribute);
805 attribute->m_spawnedWrappers.push_back(temp);
806
807 return temp;
808}

References TiCppRC::m_spawnedWrappers, ticpp::NodeImp< TiXmlElement >::m_tiXmlPointer, TICPPTHROW, ticpp::NodeImp< TiXmlElement >::ValidatePointer(), and ticpp::NodeImp< TiXmlElement >::Value().

Here is the call graph for this function:

◆ LastChild() [1/3]

Node * Node::LastChild ( bool throwIfNoChildren = true) const
inherited

The last child of this node.

Parameters
throwIfNoChildren[DEF] If true, will throw an exception if there are no children.
Returns
Pointer to child, Null if no children and 'throwIfNoChildren' is false.
Exceptions
ExceptionWhen throwIfNoChildren is true, and TiXmlNode::LastChild returns Null.
See also
TiXmlNode::LastChild

Definition at line 268 of file ticpp.cpp.

268 {
269 return LastChild("", throwIfNoChildren);
270}
Node * LastChild(bool throwIfNoChildren=true) const
The last child of this node.
Definition ticpp.cpp:268

References LastChild().

Referenced by LastChild(), and LastChild().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LastChild() [2/3]

Node * Node::LastChild ( const char * value,
bool throwIfNoChildren = true ) const
inherited

Definition at line 276 of file ticpp.cpp.

276 {
277 TiXmlNode* childNode;
278
279 if (0 == strlen(value)) {
280 childNode = GetTiXmlPointer()->LastChild();
281 } else {
282 childNode = GetTiXmlPointer()->LastChild(value);
283 }
284
285 if ((0 == childNode) && throwIfNoChildren) {
286 TICPPTHROW("Child with the value of \"" << value << "\" not found");
287 }
288
289 return NodeFactory(childNode, false);
290}
const TiXmlNode * LastChild() const
Definition tinyxml.h:572

References GetTiXmlPointer(), TiXmlNode::LastChild(), NodeFactory(), and TICPPTHROW.

Here is the call graph for this function:

◆ LastChild() [3/3]

Node * Node::LastChild ( const std::string & value,
bool throwIfNoChildren = true ) const
inherited

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.

Parameters
valueValue to match.
throwIfNoChildren[DEF] If true, will throw an exception if there are no children.
See also
LastChild( const char* value, bool throwIfNoChildren = true )

Definition at line 272 of file ticpp.cpp.

272 {
273 return LastChild(value.c_str(), throwIfNoChildren);
274}

References LastChild().

Here is the call graph for this function:

◆ LinkEndChild()

Node * Node::LinkEndChild ( Node * childNode)
inherited

Adds a child past the LastChild.

Throws if you try to link a document.

Parameters
childNodeNode to link.
Exceptions
ExceptionWhen TiXmlNode::LinkEndChild returns Null.
See also
InsertEndChild
TiXmlNode::LinkEndChild

Definition at line 332 of file ticpp.cpp.

332 {
333 if (childNode->Type() == TiXmlNode::DOCUMENT) {
334 TICPPTHROW("Node is a Document and can't be linked");
335 }
336
337 // Increment reference count when adding to the tree
338 childNode->m_impRC->IncRef();
339
340 if (0 == GetTiXmlPointer()->LinkEndChild(childNode->GetTiXmlPointer())) {
341 TICPPTHROW("Node can't be linked");
342 }
343
344 return childNode;
345}
Node * LinkEndChild(Node *childNode)
Adds a child past the LastChild.
Definition ticpp.cpp:332

References TiXmlNode::DOCUMENT, GetTiXmlPointer(), TiCppRCImp::IncRef(), LinkEndChild(), ticpp::Base::m_impRC, TICPPTHROW, and Type().

Referenced by LinkEndChild().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NextSibling() [1/3]

Node * Node::NextSibling ( bool throwIfNoSiblings = true) const
inherited

Navigate to a sibling node.

Wrapper around TiXmlNode::NextSibling.

Parameters
throwIfNoSiblings[DEF] If true, will throw an exception if there are no siblings.
Returns
Pointer to sibling, Null if no siblings and 'throwIfNoSiblings' is false.
Exceptions
ExceptionWhen TiXmlNode::NextSibling returns Null and 'throwIfNoSiblings' is true.

Definition at line 438 of file ticpp.cpp.

438 {
439 return NextSibling("", throwIfNoSiblings);
440}

References NextSibling().

Referenced by IterateFirst(), IterateNext(), NextSibling(), and NextSibling().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NextSibling() [2/3]

Node * Node::NextSibling ( const char * value,
bool throwIfNoSiblings = true ) const
inherited

Definition at line 446 of file ticpp.cpp.

446 {
447 TiXmlNode* sibling;
448
449 if (0 == strlen(value)) {
450 sibling = GetTiXmlPointer()->NextSibling();
451 } else {
452 sibling = GetTiXmlPointer()->NextSibling(value);
453 }
454
455 if ((0 == sibling) && throwIfNoSiblings) {
456 TICPPTHROW("No Siblings found with value, '" << value << "', After this Node ("
457 << Value()
458 << ")")
459 }
460
461 return NodeFactory(sibling, false);
462}
const TiXmlNode * NextSibling(const std::string &_value) const
STL std::string form.
Definition tinyxml.h:695

References GetTiXmlPointer(), TiXmlNode::NextSibling(), NodeFactory(), TICPPTHROW, and Value().

Here is the call graph for this function:

◆ NextSibling() [3/3]

Node * Node::NextSibling ( const std::string & value,
bool throwIfNoSiblings = true ) const
inherited

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.

Parameters
valueThe value of the node to look for.
throwIfNoSiblings[DEF] If true, will throw an exception if there are no siblings.
See also
NextSibling( bool throwIfNoSiblings )

Definition at line 442 of file ticpp.cpp.

442 {
443 return NextSibling(value.c_str(), throwIfNoSiblings);
444}

References NextSibling().

Here is the call graph for this function:

◆ NextSiblingElement() [1/3]

Element * Node::NextSiblingElement ( bool throwIfNoSiblings = true) const
inherited

Navigate to a sibling element.

Wrapper around TiXmlNode::NextSibling.

Parameters
throwIfNoSiblings[DEF] If true, will throw an exception if there are no sibling element.
Returns
Pointer to sibling, Null if no siblings and 'throwIfNoSiblings' is false.
Exceptions
ExceptionWhen TiXmlNode::NextSibling returns Null and 'throwIfNoSiblings' is true.

Definition at line 464 of file ticpp.cpp.

464 {
465 return NextSiblingElement("", throwIfNoSiblings);
466}
Element * NextSiblingElement(bool throwIfNoSiblings=true) const
Navigate to a sibling element.
Definition ticpp.cpp:464

References NextSiblingElement().

Referenced by NextSiblingElement(), and NextSiblingElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NextSiblingElement() [2/3]

Element * Node::NextSiblingElement ( const char * value,
bool throwIfNoSiblings = true ) const
inherited

Definition at line 473 of file ticpp.cpp.

474 {
475 TiXmlElement* sibling;
476
477 if (0 == strlen(value)) {
478 sibling = GetTiXmlPointer()->NextSiblingElement();
479 } else {
480 sibling = GetTiXmlPointer()->NextSiblingElement(value);
481 }
482
483 if (0 == sibling) {
484 if (throwIfNoSiblings) {
485 TICPPTHROW("No Element Siblings found with value, '"
486 << value
487 << "', After this Node ("
488 << Value()
489 << ")")
490 } else {
491 return 0;
492 }
493 }
494
495 Element* temp = new Element(sibling);
496 sibling->m_spawnedWrappers.push_back(temp);
497
498 return temp;
499}
const TiXmlElement * NextSiblingElement() const
Convenience function to get through elements.
Definition tinyxml.cpp:404

References GetTiXmlPointer(), and TiXmlNode::NextSiblingElement().

Here is the call graph for this function:

◆ NextSiblingElement() [3/3]

Element * Node::NextSiblingElement ( const std::string & value,
bool throwIfNoSiblings = true ) const
inherited

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.

Parameters
valueThe value of the element to look for.
throwIfNoSiblings[DEF] If true, will throw an exception if there are no sibling elements.
See also
NextSiblingElement( bool throwIfNoSiblings )

Definition at line 468 of file ticpp.cpp.

469 {
470 return NextSiblingElement(value.c_str(), throwIfNoSiblings);
471}

References NextSiblingElement().

Here is the call graph for this function:

◆ NoChildren()

bool Node::NoChildren ( ) const
inherited

Check if this node has no children.

Returns
true if this node has no children.

Definition at line 555 of file ticpp.cpp.

555{ return GetTiXmlPointer()->NoChildren(); }
bool NoChildren() const
Returns true if this node has no children.
Definition tinyxml.h:782

References GetTiXmlPointer(), and TiXmlNode::NoChildren().

Here is the call graph for this function:

◆ NodeFactory()

Node * Node::NodeFactory ( TiXmlNode * tiXmlNode,
bool throwIfNull = true,
bool rememberSpawnedWrapper = true ) const
protectedinherited

Definition at line 181 of file ticpp.cpp.

183 {
184 if (0 == tiXmlNode) {
185 if (throwIfNull) {
186 TICPPTHROW("tiXmlNode is nullptr")
187 } else {
188 return 0;
189 }
190 }
191
192 Node* temp;
193
194 switch (tiXmlNode->Type()) {
196 temp = new Document(tiXmlNode->ToDocument());
197 break;
198
200 temp = new Element(tiXmlNode->ToElement());
201 break;
202
204 temp = new Comment(tiXmlNode->ToComment());
205 break;
206
207 case TiXmlNode::TEXT:
208 temp = new Text(tiXmlNode->ToText());
209 break;
210
212 temp = new Declaration(tiXmlNode->ToDeclaration());
213 break;
214
216 temp = new StylesheetReference(tiXmlNode->ToStylesheetReference());
217 break;
218
219 default:
220 TICPPTHROW("Type is unsupported")
221 }
222
223 if (rememberSpawnedWrapper) {
224 tiXmlNode->m_spawnedWrappers.push_back(temp);
225 }
226
227 return temp;
228}
int Type() const
Query the type (as an enumerated value, above) of this node.
Definition tinyxml.h:770
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:792
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:800
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:804
virtual const TiXmlStylesheetReference * ToStylesheetReference() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:808
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:784
@ STYLESHEETREFERENCE
Definition tinyxml.h:499
@ DECLARATION
Definition tinyxml.h:498
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:788

References TiXmlNode::COMMENT, TiXmlNode::DECLARATION, TiXmlNode::DOCUMENT, TiXmlNode::ELEMENT, TiCppRC::m_spawnedWrappers, TiXmlNode::STYLESHEETREFERENCE, TiXmlNode::TEXT, TICPPTHROW, TiXmlNode::ToComment(), TiXmlNode::ToDeclaration(), TiXmlNode::ToDocument(), TiXmlNode::ToElement(), TiXmlNode::ToStylesheetReference(), TiXmlNode::ToText(), and TiXmlNode::Type().

Referenced by FirstChild(), InsertAfterChild(), InsertBeforeChild(), InsertEndChild(), IterateChildren(), IterateChildren(), LastChild(), NextSibling(), Parent(), PreviousSibling(), and ReplaceChild().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool ticpp::Base::operator!= ( const Base & rhs) const
inlineinherited

Compare internal TiXml pointers to determine is both are wrappers around the same node.

Definition at line 231 of file ticpp.h.

231 {
232 return (GetBasePointer() != rhs.GetBasePointer());
233 }

References GetBasePointer().

Here is the call graph for this function:

◆ operator==()

bool ticpp::Base::operator== ( const Base & rhs) const
inlineinherited

Compare internal TiXml pointers to determine is both are wrappers around the same node.

Definition at line 222 of file ticpp.h.

222 {
223 return (GetBasePointer() == rhs.GetBasePointer());
224 }

References GetBasePointer().

Here is the call graph for this function:

◆ Parent()

Node * Node::Parent ( bool throwIfNoParent = true) const
inherited

The Parent of this Node.

Simple wrapper for TiXmlNode::Parent.

Parameters
throwIfNoParent[DEF] If true, throws when Parent = nullptr.
Returns
The parent of this node, nullptr if there is no Parent.
Exceptions
ExceptionWhen throwIfNoParent is true, and TiXmlNode::Parent returns Null.

Definition at line 234 of file ticpp.cpp.

234 {
235 TiXmlNode* parent = GetTiXmlPointer()->Parent();
236
237 if ((0 == parent) && throwIfNoParent) {
238 TICPPTHROW("No parent exists");
239 }
240
241 return NodeFactory(parent, false);
242}
TiXmlNode * Parent()
One step up the DOM.
Definition tinyxml.h:549

References GetTiXmlPointer(), NodeFactory(), TiXmlNode::Parent(), and TICPPTHROW.

Here is the call graph for this function:

◆ PreviousSibling() [1/3]

Node * Node::PreviousSibling ( bool throwIfNoSiblings = true) const
inherited

Navigate to a sibling node.

Wrapper around TiXmlNode::PreviousSibling.

Parameters
throwIfNoSiblings[DEF] If true, will throw an exception if there are no siblings.
Returns
Pointer to sibling, Null if no siblings and 'throwIfNoSiblings' is false.
Exceptions
ExceptionWhen TiXmlNode::PreviousSibling returns Null and 'throwIfNoSiblings' is true.

Definition at line 410 of file ticpp.cpp.

410 {
411 return PreviousSibling("", throwIfNoSiblings);
412}

References PreviousSibling().

Referenced by IteratePrevious(), PreviousSibling(), and PreviousSibling().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PreviousSibling() [2/3]

Node * Node::PreviousSibling ( const char * value,
bool throwIfNoSiblings = true ) const
inherited

Definition at line 419 of file ticpp.cpp.

419 {
420 TiXmlNode* sibling;
421
422 if (0 == strlen(value)) {
423 sibling = GetTiXmlPointer()->PreviousSibling();
424 } else {
425 sibling = GetTiXmlPointer()->PreviousSibling(value);
426 }
427
428 if ((0 == sibling) && throwIfNoSiblings) {
429 TICPPTHROW("No Siblings found with value, '" << value
430 << "', Prior to this Node ("
431 << Value()
432 << ")")
433 }
434
435 return NodeFactory(sibling, false);
436}
const TiXmlNode * PreviousSibling() const
Navigate to a sibling node.
Definition tinyxml.h:678

References GetTiXmlPointer(), NodeFactory(), TiXmlNode::PreviousSibling(), TICPPTHROW, and Value().

Here is the call graph for this function:

◆ PreviousSibling() [3/3]

Node * Node::PreviousSibling ( const std::string & value,
bool throwIfNoSiblings = true ) const
inherited

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.

Parameters
valueThe value of the node to look for.
throwIfNoSiblings[DEF] If true, will throw an exception if there are no siblings.
See also
PreviousSibling( bool throwIfNoSiblings )

Definition at line 414 of file ticpp.cpp.

415 {
416 return PreviousSibling(value.c_str(), throwIfNoSiblings);
417}

References PreviousSibling().

Here is the call graph for this function:

◆ RemoveAttribute()

void Element::RemoveAttribute ( const std::string & name)

Removes attribute from element.

Parameters
nameThe name of the attribute to remove.

Definition at line 830 of file ticpp.cpp.

830 {
832 m_tiXmlPointer->RemoveAttribute(name.c_str());
833}

References ticpp::NodeImp< TiXmlElement >::m_tiXmlPointer, and ticpp::NodeImp< TiXmlElement >::ValidatePointer().

Here is the call graph for this function:

◆ RemoveChild()

void Node::RemoveChild ( Node * removeThis)
inherited

Delete a child of this node.

Parameters
removeThisNode to delete.
Exceptions
ExceptionWhen removeThis is not a child of this Node.
See also
TiXmlNode::RemoveChild

Definition at line 401 of file ticpp.cpp.

401 {
402 if (!GetTiXmlPointer()->RemoveChild(removeThis->GetTiXmlPointer())) {
403 TICPPTHROW("Node to remove (" << removeThis->Value()
404 << ") is not a child of this Node ("
405 << Value()
406 << ")")
407 }
408}
void RemoveChild(Node *removeThis)
Delete a child of this node.
Definition ticpp.cpp:401

References GetTiXmlPointer(), RemoveChild(), TICPPTHROW, and Value().

Referenced by RemoveChild().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReplaceChild()

Node * Node::ReplaceChild ( Node * replaceThis,
Node & withThis )
inherited

Replace a child of this node.

Throws if you try to replace with a document.

Parameters
replaceThisNode to replace.
withThisNode that is replacing replaceThis.
Exceptions
ExceptionWhen TiXmlNode::ReplaceChild returns Null.
See also
TiXmlNode::ReplaceChild

Definition at line 383 of file ticpp.cpp.

383 {
384 if (withThis.Type() == TiXmlNode::DOCUMENT) {
385 TICPPTHROW("Node is a Document and can't be inserted");
386 }
387
388 // Increment reference count when adding to the tree
389 withThis.m_impRC->IncRef();
390
391 TiXmlNode* pointer = GetTiXmlPointer()->ReplaceChild(
392 replaceThis->GetTiXmlPointer(), *withThis.GetTiXmlPointer());
393
394 if (0 == pointer) {
395 TICPPTHROW("Node can't be inserted");
396 }
397
398 return NodeFactory(pointer);
399}
TiXmlNode * ReplaceChild(TiXmlNode *replaceThis, const TiXmlNode &withThis)
Replace a child of this node.
Definition tinyxml.cpp:265

References TiXmlNode::DOCUMENT, GetTiXmlPointer(), TiCppRCImp::IncRef(), ticpp::Base::m_impRC, NodeFactory(), TiXmlNode::ReplaceChild(), TICPPTHROW, and Type().

Here is the call graph for this function:

◆ Row()

int ticpp::Base::Row ( ) const
inlineinherited

Return the position, in the original source file, of this node or attribute.

Wrapper around TiXmlBase::Row()

Definition at line 209 of file ticpp.h.

209{ return GetBasePointer()->Row(); }
int Row() const
Return the position, in the original source file, of this node or attribute.
Definition tinyxml.h:275

References GetBasePointer(), and TiXmlBase::Row().

Here is the call graph for this function:

◆ SetAttribute()

template<class T>
void ticpp::Element::SetAttribute ( const std::string & name,
const T & value )
inline

Sets an attribute of name to a given value.

The attribute will be created if it does not exist, or changed if it does. Uses ToString to convert the value to a string, so there is no need to use any other SetAttribute methods.

See also
GetAttribute

Definition at line 1591 of file ticpp.h.

1591 {
1593 m_tiXmlPointer->SetAttribute(name, ToString(value));
1594 }
std::string ToString(const TiXmlElement &value) const
Definition ticpp.h:169

References ticpp::NodeImp< TiXmlElement >::m_tiXmlPointer, ticpp::NodeImp< TiXmlElement >::ToString(), and ticpp::NodeImp< TiXmlElement >::ValidatePointer().

Here is the call graph for this function:

◆ SetImpRC()

void ticpp::Base::SetImpRC ( TiXmlBase * nodeBase)
inlineprotectedinherited

Definition at line 279 of file ticpp.h.

279{ m_impRC = nodeBase->m_tiRC; }
TiCppRCImp * m_tiRC
Pointer to reference counter.
Definition ticpprc.h:46

References m_impRC, and TiCppRC::m_tiRC.

Referenced by ticpp::Attribute::SetTiXmlPointer(), and ticpp::NodeImp< T >::SetTiXmlPointer().

Here is the caller graph for this function:

◆ SetText()

template<class T>
void ticpp::Element::SetText ( const T & value)
inline

Convenience function to set the text of an element.

Creates a Text node and inserts it as the first child. Uses ToString to convert the parameter to a string.

Parameters
valueThe text to set.

Definition at line 1724 of file ticpp.h.

1724 {
1726 std::string temp = ToString(value);
1727
1728 if (m_tiXmlPointer->NoChildren()) {
1729 m_tiXmlPointer->LinkEndChild(new TiXmlText(temp));
1730 } else {
1731 if (0 == m_tiXmlPointer->GetText()) {
1732 m_tiXmlPointer->InsertBeforeChild(m_tiXmlPointer->FirstChild(),
1733 TiXmlText(temp));
1734 } else {
1735 // There already is text, so change it
1736 m_tiXmlPointer->FirstChild()->SetValue(temp);
1737 }
1738 }
1739 }

References ticpp::NodeImp< TiXmlElement >::m_tiXmlPointer, ticpp::NodeImp< TiXmlElement >::ToString(), and ticpp::NodeImp< TiXmlElement >::ValidatePointer().

Referenced by Element().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTiXmlPointer()

void ticpp::NodeImp< TiXmlElement >::SetTiXmlPointer ( TiXmlElement * newPointer)
inlineprotectedinherited

Definition at line 1283 of file ticpp.h.

1283 {
1286 }
void SetImpRC(TiXmlBase *nodeBase)
Definition ticpp.h:279

◆ SetValue()

template<class T>
void ticpp::Node::SetValue ( const T & value)
inlineinherited

Set the value of this node.

Uses Base::ToString to convert value to a std::string, then calls TiXmlNode::SetValue.

Parameters
valueThe value to set

Definition at line 490 of file ticpp.h.

490 {
492 }
void SetValue(const char *_value)
Changes the value of the node.
Definition tinyxml.h:538

References GetTiXmlPointer(), TiXmlNode::SetValue(), and ticpp::Base::ToString().

Here is the call graph for this function:

◆ To()

template<class T>
T * ticpp::Node::To ( ) const
inlineinherited

Pointer conversion ( NOT OBJECT CONVERSION ) - replaces TiXmlNode::ToElement, TiXmlNode::ToDocument, TiXmlNode::ToComment, etc.

Exceptions
ExceptionWhen the target is not an object of class T
Warning
Some ancient compilers do not support explicit specification of member template arguments, which this depends on ( e.g. VC6 ).

Definition at line 961 of file ticpp.h.

961 {
962 T* pointer = dynamic_cast< T* >(this);
963
964 if (0 == pointer) {
965 std::string thisType = typeid(this).name();
966 std::string targetType = typeid(T).name();
967 std::string thatType = typeid(*this).name();
968 TICPPTHROW("The " << thisType.substr(6) << " could not be casted to a "
969 << targetType.substr(6)
970 << " *, because the target object is not a "
971 << targetType.substr(6)
972 << ". (It is a "
973 << thatType.substr(6)
974 << ")");
975 }
976
977 return pointer;
978 }

References TICPPTHROW.

◆ ToComment()

Comment * Node::ToComment ( ) const
inherited

Pointer conversion - replaces TiXmlNode::ToComment.

Exceptions
ExceptionWhen this node is not a Comment.

Definition at line 583 of file ticpp.cpp.

583 {
584 TiXmlComment* doc = GetTiXmlPointer()->ToComment();
585
586 if (0 == doc) {
587 TICPPTHROW("This node (" << Value() << ") is not a Comment")
588 }
589
590 Comment* temp = new Comment(doc);
591 doc->m_spawnedWrappers.push_back(temp);
592
593 return temp;
594}

References GetTiXmlPointer(), TiCppRC::m_spawnedWrappers, TICPPTHROW, TiXmlNode::ToComment(), and Value().

Here is the call graph for this function:

◆ ToDeclaration()

Declaration * Node::ToDeclaration ( ) const
inherited

Pointer conversion - replaces TiXmlNode::ToDeclaration.

Exceptions
ExceptionWhen this node is not a Declaration.

Definition at line 609 of file ticpp.cpp.

609 {
610 TiXmlDeclaration* doc = GetTiXmlPointer()->ToDeclaration();
611
612 if (0 == doc) {
613 TICPPTHROW("This node (" << Value() << ") is not a Declaration")
614 }
615
616 Declaration* temp = new Declaration(doc);
617 doc->m_spawnedWrappers.push_back(temp);
618
619 return temp;
620}

References GetTiXmlPointer(), TICPPTHROW, TiXmlNode::ToDeclaration(), and Value().

Here is the call graph for this function:

◆ ToDocument()

Document * Node::ToDocument ( ) const
inherited

Pointer conversion - replaces TiXmlNode::ToDocument.

Exceptions
ExceptionWhen this node is not a Document.

Definition at line 557 of file ticpp.cpp.

557 {
558 TiXmlDocument* doc = GetTiXmlPointer()->ToDocument();
559
560 if (0 == doc) {
561 TICPPTHROW("This node (" << Value() << ") is not a Document")
562 }
563
564 Document* temp = new Document(doc);
565 doc->m_spawnedWrappers.push_back(temp);
566
567 return temp;
568}

References GetTiXmlPointer(), TiCppRC::m_spawnedWrappers, TICPPTHROW, TiXmlNode::ToDocument(), and Value().

Here is the call graph for this function:

◆ ToElement()

Element * Node::ToElement ( ) const
inherited

Pointer conversion - replaces TiXmlNode::ToElement.

Exceptions
ExceptionWhen this node is not a Element.

Definition at line 570 of file ticpp.cpp.

570 {
571 TiXmlElement* doc = GetTiXmlPointer()->ToElement();
572
573 if (0 == doc) {
574 TICPPTHROW("This node (" << Value() << ") is not a Element")
575 }
576
577 Element* temp = new Element(doc);
578 doc->m_spawnedWrappers.push_back(temp);
579
580 return temp;
581}

References GetTiXmlPointer(), TiCppRC::m_spawnedWrappers, TICPPTHROW, TiXmlNode::ToElement(), and Value().

Here is the call graph for this function:

◆ ToString() [1/2]

std::string ticpp::Base::ToString ( const std::string & value) const
inlineinherited

Definition at line 180 of file ticpp.h.

180{ return value; }

◆ ToString() [2/2]

template<class T>
std::string ticpp::Base::ToString ( const T & value) const
inlineinherited

Converts any class with a proper overload of the << opertor to a std::string.

Parameters
valueThe value to be converted
Exceptions
ExceptionWhen value cannot be converted to a std::string

Definition at line 169 of file ticpp.h.

169 {
170 std::stringstream convert;
171 convert << value;
172
173 if (convert.fail()) {
174 TICPPTHROW("Could not convert value to text");
175 }
176
177 return convert.str();
178 }

References TICPPTHROW.

Referenced by ticpp::Attribute::SetName(), ticpp::Attribute::SetValue(), and ticpp::Node::SetValue().

Here is the caller graph for this function:

◆ ToStylesheetReference()

StylesheetReference * Node::ToStylesheetReference ( ) const
inherited

Pointer conversion - replaces TiXmlNode::ToStylesheetReference.

Exceptions
ExceptionWhen this node is not a StylesheetReference.

Definition at line 622 of file ticpp.cpp.

622 {
623 TiXmlStylesheetReference* doc = GetTiXmlPointer()->ToStylesheetReference();
624
625 if (0 == doc) {
626 TICPPTHROW("This node (" << Value() << ") is not a StylesheetReference")
627 }
628
629 StylesheetReference* temp = new StylesheetReference(doc);
630 doc->m_spawnedWrappers.push_back(temp);
631
632 return temp;
633}

References GetTiXmlPointer(), TICPPTHROW, TiXmlNode::ToStylesheetReference(), and Value().

Here is the call graph for this function:

◆ ToText()

Text * Node::ToText ( ) const
inherited

Pointer conversion - replaces TiXmlNode::ToText.

Exceptions
ExceptionWhen this node is not a Text.

Definition at line 596 of file ticpp.cpp.

596 {
597 TiXmlText* doc = GetTiXmlPointer()->ToText();
598
599 if (0 == doc) {
600 TICPPTHROW("This node (" << Value() << ") is not a Text")
601 }
602
603 Text* temp = new Text(doc);
604 doc->m_spawnedWrappers.push_back(temp);
605
606 return temp;
607}

References GetTiXmlPointer(), TICPPTHROW, TiXmlNode::ToText(), and Value().

Here is the call graph for this function:

◆ Type()

int Node::Type ( ) const
inherited

Query the type (as TiXmlNode::NodeType ) of this node.

Definition at line 536 of file ticpp.cpp.

536{ return GetTiXmlPointer()->Type(); }

References GetTiXmlPointer(), and TiXmlNode::Type().

Referenced by InsertAfterChild(), InsertBeforeChild(), InsertEndChild(), LinkEndChild(), and ReplaceChild().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ValidatePointer()

void ticpp::Base::ValidatePointer ( ) const
inlineprotectedinherited

Definition at line 281 of file ticpp.h.

281 {
282 if (m_impRC->IsNull()) {
283 TICPPTHROW("Internal TiXml Pointer is nullptr");
284 }
285 }

References m_impRC, and TICPPTHROW.

Referenced by ticpp::Attribute::GetBasePointer(), ticpp::Attribute::GetName(), ticpp::NodeImp< T >::GetTiXmlPointer(), ticpp::Attribute::GetValue(), ticpp::Attribute::Name(), ticpp::Attribute::Next(), ticpp::Attribute::Previous(), ticpp::Attribute::Print(), ticpp::Attribute::SetName(), ticpp::Attribute::SetValue(), and ticpp::Attribute::Value().

Here is the caller graph for this function:

◆ Value()

std::string Node::Value ( ) const
inherited

Get the value of this node.

Simple wrapper for TiXmlNode::ValueStr.

See also
GetValue

Definition at line 230 of file ticpp.cpp.

230{ return GetTiXmlPointer()->ValueStr(); }
const std::string & ValueStr() const
Return Value() as a std::string.
Definition tinyxml.h:524

References GetTiXmlPointer(), and TiXmlNode::ValueStr().

Referenced by ticpp::NodeImp< TiXmlComment >::FirstChild(), FirstChildElement(), NextSibling(), PreviousSibling(), RemoveChild(), ToComment(), ToDeclaration(), ToDocument(), ToElement(), ToStylesheetReference(), and ToText().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_impRC

◆ m_tiXmlPointer


The documentation for this class was generated from the following files:
  • agrum/base/external/tinyxml/ticpp/ticpp.h
  • agrum/base/external/tinyxml/ticpp/ticpp.cpp