#include <HxTagList.h>
Public Types | |
typedef HxTag * | TagPtr |
Type definition for a pointer to an HxTag. More... | |
typedef std::list< TagPtr > | List |
Type definition for a list of tag pointers. More... | |
Public Methods | |
HxTagList () | |
Constructor. More... | |
HxTagList (const HxTagList &) | |
Copy constructor. More... | |
~HxTagList () | |
Destructor. More... | |
HxTagList & | operator= (const HxTagList &) |
Assignment operator. More... | |
void | erase () |
Make the tag list empty. More... | |
void | addTag (HxTag *) |
Add a tag, use via HxAddTag. More... | |
HxTag * | getTag (HxString name) const |
Get a tag, use via HxGetTag. More... | |
HxString | toString () const |
Make a sttring with names of all tags. More... | |
std::ostream & | put (std::ostream &) const |
To put the list on an ostream. More... |
Basically, a tag is a combination of a name and a value. The name is represented by an HxString and the value is represented by an instantiation of HxTagTem, which is a specialization of HxTag. A value can be anything as long as it can be copy-constructed.
Use HxAddTag to add tags to the list. Use HxGetTag(const HxTagList&,HxString) and HxGetTag(const HxTagList&,HxString,ValT) to obtain values stored in the list. Use HxTagIsSet to check whether a tag is in the list.
|
Type definition for a pointer to an HxTag.
|
|
Type definition for a list of tag pointers.
|
|
Constructor.
00038 {} |
|
Copy constructor.
|
|
Destructor.
00039 { 00040 List::iterator ptr; 00041 00042 for (ptr = _list.begin(); ptr != _list.end(); ptr++) 00043 delete (*ptr); 00044 } |
|
Assignment operator.
00026 { 00027 List::const_iterator ptr; 00028 for (ptr = _list.begin(); ptr != _list.end(); ptr++) 00029 delete (*ptr); 00030 _list.erase(_list.begin(), _list.end()); 00031 for (ptr = rhs._list.begin(); ptr != rhs._list.end(); ptr++) 00032 { 00033 _list.push_back((*ptr)->clone()); 00034 } 00035 return *this; 00036 } |
|
Make the tag list empty.
00048 { 00049 List::const_iterator ptr; 00050 for (ptr = _list.begin(); ptr != _list.end(); ptr++) 00051 delete (*ptr); 00052 _list.erase(_list.begin(), _list.end()); 00053 } |
|
Add a tag, use via HxAddTag.
00077 { 00078 List::iterator ptr = findTag(tag->getName()); 00079 00080 if (ptr != _list.end() ) 00081 { 00082 delete (*ptr); 00083 _list.erase(ptr); 00084 } 00085 _list.push_front(tag); 00086 } |
|
Get a tag, use via HxGetTag.
00090 { 00091 List::const_iterator ptr = findTag(name); 00092 return ptr != _list.end() ? (*ptr) : 0; 00093 } |
|
Make a sttring with names of all tags.
00097 { 00098 int i = 0; 00099 HxString s("("); 00100 List::const_iterator ptr; 00101 for (ptr = _list.begin(); ptr != _list.end(); ptr++) 00102 { 00103 if (i > 0) 00104 s += ", "; 00105 s += (*ptr)->getName(); 00106 00107 } 00108 s += ")"; 00109 return s; 00110 } |
|
To put the list on an ostream.
00114 { 00115 List::const_iterator ptr; 00116 for (ptr = _list.begin(); ptr != _list.end(); ptr++) 00117 os << (*ptr) << STD_ENDL; 00118 return os; 00119 } |