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. More...

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

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

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

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

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

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


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 csutil/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 csutil/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 csutil/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 csutil/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 csutil/stringarray.h.

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

Referenced by scfStringArray::FindSortedKey.

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 csutil/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 csutil/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 csutil/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.14