Abstract interface for looking up strings/CLIDs in a pool.
More...
#include <IStringPool.h>
|
| virtual | ~IStringPool () |
| | Destructor.
|
| virtual sgkey_t | stringToKey (const std::string &str, CLID clid)=0 |
| | Find the key for a string/CLID pair.
|
| virtual const std::string * | keyToString (sgkey_t key) const =0 |
| | Find the string corresponding to a given key.
|
| virtual const std::string * | keyToString (sgkey_t key, CLID &clid) const =0 |
| | Find the string and CLID corresponding to a given key.
|
| virtual void | registerKey (sgkey_t key, const std::string &str, CLID clid)=0 |
| | Remember an additional mapping from key to string/CLID.
|
Abstract interface for looking up strings/CLIDs in a pool.
Definition at line 27 of file IStringPool.h.
◆ sgkey_t
◆ ~IStringPool()
| virtual IStringPool::~IStringPool |
( |
| ) |
|
|
inlinevirtual |
◆ keyToString() [1/2]
| virtual const std::string * IStringPool::keyToString |
( |
sgkey_t | key | ) |
const |
|
pure virtual |
Find the string corresponding to a given key.
- Parameters
-
- Returns
- Pointer to the string found, or null. We can find keys as long as the corresponding string was given to either
stringToKey() or registerKey().
◆ keyToString() [2/2]
| virtual const std::string * IStringPool::keyToString |
( |
sgkey_t | key, |
|
|
CLID & | clid ) const |
|
pure virtual |
Find the string and CLID corresponding to a given key.
- Parameters
-
| key | The key to look up. |
| clid[out] | The found CLID. |
- Returns
- Pointer to the string found, or null. We can find keys as long as the corresponding string was given to either
stringToKey() or registerKey().
◆ registerKey()
| virtual void IStringPool::registerKey |
( |
sgkey_t | key, |
|
|
const std::string & | str, |
|
|
CLID | clid ) |
|
pure virtual |
Remember an additional mapping from key to string/CLID.
- Parameters
-
| key | The key to enter. |
| str | The string to enter. |
| clid | The CLID associated with the string. |
- Returns
- True if successful; false if the
key already corresponds to a different string.
This registers an additional mapping from a key to a string; it can be found later through lookup() on the string. Logs an error if key already corresponds to a different string.
◆ stringToKey()
| virtual sgkey_t IStringPool::stringToKey |
( |
const std::string & | str, |
|
|
CLID | clid ) |
|
pure virtual |
Find the key for a string/CLID pair.
- Parameters
-
| str | The string to look up. |
| clid | The CLID associated with the string. |
- Returns
- A key identifying the string. A given string will always return the same key. Will abort in case of a hash collision!
The documentation for this class was generated from the following file: