![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
#include <Dictionary.h>
Inheritance diagram for Dictionary< Key, Value >:Public Member Functions | |
| __inline Value | getDefaultValue () const |
| __inline Value | getSafe (Key id) const |
| __inline bool | has (Key id) const |
| __inline void | remove (Key id) |
| __inline void | setDefaultValue (Value val) |
Protected Attributes | |
| Value | _defaultValue |
This class extends std::map by adding a few utility functions
Definition at line 11 of file Dictionary.h.
| __inline Value Dictionary< Key, Value >::getDefaultValue | ( | ) | const [inline] |
Definition at line 17 of file Dictionary.h.
{
| __inline Value Dictionary< Key, Value >::getSafe | ( | Key | id | ) | const [inline] |
Returns the value associated with the given key If the key is not found, the default value for this dictionary is returned
Definition at line 24 of file Dictionary.h.
Referenced by Support::Stopwatch::AccumulateTime(), and SraData::DbStream::RetrieveStream().
{
std::map<Key, Value>::const_iterator iter = find(id);
if(iter == end())
return _defaultValue;
else
return iter->second;
}
| __inline bool Dictionary< Key, Value >::has | ( | Key | id | ) | const [inline] |
Returns true if this object contains an entry with the given ID
Definition at line 36 of file Dictionary.h.
{
std::map<Key, Value>::const_iterator iter = find(id);
if(iter == end())
return false;
else
return true;
}
| __inline void Dictionary< Key, Value >::remove | ( | Key | id | ) | [inline] |
If an entry associated with the given key is in this dictionary it is deleted
Definition at line 49 of file Dictionary.h.
Referenced by SraData::DbStream::CheckHasMoreRows().
{
std::map<Key, Value>::iterator iter = find(id);
if(iter != end())
erase(iter);
}
| __inline void Dictionary< Key, Value >::setDefaultValue | ( | Value | val | ) | [inline] |
Definition at line 18 of file Dictionary.h.
{
Value Dictionary< Key, Value >::_defaultValue [protected] |
Definition at line 14 of file Dictionary.h.
Referenced by Dictionary< std::string, StopwatchAccumulator * >::getSafe().
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.