The class allows to store the name and description of objects that are uniquely identified by Key.
Key | Unique identifier of the objects. | |
Comp | The key comparison function for strict weak ordering of Key. The default is std::less<Key> (declared in namelistfwd.h). |
Definition of struct Demo ------------------------- #include <osbid.h> struct Demo { typedef Id<Demo> Oid; // ... other members }; Client of NameList ------------------ #include <osbid.h> #include <namelist.h> typedef NameList< Id<Demo> > DemoInfo; #include <demo.h> typedef NameList<Demo::Oid> DemoInfo;
Definition at line 106 of file namelist.h.
typedef std::map<KeyType, Entry, Comp> OSB_LIB::NameList< Key, Comp >::Cont |
typedef Key OSB_LIB::NameList< Key, Comp >::KeyType |
OSB_LIB::NameList< Key, Comp >::NameList | ( | ) |
OSB_LIB::NameList< Key, Comp >::NameList | ( | const NameList< Key, Comp > & | rhs | ) |
Copy constructor: copies nullEntry_ if applicable.
Definition at line 389 of file namelist.h.
References OSB_LIB::NameList< Key, Comp >::nullEntry_, and OSB_LIB::NameList< Key, Comp >::setNullEntry().
OSB_LIB::NameList< Key, Comp >::~NameList | ( | ) |
Destructor: delete nullEntry_.
Definition at line 413 of file namelist.h.
References OSB_LIB::NameList< Key, Comp >::nullEntry_.
void OSB_LIB::NameList< Key, Comp >::clear | ( | ) |
Clear the list and delete the null-entry.
Definition at line 426 of file namelist.h.
References OSB_LIB::NameList< Key, Comp >::entries_, and OSB_LIB::NameList< Key, Comp >::nullEntry_.
const std::string & OSB_LIB::NameList< Key, Comp >::des | ( | const Key & | key | ) | const [inline] |
Get the description of an object.
Definition at line 470 of file namelist.h.
References OSB_LIB::NameList< Key, Comp >::Entry::des_, and OSB_LIB::NameList< Key, Comp >::get().
const NameList< Key, Comp >::Cont & OSB_LIB::NameList< Key, Comp >::entries | ( | ) | const |
Get all entries.
Definition at line 420 of file namelist.h.
References OSB_LIB::NameList< Key, Comp >::entries_.
const NameList< Key, Comp >::Entry & OSB_LIB::NameList< Key, Comp >::get | ( | const Key & | key | ) | const [inline] |
Get the entry for one object.
key | Key of the object. |
Definition at line 451 of file namelist.h.
References OSB_LIB::NameList< Key, Comp >::entries_, and OSB_LIB::NameList< Key, Comp >::nullEntry().
Referenced by OSB_LIB::NameList< Key, Comp >::des(), and OSB_LIB::NameList< Key, Comp >::name().
const std::string & OSB_LIB::NameList< Key, Comp >::name | ( | const Key & | key | ) | const [inline] |
Get the name of an object.
Definition at line 462 of file namelist.h.
References OSB_LIB::NameList< Key, Comp >::get(), and OSB_LIB::NameList< Key, Comp >::Entry::name_.
const NameList< Key, Comp >::Entry * OSB_LIB::NameList< Key, Comp >::nullEntry | ( | ) | const [private] |
Get the default entry.
Creates nullEntry_ if needed.
Definition at line 477 of file namelist.h.
References OSB_LIB::NameList< Key, Comp >::nullEntry_.
Referenced by OSB_LIB::NameList< Key, Comp >::get(), and OSB_LIB::NameList< Key, Comp >::setNullEntry().
NameList< Key, Comp > & OSB_LIB::NameList< Key, Comp >::operator= | ( | const NameList< Key, Comp > & | rhs | ) |
Assignment operator.
It deletes and copies nullEntry_ if applicable.
Definition at line 398 of file namelist.h.
References OSB_LIB::NameList< Key, Comp >::nullEntry_, and OSB_LIB::NameList< Key, Comp >::setNullEntry().
NameList< Key, Comp >::Entry & OSB_LIB::NameList< Key, Comp >::operator[] | ( | const Key & | key | ) | [inline] |
Get the entry for a key.
Creates a new entry if needed.
Definition at line 435 of file namelist.h.
References OSB_LIB::NameList< Key, Comp >::entries_.
void OSB_LIB::NameList< Key, Comp >::setNullEntry | ( | const Entry & | nullEntry | ) |
Set the null entry.
nullEntry | The entry to return from get() if a key is not found. |
Definition at line 441 of file namelist.h.
References OSB_LIB::NameList< Key, Comp >::nullEntry(), and OSB_LIB::NameList< Key, Comp >::nullEntry_.
Referenced by OSB_LIB::NameList< Key, Comp >::NameList(), and OSB_LIB::NameList< Key, Comp >::operator=().
Cont OSB_LIB::NameList< Key, Comp >::entries_ [private] |
Map of entries.
Definition at line 190 of file namelist.h.
Referenced by OSB_LIB::NameList< Key, Comp >::clear(), OSB_LIB::NameList< Key, Comp >::entries(), OSB_LIB::NameList< Key, Comp >::get(), and OSB_LIB::NameList< Key, Comp >::operator[]().
Entry* OSB_LIB::NameList< Key, Comp >::nullEntry_ [mutable, private] |
The default entry, always access via nullEntry().
Definition at line 192 of file namelist.h.
Referenced by OSB_LIB::NameList< Key, Comp >::clear(), OSB_LIB::NameList< Key, Comp >::NameList(), OSB_LIB::NameList< Key, Comp >::nullEntry(), OSB_LIB::NameList< Key, Comp >::operator=(), OSB_LIB::NameList< Key, Comp >::setNullEntry(), and OSB_LIB::NameList< Key, Comp >::~NameList().