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

Wrapper around TiXmlStylesheetReference. More...

#include <ticpp.h>

Inheritance diagram for ticpp::StylesheetReference:
Collaboration diagram for ticpp::StylesheetReference:

Public Member Functions

 StylesheetReference ()
 Default Constructor.
 StylesheetReference (TiXmlStylesheetReference *stylesheetReference)
 Constructor.
 StylesheetReference (const std::string &type, const std::string &href)
 Constructor.
std::string Type () const
 Type.
std::string Href () const
 Href.
void GetValue (TiXmlStylesheetReference *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.
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.
void SetValue (const TiXmlStylesheetReference &value)
 Set 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
void IterateFirst (const std::string &value, TiXmlStylesheetReference **first) const
virtual void IterateFirst (const std::string &, Attribute **) const
void IterateNext (const std::string &value, TiXmlStylesheetReference **next) const
template<class T>
void IterateNext (const std::string &value, T **next) const
void IteratePrevious (const std::string &value, TiXmlStylesheetReference **previous) 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.
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.
TiXmlStylesheetReferenceTo () 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.
std::string ToString (const TiXmlStylesheetReference &value) const
 Converts any class with a proper overload of the << opertor to a std::string.
std::string ToString (const std::string &value) const
void FromString (const std::string &temp, TiXmlStylesheetReference *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 (TiXmlStylesheetReference *newPointer)
TiXmlBaseGetBasePointer () const
NodeNodeFactory (TiXmlNode *tiXmlNode, bool throwIfNull=true, bool rememberSpawnedWrapper=true) const
void SetImpRC (TiXmlBase *nodeBase)
void ValidatePointer () const

Protected Attributes

TiXmlStylesheetReferencem_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 TiXmlStylesheetReference.

Definition at line 1934 of file ticpp.h.

Constructor & Destructor Documentation

◆ StylesheetReference() [1/3]

StylesheetReference::StylesheetReference ( )

Default Constructor.

Construct an empty declaration.

Definition at line 893 of file ticpp.cpp.

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

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

Here is the call graph for this function:

◆ StylesheetReference() [2/3]

StylesheetReference::StylesheetReference ( TiXmlStylesheetReference * stylesheetReference)

Constructor.

Definition at line 898 of file ticpp.cpp.

900 : NodeImp< TiXmlStylesheetReference >(stylesheetReference) {}

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

Here is the call graph for this function:

◆ StylesheetReference() [3/3]

StylesheetReference::StylesheetReference ( const std::string & type,
const std::string & href )

Constructor.

Definition at line 902 of file ticpp.cpp.

905 new TiXmlStylesheetReference(type, href)) {
906 m_impRC->InitRef();
907}

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

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 1048 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.
Implementation of Node wrapper.
Definition ticpp.h:1260

◆ 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 {
240#ifndef TICPP_NO_RTTI
241 TiXmlNode* node = dynamic_cast< TiXmlNode* >(GetBasePointer());
242
243 if (node != 0) {
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 }
std::string Value() const
Get the value of this node.
Definition ticpp.cpp:230
Document * GetDocument(bool throwIfNoDocument=true) const
Return a pointer to the Document this node lives in.
Definition ticpp.cpp:538

◆ Clear()

void Node::Clear ( )
inherited

Clear all Nodes below this.

Simple wrapper for TiXmlNode::Clear.

Definition at line 498 of file ticpp.cpp.

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

◆ 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 1042 of file ticpp.cpp.

635 {
637
638 if (0 == node) {
639 TICPPTHROW("Node could not be cloned");
640 }
641
643
644 // Take ownership of the memory from TiXml
645 temp->m_impRC->InitRef();
646
647 return temp;
648}
void InitRef()
Set Reference Count to 1 - dangerous!
Definition ticpp.cpp:967
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

◆ 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

◆ 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 525 of file ticpp.cpp.

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

◆ FirstChild() [2/3]

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

Definition at line 539 of file ticpp.cpp.

252 {
254
255 if (0 == strlen(value)) {
257 } else {
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

◆ 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 552 of file ticpp.cpp.

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

◆ 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 892 of file ticpp.cpp.

501 {
503}
Element * FirstChildElement(bool throwIfNoChildren=true) const
Definition ticpp.cpp:501

◆ FirstChildElement() [2/3]

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

Definition at line 906 of file ticpp.cpp.

510 {
512
513 if (0 == strlen(value)) {
515 } else {
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

◆ 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 920 of file ticpp.cpp.

506 {
508}

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

void ticpp::Base::FromString ( const std::string & temp,
TiXmlStylesheetReference * 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 {
191 val >> *out;
192
193 if (val.fail()) {
194 TICPPTHROW("Could not convert \"" << temp << "\" to target type");
195 }
196 }

◆ GetBasePointer()

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

Definition at line 1073 of file ticpp.h.

1073{ return GetTiXmlPointer(); }

◆ 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 940 of file ticpp.cpp.

538 {
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}
const TiXmlDocument * GetDocument() const
Return a pointer to the Document this node lives in.
Definition tinyxml.cpp:424

◆ GetTiXmlPointer()

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

Implements ticpp::Node.

Definition at line 1271 of file ticpp.h.

1271 {
1273 return m_tiXmlPointer;
1274 }

◆ GetValue() [1/2]

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
virtual TiXmlNode * GetTiXmlPointer() const =0

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

Here is the call graph for this function:

◆ GetValue() [2/2]

void ticpp::Node::GetValue ( TiXmlStylesheetReference * 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 {
472 }

◆ Href()

std::string StylesheetReference::Href ( ) const

Href.

Will return an empty string if none was found.

Definition at line 911 of file ticpp.cpp.

911{ return m_tiXmlPointer->Href(); }
TiXmlStylesheetReference * m_tiXmlPointer
Definition ticpp.h:1262

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

◆ 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 667 of file ticpp.cpp.

365 {
367 TICPPTHROW("Node is a Document and can't be inserted");
368 }
369
370 // Increment reference count when adding to the tree
372
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

◆ 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 654 of file ticpp.cpp.

347 {
349 TICPPTHROW("Node is a Document and can't be inserted");
350 }
351
352 // Increment reference count when adding to the tree
354
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

◆ 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 629 of file ticpp.cpp.

317 {
319 TICPPTHROW("Node is a Document and can't be inserted");
320 }
321
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

◆ 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 615 of file ticpp.cpp.

304 {
306
307 if (0 == previous) {
309 } else {
310 pointer =
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

◆ 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 604 of file ticpp.cpp.

292 {
294
295 if (0 == previous) {
297 } else {
299 }
300
301 return NodeFactory(pointer, false);
302}

◆ IterateFirst() [1/2]

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

Definition at line 796 of file ticpp.h.

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

◆ IterateFirst() [2/2]

void ticpp::Node::IterateFirst ( const std::string & value,
TiXmlStylesheetReference ** 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

◆ IterateNext() [1/2]

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:

◆ IterateNext() [2/2]

void ticpp::Node::IterateNext ( const std::string & value,
TiXmlStylesheetReference ** 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 }

◆ IteratePrevious() [1/2]

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:

◆ IteratePrevious() [2/2]

void ticpp::Node::IteratePrevious ( const std::string & value,
TiXmlStylesheetReference ** previous ) const
inlineinherited

Definition at line 826 of file ticpp.h.

826 {
828 *previous = dynamic_cast< T* >(sibling);
829
830 while ((0 != sibling) && (0 == *previous)) {
832 *previous = dynamic_cast< T* >(sibling);
833 }
834 }

◆ 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 568 of file ticpp.cpp.

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

◆ LastChild() [2/3]

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

Definition at line 582 of file ticpp.cpp.

276 {
278
279 if (0 == strlen(value)) {
281 } else {
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

◆ 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 595 of file ticpp.cpp.

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

◆ 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 641 of file ticpp.cpp.

332 {
334 TICPPTHROW("Node is a Document and can't be linked");
335 }
336
337 // Increment reference count when adding to the tree
339
341 TICPPTHROW("Node can't be linked");
342 }
343
344 return childNode;
345}
Node * LinkEndChild(Node *childNode)
Definition ticpp.cpp:332

◆ 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 745 of file ticpp.cpp.

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

◆ NextSibling() [2/3]

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

Definition at line 773 of file ticpp.cpp.

446 {
448
449 if (0 == strlen(value)) {
451 } else {
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

◆ 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 758 of file ticpp.cpp.

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

◆ 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 848 of file ticpp.cpp.

464 {
466}
Element * NextSiblingElement(bool throwIfNoSiblings=true) const
Definition ticpp.cpp:464

◆ NextSiblingElement() [2/3]

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

Definition at line 875 of file ticpp.cpp.

474 {
476
477 if (0 == strlen(value)) {
479 } else {
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

◆ 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 860 of file ticpp.cpp.

469 {
471}

◆ NoChildren()

bool Node::NoChildren ( ) const
inherited

Check if this node has no children.

Returns
true if this node has no children.

Definition at line 947 of file ticpp.cpp.

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

◆ NodeFactory()

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

Definition at line 1079 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()) {
197 break;
198
201 break;
202
205 break;
206
207 case TiXmlNode::TEXT:
208 temp = new Text(tiXmlNode->ToText());
209 break;
210
213 break;
214
217 break;
218
219 default:
220 TICPPTHROW("Type is unsupported")
221 }
222
224 tiXmlNode->m_spawnedWrappers.push_back(temp);
225 }
226
227 return temp;
228}
Comment * ToComment() const
Pointer conversion - replaces TiXmlNode::ToComment.
Definition ticpp.cpp:583
Declaration * ToDeclaration() const
Pointer conversion - replaces TiXmlNode::ToDeclaration.
Definition ticpp.cpp:609
StylesheetReference * ToStylesheetReference() const
Pointer conversion - replaces TiXmlNode::ToStylesheetReference.
Definition ticpp.cpp:622
Document * ToDocument() const
Pointer conversion - replaces TiXmlNode::ToDocument.
Definition ticpp.cpp:557
Element * ToElement() const
Pointer conversion - replaces TiXmlNode::ToElement.
Definition ticpp.cpp:570
Text * ToText() const
Pointer conversion - replaces TiXmlNode::ToText.
Definition ticpp.cpp:596

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

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

◆ 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 510 of file ticpp.cpp.

234 {
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

◆ 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 703 of file ticpp.cpp.

410 {
412}

◆ PreviousSibling() [2/3]

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

Definition at line 731 of file ticpp.cpp.

419 {
421
422 if (0 == strlen(value)) {
424 } else {
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

◆ 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 716 of file ticpp.cpp.

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

◆ 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 689 of file ticpp.cpp.

401 {
403 TICPPTHROW("Node to remove (" << removeThis->Value()
404 << ") is not a child of this Node ("
405 << Value()
406 << ")")
407 }
408}

◆ 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 679 of file ticpp.cpp.

383 {
385 TICPPTHROW("Node is a Document and can't be inserted");
386 }
387
388 // Increment reference count when adding to the tree
390
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

◆ 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

◆ SetImpRC()

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

Definition at line 279 of file ticpp.h.

279{ m_impRC = nodeBase->m_tiRC; }

◆ SetTiXmlPointer()

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

Definition at line 1283 of file ticpp.h.

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

◆ SetValue() [1/2]

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:

◆ SetValue() [2/2]

void ticpp::Node::SetValue ( const TiXmlStylesheetReference & 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 }

◆ To()

TiXmlStylesheetReference * 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 }

◆ ToComment()

Comment * Node::ToComment ( ) const
inherited

Pointer conversion - replaces TiXmlNode::ToComment.

Exceptions
ExceptionWhen this node is not a Comment.

Definition at line 1000 of file ticpp.cpp.

583 {
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}
virtual const TiXmlComment * ToComment() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:792

◆ ToDeclaration()

Declaration * Node::ToDeclaration ( ) const
inherited

Pointer conversion - replaces TiXmlNode::ToDeclaration.

Exceptions
ExceptionWhen this node is not a Declaration.

Definition at line 1014 of file ticpp.cpp.

609 {
611
612 if (0 == doc) {
613 TICPPTHROW("This node (" << Value() << ") is not a Declaration")
614 }
615
617 doc->m_spawnedWrappers.push_back(temp);
618
619 return temp;
620}
virtual const TiXmlDeclaration * ToDeclaration() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:804

◆ ToDocument()

Document * Node::ToDocument ( ) const
inherited

Pointer conversion - replaces TiXmlNode::ToDocument.

Exceptions
ExceptionWhen this node is not a Document.

Definition at line 986 of file ticpp.cpp.

557 {
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}
virtual const TiXmlDocument * ToDocument() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:784

◆ ToElement()

Element * Node::ToElement ( ) const
inherited

Pointer conversion - replaces TiXmlNode::ToElement.

Exceptions
ExceptionWhen this node is not a Element.

Definition at line 993 of file ticpp.cpp.

570 {
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}
virtual const TiXmlElement * ToElement() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:788

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

std::string ticpp::Base::ToString ( const TiXmlStylesheetReference & 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 {
171 convert << value;
172
173 if (convert.fail()) {
174 TICPPTHROW("Could not convert value to text");
175 }
176
177 return convert.str();
178 }

◆ ToStylesheetReference()

Pointer conversion - replaces TiXmlNode::ToStylesheetReference.

Exceptions
ExceptionWhen this node is not a StylesheetReference.

Definition at line 1021 of file ticpp.cpp.

622 {
624
625 if (0 == doc) {
626 TICPPTHROW("This node (" << Value() << ") is not a StylesheetReference")
627 }
628
630 doc->m_spawnedWrappers.push_back(temp);
631
632 return temp;
633}
virtual const TiXmlStylesheetReference * ToStylesheetReference() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:808

◆ ToText()

Text * Node::ToText ( ) const
inherited

Pointer conversion - replaces TiXmlNode::ToText.

Exceptions
ExceptionWhen this node is not a Text.

Definition at line 1007 of file ticpp.cpp.

596 {
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}
virtual const TiXmlText * ToText() const
Cast to a more defined type. Will return null if not of the requested type.
Definition tinyxml.h:800

◆ Type()

std::string StylesheetReference::Type ( ) const

Type.

Will return an empty string if none was found.

Definition at line 909 of file ticpp.cpp.

909{ return m_tiXmlPointer->Type(); }

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

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

◆ Value()

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

Get the value of this node.

Simple wrapper for TiXmlNode::ValueStr.

See also
GetValue

Definition at line 480 of file ticpp.cpp.

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

Member Data Documentation

◆ m_impRC

TiCppRCImp* ticpp::Base::m_impRC
mutableprotectedinherited

Holds status of internal TiXmlPointer - use this to determine if object has been deleted already.

Definition at line 267 of file ticpp.h.

Referenced by ticpp::StylesheetReference::StylesheetReference().

◆ m_tiXmlPointer

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

Internal pointer to the TiXml Class which is being wrapped.

Definition at line 1262 of file ticpp.h.

Referenced by ticpp::StylesheetReference::Href(), and ticpp::StylesheetReference::Type().


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