CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csStringArray Class Reference

An array of strings. More...

#include <stringarray.h>

Inheritance diagram for csStringArray:

csArray< const char *, csStringArrayElementHandler > List of all members.

Public Methods

 csStringArray (int ilimit=0, int ithreshold=0)
 Initialize object to hold initially 'ilimit' elements, and increase storage by 'ithreshold' each time the upper bound is exceeded.

void Sort (ArraySortCompareFunction *compare)
 Sort array based on case sensitive string compare function.

void Sort ()
 Sort array based on case sensitive string compare function.

int FindSortedKey (void *key, ArrayCompareKeyFunction *comparekey=CaseSensitiveCompareKey, int *candidate=0) const
 Find an element based on some key, using a csArrayCompareKeyFunction.

char * Pop ()
 Pop an element from tail end of array.

int Find (const char *what) const
 Find a string, case-sensitive.

int FindCaseInsensitive (const char *what) const
 Find a string, case-insensitive.

int InsertSorted (const char *const &newstr, ArrayCompareFunction *compare=CaseSensitiveCompare, int *equal_index=0)
 Insert a string element at a sorted position, using a specialized csArrayCompareFunction.


Detailed Description

An array of strings.

This array will properly make copies of the strings and delete those copies using delete[] later.

Definition at line 50 of file stringarray.h.


Constructor & Destructor Documentation

csStringArray::csStringArray int    ilimit = 0,
int    ithreshold = 0
[inline]
 

Initialize object to hold initially 'ilimit' elements, and increase storage by 'ithreshold' each time the upper bound is exceeded.

Definition at line 58 of file stringarray.h.


Member Function Documentation

int csStringArray::Find const char *    what const [inline]
 

Find a string, case-sensitive.

Returns -1 if not found, else item index. Works with unsorted arrays. For sorted arrays, FindSortedKey() is faster.

Definition at line 139 of file stringarray.h.

References csArray< const char *, csStringArrayElementHandler >::Get(), and csArray< const char *, csStringArrayElementHandler >::Length().

Referenced by scfStringArray::Find().

int csStringArray::FindCaseInsensitive const char *    what const [inline]
 

Find a string, case-insensitive.

Returns -1 if not found, else item index. Works with unsorted arrays. For sorted arrays, FindSortedKey() is faster.

Definition at line 151 of file stringarray.h.

References csArray< const char *, csStringArrayElementHandler >::Get(), and csArray< const char *, csStringArrayElementHandler >::Length().

Referenced by scfStringArray::FindCaseInsensitive().

int csStringArray::FindSortedKey void *    key,
ArrayCompareKeyFunction   comparekey = CaseSensitiveCompareKey,
int *    candidate = 0
const [inline]
 

Find an element based on some key, using a csArrayCompareKeyFunction.

The array must be sorted. Returns -1 if element does not exist.

Reimplemented from csArray< const char *, csStringArrayElementHandler >.

Definition at line 115 of file stringarray.h.

References csArray< const char *, csStringArrayElementHandler >::ArrayCompareKeyFunction.

Referenced by scfStringArray::FindSortedKey().

int csStringArray::InsertSorted const char *const &    newstr,
ArrayCompareFunction   compare = CaseSensitiveCompare,
int *    equal_index = 0
[inline]
 

Insert a string element at a sorted position, using a specialized csArrayCompareFunction.

Assumes array is already sorted.

Definition at line 163 of file stringarray.h.

References csArray< const char *, csStringArrayElementHandler >::ArrayCompareFunction.

char* csStringArray::Pop   [inline]
 

Pop an element from tail end of array.

Caller is responsible for invoking delete[] on the returned string when no longer needed.

Reimplemented from csArray< const char *, csStringArrayElementHandler >.

Definition at line 125 of file stringarray.h.

References csArray< const char *, csStringArrayElementHandler >::Get(), csArray< const char *, csStringArrayElementHandler >::InitRegion(), csArray< const char *, csStringArrayElementHandler >::Length(), and csArray< const char *, csStringArrayElementHandler >::SetLength().

Referenced by scfStringArray::Pop().

void csStringArray::Sort   [inline]
 

Sort array based on case sensitive string compare function.

Definition at line 106 of file stringarray.h.

void csStringArray::Sort ArraySortCompareFunction *    compare [inline]
 

Sort array based on case sensitive string compare function.

Reimplemented from csArray< const char *, csStringArrayElementHandler >.

Definition at line 98 of file stringarray.h.

Referenced by scfStringArray::Sort().


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.18