CrystalSpace

Public API Reference

csScfStringSet Class Reference

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

#include <csutil/scfstrset.h>

Inherits scfImplementation1< csScfStringSet, iStringSet >.

List of all members.

Public Member Functions

virtual void Clear ()
 Remove all stored strings.
virtual bool Contains (char const *s) const
 Check if the set contains a particular string.
virtual bool Contains (csStringID id) const
 Check if the set contains a string with a particular ID.
 csScfStringSet (size_t size=23)
 Constructor.
virtual bool Delete (csStringID id)
 Remove a string with the specified ID.
virtual bool Delete (char const *s)
 Remove specified string.
virtual void Empty ()
 Remove all stored strings.
virtual size_t GetSize () const
 Get the number of elements in the hash.
virtual bool IsEmpty () const
 Return true if the hash is empty.
virtual const char * Request (csStringID id) const
 Request the string corresponding to the given ID.
virtual csStringID Request (const char *s)
 Request the numeric ID for the given string.
virtual ~csScfStringSet ()
 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.

Definition at line 42 of file scfstrset.h.


Constructor & Destructor Documentation

csScfStringSet::csScfStringSet ( size_t  size = 23  )  [inline]

Constructor.

Definition at line 50 of file scfstrset.h.

virtual csScfStringSet::~csScfStringSet (  )  [inline, virtual]

Destructor.

Definition at line 55 of file scfstrset.h.


Member Function Documentation

virtual void csScfStringSet::Clear (  )  [inline, virtual]

Remove all stored strings.

Definition at line 113 of file scfstrset.h.

virtual bool csScfStringSet::Contains ( char const *  s  )  const [inline, virtual]

Check if the set contains a particular string.

Definition at line 78 of file scfstrset.h.

virtual bool csScfStringSet::Contains ( csStringID  id  )  const [inline, virtual]

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 scfstrset.h.

virtual bool csScfStringSet::Delete ( char const *  s  )  [inline, virtual]

Remove specified string.

Returns:
True if a matching string was in thet set; else false.

Definition at line 93 of file scfstrset.h.

virtual bool csScfStringSet::Delete ( csStringID  id  )  [inline, virtual]

Remove a string with the specified ID.

Returns:
True if a matching string was in thet set; else false.

Definition at line 100 of file scfstrset.h.

virtual void csScfStringSet::Empty (  )  [inline, virtual]

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.

Definition at line 107 of file scfstrset.h.

virtual size_t csScfStringSet::GetSize (  )  const [inline, virtual]

Get the number of elements in the hash.

Definition at line 117 of file scfstrset.h.

virtual bool csScfStringSet::IsEmpty (  )  const [inline, virtual]

Return true if the hash is empty.

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

Definition at line 125 of file scfstrset.h.

virtual csStringID csScfStringSet::Request ( const char *  s  )  [inline, virtual]

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.

Definition at line 64 of file scfstrset.h.

virtual const char* csScfStringSet::Request ( csStringID  id  )  const [inline, virtual]

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.

Definition at line 72 of file scfstrset.h.


The documentation for this class was generated from the following file:

Generated for Crystal Space 1.4.1 by doxygen 1.7.1