| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csStringSet Class Reference

The string set is a collection of unique strings. More...

`#include <csutil/strset.h>`

List of all members.

## 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

  iStringSet

Definition at line 39 of file strset.h.

## Constructor & Destructor Documentation

csStringSet::csStringSet | ( | size_t | size = `23` | ) |

Constructor.

csStringSet::csStringSet | ( | csStringSet const & | s | ) | `[inline]`

Copy constructor.

Definition at line 55 of file strset.h.

csStringSet::~csStringSet | ( |  | ) |

Destructor.

## Member Function Documentation

void csStringSet::Clear | ( |  | ) | `[inline]`

Remove all stored strings.

Deprecated:
  Use Empty() instead.

Definition at line 112 of file strset.h.

bool csStringSet::Contains | ( | csStringID | id | ) | const`[inline]`

Check if the set contains a string with a particular ID.

Remarks:
  This is rigidly equivalent to `return Request(id) != NULL`, but more idomatic.

Definition at line 86 of file strset.h.

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]`

Return an iterator for the set which iterates over all strings.

Warning:
  Modifying the set while you have open iterators will result undefined behaviour.

Definition at line 132 of file strset.h.

size_t csStringSet::GetSize | ( |  | ) | const`[inline]`

Get the number of elements in the hash.

Definition at line 116 of file strset.h.

bool csStringSet::IsEmpty | ( |  | ) | const`[inline]`

Return true if the hash is empty.

Remarks:
  Rigidly equivalent to `return GetSize() == 0`, but more idiomatic.

Definition at line 124 of file strset.h.

csStringSet& csStringSet::operator= | ( | csStringSet const & | s | ) | `[inline]`

Assignment operator.

Definition at line 59 of file strset.h.

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