Dictionary template definition. More...
#include <tdictionary.h>
Public Member Functions | |
TDictionary () | |
Default constructor. | |
TDictionary (const TKey &errKey, const TObject &errObj) | |
Constructor passing error values. | |
TDictionary (const TDictionary< TKey, TObject > &) | |
Copy constructor. | |
~TDictionary () | |
Destructor. | |
TDictionary< TKey, TObject > & | operator= (const TDictionary< TKey, TObject > &) |
Assignment operator. | |
bool | addKey (const TKey &) |
Add key. | |
bool | addKeyAndObject (const TKey &, const TObject &) |
Add key/object. | |
bool | addAssoc (const TAssociation< TKey, TObject > &) |
Add association. | |
bool | replace (const TKey &, const TObject &) |
Replace object at key. | |
bool | removeKey (const TKey &) |
Remove association at key. | |
const TKey & | lookupKey (const TKey &) const |
Return equal key. | |
const TObject & | lookupObject (const TKey &) const |
Return object by key. | |
bool | containsKey (const TKey &) const |
Test if key is in dictionary. | |
int32 | occurrencesOfKey (const TKey &) const |
How many equal keys. | |
const TAssociation< TKey, TObject > & | lookupAssoc (const TKey &) const |
Lookup association at key. |
Dictionary template definition.
A dictionary is a container that holds value pairs, a key and its associated value object. The container is sorted by key and thus allows for quick finding of a key and the lookup of the corresponding value.
TDictionary | ( | ) | [inline] |
Default constructor.
TDictionary | ( | const TKey & | errKey, | |
const TObject & | errObj | |||
) | [inline] |
Constructor passing error values.
TDictionary | ( | const TDictionary< TKey, TObject > & | dict | ) | [inline] |
Copy constructor.
Creates a new dictionary and assigns it with a copy of the specified dictionary.
~TDictionary | ( | ) | [inline] |
Destructor.
TDictionary< TKey, TObject > & operator= | ( | const TDictionary< TKey, TObject > & | dict | ) | [inline] |
Assignment operator.
Copies the dictionary specified on the right side of the operator into the dictionary on the left side.
bool addKey | ( | const TKey & | rKey | ) | [inline] |
Add key.
A new association between the specified key and a default constructed object value gets added.
bool addKeyAndObject | ( | const TKey & | rKey, | |
const TObject & | rObj | |||
) | [inline] |
Add key/object.
Adds a new association of specified key and object to the dicitonary.
bool addAssoc | ( | const TAssociation< TKey, TObject > & | rAssoc | ) | [inline] |
Add association.
Adds the specified association to the dictionary.
bool replace | ( | const TKey & | rKey, | |
const TObject & | rObj | |||
) | [inline] |
Replace object at key.
Finds the first occurrence of an association containing the specified key and replaces its value by the specified object value.
bool removeKey | ( | const TKey & | rKey | ) | [inline] |
Remove association at key.
Finds the first association at the specified key and removes it if found.
const TKey & lookupKey | ( | const TKey & | rKey | ) | const [inline] |
Return equal key.
Returns the key of the first occurrence of an association containing the specified key.
const TObject & lookupObject | ( | const TKey & | rKey | ) | const [inline] |
Return object by key.
Returns a copy of the object of the first occurrence of an association containing the specified key.
bool containsKey | ( | const TKey & | rKey | ) | const [inline] |
Test if key is in dictionary.
Returns true if the dictionary contains an association with the specified key.
int32 occurrencesOfKey | ( | const TKey & | rKey | ) | const [inline] |
How many equal keys.
Returns the number of associations containing the specified key.
const TAssociation< TKey, TObject > & lookupAssoc | ( | const TKey & | rKey | ) | const [inline] |
Lookup association at key.
Returns a copy of the first occurrence of an association containing the specified key.