csStringSet Class Reference
The string set is a collection of unique strings. More...
#include <csutil/strset.h>
Public Types | |
typedef csStringHash::GlobalIterator | GlobalIterator |
Public Member Functions | |
void | Clear () |
Remove all stored strings. | |
bool | Contains (csStringID id) const |
Check if the set contains a string with a particular ID. | |
bool | Contains (char const *) const |
Check if the set contains a particular string. | |
csStringSet (csStringSet const &s) | |
Copy constructor. | |
csStringSet (size_t size=23) | |
Constructor. | |
bool | Delete (csStringID id) |
Remove a string with the specified ID. | |
bool | Delete (char const *s) |
Remove specified string. | |
void | Empty () |
Remove all stored strings. | |
GlobalIterator | GetIterator () const |
Return an iterator for the set which iterates over all strings. | |
size_t | GetSize () const |
Get the number of elements in the hash. | |
bool | IsEmpty () const |
Return true if the hash is empty. | |
csStringSet & | operator= (csStringSet const &s) |
Assignment operator. | |
char const * | Request (csStringID) const |
Request the string corresponding to the given ID. | |
csStringID | Request (const char *) |
Request the numeric ID for the given string. | |
~csStringSet () | |
Destructor. |
Detailed Description
The string set is a collection of unique strings.Each string has an ID number. The most important operation is to request a string, which means to return the ID for the string, adding it to the collection if not already present. This is useful when you need to work with strings but want the performance characteristics of simple numeric comparisons. Rather than performing string comparisons, you instead compare the numeric string ID's.
- See also:
- csStringHash
Definition at line 39 of file strset.h.
Constructor & Destructor Documentation
csStringSet::csStringSet | ( | size_t | size = 23 |
) |
Constructor.
csStringSet::csStringSet | ( | csStringSet const & | s | ) | [inline] |
csStringSet::~csStringSet | ( | ) |
Destructor.
Member Function Documentation
void csStringSet::Clear | ( | ) | [inline] |
bool csStringSet::Contains | ( | csStringID | id | ) | const [inline] |
bool csStringSet::Contains | ( | char const * | ) | const |
Check if the set contains a particular string.
bool csStringSet::Delete | ( | csStringID | id | ) |
Remove a string with the specified ID.
- Returns:
- True if a matching string was in thet set; else false.
bool csStringSet::Delete | ( | char const * | s | ) |
Remove specified string.
- Returns:
- True if a matching string was in thet set; else false.
void csStringSet::Empty | ( | ) |
Remove all stored strings.
When new strings are registered again, new ID values will be used; the old ID's will not be re-used.
GlobalIterator csStringSet::GetIterator | ( | ) | const [inline] |
size_t csStringSet::GetSize | ( | ) | const [inline] |
bool csStringSet::IsEmpty | ( | ) | const [inline] |
csStringSet& csStringSet::operator= | ( | csStringSet const & | s | ) | [inline] |
char const* csStringSet::Request | ( | csStringID | ) | const |
Request the string corresponding to the given ID.
- Returns:
- Null if the string * has not been requested (yet), else the string corresponding to the ID.
csStringID csStringSet::Request | ( | const char * | ) |
Request the numeric ID for the given string.
- Returns:
- The ID of the string.
- Remarks:
- Creates a new ID if the string is not yet present in the set, else returns the previously assigned ID.
The documentation for this class was generated from the following file:
- csutil/strset.h
Generated for Crystal Space by doxygen 1.4.7