FEDRA emulsion software from the OPERA Collaboration
TiXmlAttributeSet Class Reference

#include <tinyxml.h>

Collaboration diagram for TiXmlAttributeSet:

Public Member Functions

void Add (TiXmlAttribute *attribute)
 
TiXmlAttributeFind (const char *_name) const
 
TiXmlAttributeFindOrCreate (const char *_name)
 
TiXmlAttributeFirst ()
 
const TiXmlAttributeFirst () const
 
TiXmlAttributeLast ()
 
const TiXmlAttributeLast () const
 
void Remove (TiXmlAttribute *attribute)
 
 TiXmlAttributeSet ()
 
 ~TiXmlAttributeSet ()
 

Private Member Functions

void operator= (const TiXmlAttributeSet &)
 
 TiXmlAttributeSet (const TiXmlAttributeSet &)
 

Private Attributes

TiXmlAttribute sentinel
 

Constructor & Destructor Documentation

◆ TiXmlAttributeSet() [1/2]

TiXmlAttributeSet::TiXmlAttributeSet ( )
1501 {
1502  sentinel.next = &sentinel;
1503  sentinel.prev = &sentinel;
1504 }
TiXmlAttribute sentinel
Definition: tinyxml.h:932
TiXmlAttribute * prev
Definition: tinyxml.h:886
TiXmlAttribute * next
Definition: tinyxml.h:887

◆ ~TiXmlAttributeSet()

TiXmlAttributeSet::~TiXmlAttributeSet ( )
1508 {
1509  assert( sentinel.next == &sentinel );
1510  assert( sentinel.prev == &sentinel );
1511 }

◆ TiXmlAttributeSet() [2/2]

TiXmlAttributeSet::TiXmlAttributeSet ( const TiXmlAttributeSet )
private

Member Function Documentation

◆ Add()

void TiXmlAttributeSet::Add ( TiXmlAttribute attribute)
1515 {
1516  #ifdef TIXML_USE_STL
1517  assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set.
1518  #else
1519  assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set.
1520  #endif
1521 
1522  addMe->next = &sentinel;
1523  addMe->prev = sentinel.prev;
1524 
1525  sentinel.prev->next = addMe;
1526  sentinel.prev = addMe;
1527 }
TiXmlAttribute * Find(const char *_name) const
Definition: tinyxml.cpp:1572
#define TIXML_STRING
Definition: tinyxml.h:53

◆ Find()

TiXmlAttribute * TiXmlAttributeSet::Find ( const char *  _name) const
1573 {
1574  for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
1575  {
1576  if ( strcmp( node->name.c_str(), name ) == 0 )
1577  return node;
1578  }
1579  return 0;
1580 }
Definition: tinyxml.h:780
const char * name
Definition: merge_Energy_SytematicSources_Electron.C:24

◆ FindOrCreate()

TiXmlAttribute * TiXmlAttributeSet::FindOrCreate ( const char *  _name)
1584 {
1585  TiXmlAttribute* attrib = Find( _name );
1586  if ( !attrib ) {
1587  attrib = new TiXmlAttribute();
1588  Add( attrib );
1589  attrib->SetName( _name );
1590  }
1591  return attrib;
1592 }
void Add(TiXmlAttribute *attribute)
Definition: tinyxml.cpp:1514
void SetName(const char *_name)
Set the name of this attribute.
Definition: tinyxml.h:835

◆ First() [1/2]

TiXmlAttribute* TiXmlAttributeSet::First ( )
inline
913 { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }

◆ First() [2/2]

const TiXmlAttribute* TiXmlAttributeSet::First ( ) const
inline
912 { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }

◆ Last() [1/2]

TiXmlAttribute* TiXmlAttributeSet::Last ( )
inline
915 { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }

◆ Last() [2/2]

const TiXmlAttribute* TiXmlAttributeSet::Last ( ) const
inline
914 { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }

◆ operator=()

void TiXmlAttributeSet::operator= ( const TiXmlAttributeSet )
private

◆ Remove()

void TiXmlAttributeSet::Remove ( TiXmlAttribute attribute)
1530 {
1531  TiXmlAttribute* node;
1532 
1533  for( node = sentinel.next; node != &sentinel; node = node->next )
1534  {
1535  if ( node == removeMe )
1536  {
1537  node->prev->next = node->next;
1538  node->next->prev = node->prev;
1539  node->next = 0;
1540  node->prev = 0;
1541  return;
1542  }
1543  }
1544  assert( 0 ); // we tried to remove a non-linked attribute.
1545 }

Member Data Documentation

◆ sentinel

TiXmlAttribute TiXmlAttributeSet::sentinel
private

The documentation for this class was generated from the following files: