#include <tinyxml.h>

Public Member Functions | |
| TiXmlAttributeSet () | |
| ~TiXmlAttributeSet () | |
| void | Add (TiXmlAttribute *attribute) |
| void | Remove (TiXmlAttribute *attribute) |
| const TiXmlAttribute * | First () const |
| TiXmlAttribute * | First () |
| const TiXmlAttribute * | Last () const |
| TiXmlAttribute * | Last () |
| TiXmlAttribute * | Find (const char *_name) const |
| TiXmlAttribute * | FindOrCreate (const char *_name) |
| TiXmlAttribute * | Find (const std::string &_name) const |
| TiXmlAttribute * | FindOrCreate (const std::string &_name) |
Definition at line 908 of file tinyxml.h.
| TiXmlAttributeSet::TiXmlAttributeSet | ( | ) |
Definition at line 1453 of file tinyxml.cpp.
{
sentinel.next = &sentinel;
sentinel.prev = &sentinel;
}
| TiXmlAttributeSet::~TiXmlAttributeSet | ( | ) |
Definition at line 1460 of file tinyxml.cpp.
{
assert( sentinel.next == &sentinel );
assert( sentinel.prev == &sentinel );
}
| void TiXmlAttributeSet::Add | ( | TiXmlAttribute * | attribute ) |
Definition at line 1467 of file tinyxml.cpp.
References Find(), TiXmlAttribute::Name(), and TIXML_STRING.
Referenced by FindOrCreate(), and TiXmlElement::Parse().
{
#ifdef TIXML_USE_STL
assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set.
#else
assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set.
#endif
addMe->next = &sentinel;
addMe->prev = sentinel.prev;
sentinel.prev->next = addMe;
sentinel.prev = addMe;
}
| TiXmlAttribute * TiXmlAttributeSet::Find | ( | const std::string & | _name ) | const |
Definition at line 1502 of file tinyxml.cpp.
References TiXmlNode::next.
{
for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
{
if ( node->name == name )
return node;
}
return 0;
}
| TiXmlAttribute * TiXmlAttributeSet::Find | ( | const char * | _name ) | const |
Definition at line 1525 of file tinyxml.cpp.
References TiXmlNode::next.
Referenced by Add(), TiXmlElement::Attribute(), FindOrCreate(), TiXmlElement::Parse(), TiXmlElement::QueryDoubleAttribute(), TiXmlElement::QueryIntAttribute(), TiXmlElement::QueryValueAttribute(), and TiXmlElement::RemoveAttribute().
{
for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
{
if ( strcmp( node->name.c_str(), name ) == 0 )
return node;
}
return 0;
}
| TiXmlAttribute * TiXmlAttributeSet::FindOrCreate | ( | const char * | _name ) |
Definition at line 1536 of file tinyxml.cpp.
References Add(), Find(), and TiXmlAttribute::SetName().
Referenced by TiXmlElement::SetAttribute(), and TiXmlElement::SetDoubleAttribute().
{
TiXmlAttribute* attrib = Find( _name );
if ( !attrib ) {
attrib = new TiXmlAttribute();
Add( attrib );
attrib->SetName( _name );
}
return attrib;
}
| TiXmlAttribute * TiXmlAttributeSet::FindOrCreate | ( | const std::string & | _name ) |
Definition at line 1512 of file tinyxml.cpp.
References Add(), Find(), and TiXmlAttribute::SetName().
{
TiXmlAttribute* attrib = Find( _name );
if ( !attrib ) {
attrib = new TiXmlAttribute();
Add( attrib );
attrib->SetName( _name );
}
return attrib;
}
| TiXmlAttribute* TiXmlAttributeSet::First | ( | ) | [inline] |
| const TiXmlAttribute* TiXmlAttributeSet::First | ( | ) | const [inline] |
Definition at line 917 of file tinyxml.h.
Referenced by TiXmlElement::Accept(), TiXmlElement::ClearThis(), TiXmlElement::CopyTo(), TiXmlElement::FirstAttribute(), and TiXmlElement::Print().
{ return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
| const TiXmlAttribute* TiXmlAttributeSet::Last | ( | ) | const [inline] |
Definition at line 919 of file tinyxml.h.
Referenced by TiXmlElement::LastAttribute().
{ return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
| TiXmlAttribute* TiXmlAttributeSet::Last | ( | ) | [inline] |
| void TiXmlAttributeSet::Remove | ( | TiXmlAttribute * | attribute ) |
Definition at line 1482 of file tinyxml.cpp.
Referenced by TiXmlElement::ClearThis(), and TiXmlElement::RemoveAttribute().
{
TiXmlAttribute* node;
for( node = sentinel.next; node != &sentinel; node = node->next )
{
if ( node == removeMe )
{
node->prev->next = node->next;
node->next->prev = node->prev;
node->next = 0;
node->prev = 0;
return;
}
}
assert( 0 ); // we tried to remove a non-linked attribute.
}
1.7.2