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

Wrapper around TiXmlDeclaration. More...

#include <ticpp.h>

Inheritance diagram for ticpp::Declaration:
Collaboration diagram for ticpp::Declaration:

Public Member Functions

 Declaration ()
 Default Constructor.
 Declaration (TiXmlDeclaration *declaration)
 Constructor.
 Declaration (const std::string &version, const std::string &encoding, const std::string &standalone)
 Constructor.
std::string Version () const
 Version.
std::string Encoding () const
 Encoding.
std::string Standalone () const
 StandAlone.
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
virtual void IterateFirst (const std::string &, Attribute **) 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 (TiXmlDeclaration *newPointer)
TiXmlBaseGetBasePointer () const
NodeNodeFactory (TiXmlNode *tiXmlNode, bool throwIfNull=true, bool rememberSpawnedWrapper=true) const
void SetImpRC (TiXmlBase *nodeBase)
void ValidatePointer () const

Protected Attributes

TiXmlDeclarationm_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.

Detailed Description

Wrapper around TiXmlDeclaration.

Definition at line 1896 of file ticpp.h.

Constructor & Destructor Documentation

◆ Declaration() [1/3]

Declaration::Declaration ( )

Default Constructor.

Construct an empty declaration.

Definition at line 867 of file ticpp.cpp.

868 : NodeImp< TiXmlDeclaration >(new TiXmlDeclaration()) {
869 m_impRC->InitRef();
870}
TiCppRCImp * m_impRC
Holds status of internal TiXmlPointer - use this to determine if object has been deleted already.
Definition ticpp.h:267
NodeImp(TiXmlDeclaration *tiXmlPointer)
Definition ticpp.h:1292

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

Here is the call graph for this function:

◆ Declaration() [2/3]

Declaration::Declaration ( TiXmlDeclaration * declaration)

Constructor.

Definition at line 872 of file ticpp.cpp.

873 : NodeImp< TiXmlDeclaration >(declaration) {}

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

Here is the call graph for this function:

◆ Declaration() [3/3]

Declaration::Declaration ( const std::string & version,
const std::string & encoding,
const std::string & standalone )

Constructor.

Definition at line 875 of file ticpp.cpp.

879 new TiXmlDeclaration(version, encoding, standalone)) {
880 m_impRC->InitRef();
881}

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

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:

◆ Encoding()

std::string Declaration::Encoding ( ) const

Encoding.

Will return an empty string if none was found.

Definition at line 885 of file ticpp.cpp.

885{ return m_tiXmlPointer->Encoding(); }
TiXmlDeclaration * m_tiXmlPointer
Definition ticpp.h:1262

References ticpp::NodeImp< TiXmlDeclaration >::m_tiXmlPointer.

◆ 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}
std::vector< ticpp::Base * > m_spawnedWrappers
Remember all wrappers that we've created with 'new' - ( e.g.
Definition ticpprc.h:63
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
Definition tinyxml.cpp:384
std::string Value() const
Get the value of this node.
Definition ticpp.cpp:230

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:

◆ 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}

◆ GetTiXmlPointer()

TiXmlNode * ticpp::NodeImp< TiXmlDeclaration >::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 }
void FromString(const std::string &temp, T *out) const
Converts a std::string to any class with a proper overload of the >> opertor.
Definition ticpp.h:189

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

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]

virtual void ticpp::Node::IterateFirst ( const std::string & ,
Attribute **  ) const
inlinevirtualinherited

Reimplemented in ticpp::Element.

Definition at line 796 of file ticpp.h.

796 {
797 TICPPTHROW("Attributes can only be iterated with Elements.")
798 }

References TICPPTHROW.

◆ 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:

◆ 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:

◆ 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:

◆ 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:

◆ SetTiXmlPointer()

void ticpp::NodeImp< TiXmlDeclaration >::SetTiXmlPointer ( TiXmlDeclaration * 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
std::string ToString(const T &value) const
Converts any class with a proper overload of the << opertor to a std::string.
Definition ticpp.h:169

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

Here is the call graph for this function:

◆ Standalone()

std::string Declaration::Standalone ( ) const

StandAlone.

Is this a standalone document?

Definition at line 887 of file ticpp.cpp.

887 {
888 return m_tiXmlPointer->Standalone();
889}

References ticpp::NodeImp< TiXmlDeclaration >::m_tiXmlPointer.

◆ 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:

◆ Version()

std::string Declaration::Version ( ) const

Version.

Will return an empty string if none was found.

Definition at line 883 of file ticpp.cpp.

883{ return m_tiXmlPointer->Version(); }

References ticpp::NodeImp< TiXmlDeclaration >::m_tiXmlPointer.

Member Data Documentation

◆ m_impRC

◆ m_tiXmlPointer

TiXmlDeclaration* ticpp::NodeImp< TiXmlDeclaration >::m_tiXmlPointer
protectedinherited

Internal pointer to the TiXml Class which is being wrapped.

Definition at line 1262 of file ticpp.h.

Referenced by ticpp::Declaration::Encoding(), ticpp::Declaration::Standalone(), and ticpp::Declaration::Version().


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