|
stmm-games-doc
0.32.0
|
Named objects indexed template class. More...

Public Member Functions | |
| NamedObjIndex () noexcept | |
| Constructor. More... | |
| NamedObjIndex (const NamedObjIndex< T > &oSource) noexcept | |
| NamedObjIndex (NamedObjIndex< T > &&oSource) noexcept | |
| int32_t | size () const noexcept |
| The number names in the named object index. More... | |
| bool | isIndex (int32_t nIndex) const noexcept |
| Whether an index is associated with a named object. More... | |
| const std::string & | getName (int32_t nIndex) const noexcept |
| Get the name associated with an index. More... | |
| const T & | getObj (int32_t nIndex) const noexcept |
| Get the object associated with the index. More... | |
| int32_t | addNamedObj (const std::string &sName, const T &oT) noexcept |
| Add a named object. More... | |
| int32_t | addNamedObj (std::string &&sName, T &&oT) noexcept |
| Add a named object. More... | |
| int32_t | getIndex (const std::string &sName) const noexcept |
| The index associated with a name. More... | |
| int32_t | findIndexNameStarts (const std::string &sStartOfName) const noexcept |
| Find the first index with a name that starts with a string. More... | |
Protected Member Functions | |
| NamedObjIndex< T > & | operator= (const NamedObjIndex< T > &oSource) noexcept |
| NamedObjIndex< T > & | operator= (NamedObjIndex< T > &&oSource) noexcept |
| T & | getModifiableObj (int32_t nIndex) noexcept |
| Get the modifiable object associated with the index. More... | |
| void | clear () noexcept |
| Clear all objects. More... | |
Named objects indexed template class.
This class allows to uniquely associate a string with a number so that the number can be used to get the object instead of the string.
Uniqueness of the stored objects is not enforced. The requirements to objects (the template parameter class) is the same as for the objects in a std::vector.
|
noexcept |
Constructor.
|
noexcept |
|
noexcept |
|
noexcept |
Add a named object.
If the name already exists the object is not overwritten. To do so use getModifiableObj().
| sName | The name. Cannot be empty. |
| oT | The object. |
|
noexcept |
Add a named object.
If the name already exists the object is not overwritten. To do so use getModifiableObj().
| sName | The name. Cannot be empty. |
| oT | The object. |
|
protectednoexcept |
Clear all objects.
|
noexcept |
Find the first index with a name that starts with a string.
| sStartOfName | The starting string. Cannot be empty. |
|
noexcept |
The index associated with a name.
| sName | The name. Cannot be empty. |
|
protectednoexcept |
Get the modifiable object associated with the index.
If you need this function to be public use class AssignableNamedObjIndex.
| nIndex | The index. Must be >= 0 and < size(). |
|
noexcept |
Get the name associated with an index.
| nIndex | The index. Must be >= 0 and < size(). |
|
noexcept |
Get the object associated with the index.
| nIndex | The index. Must be >= 0 and < size(). |
|
inlinenoexcept |
Whether an index is associated with a named object.
| nIndex | The index. |
|
protectednoexcept |
|
protectednoexcept |
|
inlinenoexcept |
The number names in the named object index.
1.8.13