scfStringArray Class Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
scfStringArray Class Reference

This class is a thin wrapper around csStringArray with SCF capability. More...

`#include <csutil/scfstringarray.h>`

Inheritance diagram for scfStringArray:

List of all members.

## Public Member Functions
virtual size_t | Contains (const char *str, bool case_sensitive=true) const
| Alias for Find() and FindCaseInsensitive().
virtual bool | DeleteIndex (size_t n)
| Delete string `n` from the array.
virtual void | Empty ()
| Remove all strings from the array, but does not release the memory allocated.
virtual size_t | Find (const char *value) const
| Find a string, case-sensitive.
virtual size_t | FindCaseInsensitive (const char *value) const
| Find a string, case-insensitive.
virtual size_t | FindSortedKey (const char *value) const
| Find an element based on some key, using a comparison function.
virtual char const * | Get (size_t n) const
| Get a particular string from the array.
virtual size_t | GetSize () const
| Get array length.
virtual bool | Insert (size_t n, char const *value)
| Insert a string before entry `n` in the array.
virtual bool | IsEmpty () const
| Return true if the array is empty.
virtual char * | Pop ()
| Pop an element from tail end of array.
virtual void | Push (char const *value)
| Push a string onto the stack.
virtual void | Put (size_t n, const char *value)
| Insert or reset the element with index `n`.
| scfStringArray (int limit=16, int delta=16)
| Create a iStringArray from scratch.
| scfStringArray (const csStringArray &other)
| Create a string array by copying from a csStringArray.
virtual void | Sort (bool case_sensitive=true)
| Sort array.
virtual | ~scfStringArray ()
| Destructor - nothing to do.

## Detailed Description

This class is a thin wrapper around csStringArray with SCF capability.

Definition at line 33 of file scfstringarray.h.

## Constructor & Destructor Documentation

scfStringArray::scfStringArray | ( | int | limit = `16`,
|  | int | delta = `16`
| ) |  | `[inline]`

Create a iStringArray from scratch.

Definition at line 41 of file scfstringarray.h.

scfStringArray::scfStringArray | ( | const csStringArray & | other | ) | `[inline]`

Create a string array by copying from a csStringArray.

Definition at line 46 of file scfstringarray.h.

virtual scfStringArray::~scfStringArray | ( |  | ) | `[inline, virtual]`

Destructor - nothing to do.

Definition at line 51 of file scfstringarray.h.

## Member Function Documentation

virtual size_t scfStringArray::Contains | ( | const char * | str,
|  | bool | case_sensitive = `true`
| ) |  | const`[inline, virtual]`

Alias for Find() and FindCaseInsensitive().

Parameters:

  str | String to look for in array.
  case_sensitive | If true, consider case when performing comparison. (default: yes)

Returns:
  csArrayItemNotFound if not found, else item index.

Remarks:
  Works with sorted and unsorted arrays, but FindSortedKey() is faster on sorted arrays.
  Some people find Contains() more idiomatic than Find().

Implements iStringArray.

Definition at line 125 of file scfstringarray.h.

virtual bool scfStringArray::DeleteIndex | ( | size_t | n | ) | `[inline, virtual]`

Delete string `n` from the array.

Implements iStringArray.

Definition at line 141 of file scfstringarray.h.

virtual void scfStringArray::Empty | ( |  | ) | `[inline, virtual]`

Remove all strings from the array, but does not release the memory allocated.

Implements iStringArray.

Definition at line 154 of file scfstringarray.h.

virtual size_t scfStringArray::Find | ( | const char * | value | ) | const`[inline, virtual]`

Find a string, case-sensitive.

Returns:
  csArrayItemNotFound if not found, else item index.

Remarks:
  Works with sorted and unsorted arrays, but FindSortedKey() is faster on sorted arrays.

Implements iStringArray.

Definition at line 88 of file scfstringarray.h.

virtual size_t scfStringArray::FindCaseInsensitive | ( | const char * | value | ) | const`[inline, virtual]`

Find a string, case-insensitive.

Returns:
  csArrayItemNotFound if not found, else item index.

Remarks:
  Works with sorted and unsorted arrays, but FindSortedKey() is faster on sorted arrays.

Implements iStringArray.

Definition at line 99 of file scfstringarray.h.

virtual size_t scfStringArray::FindSortedKey | ( | const char * | value | ) | const`[inline, virtual]`

Find an element based on some key, using a comparison function.

Returns:
  csArrayItemNotFound if not found, else item index.

Remarks:
  The array must be sorted.

Implements iStringArray.

Definition at line 109 of file scfstringarray.h.

virtual char const* scfStringArray::Get | ( | size_t | n | ) | const`[inline, virtual]`

Get a particular string from the array.

Implements iStringArray.

Definition at line 77 of file scfstringarray.h.

virtual size_t scfStringArray::GetSize | ( |  | ) | const`[inline, virtual]`

Get array length.

Implements iStringArray.

Definition at line 55 of file scfstringarray.h.

virtual bool scfStringArray::Insert | ( | size_t | n,
|  | char const * | value
| ) |  | `[inline, virtual]`

Insert a string before entry `n` in the array.

Implements iStringArray.

Definition at line 147 of file scfstringarray.h.

virtual bool scfStringArray::IsEmpty | ( |  | ) | const`[inline, virtual]`

Return true if the array is empty.

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

Implements iStringArray.

Definition at line 164 of file scfstringarray.h.

virtual char* scfStringArray::Pop | ( |  | ) | `[inline, virtual]`

Pop an element from tail end of array.

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

Implements iStringArray.

Definition at line 71 of file scfstringarray.h.

virtual void scfStringArray::Push | ( | char const * | value | ) | `[inline, virtual]`

Push a string onto the stack.

Implements iStringArray.

Definition at line 61 of file scfstringarray.h.

virtual void scfStringArray::Put | ( | size_t | n,
|  | const char * | value
| ) |  | `[inline, virtual]`

Insert or reset the element with index `n`.

If the size of the array is smaller than `n` then it will be resized.

Implements iStringArray.

Definition at line 173 of file scfstringarray.h.

virtual void scfStringArray::Sort | ( | bool | case_sensitive = `true` | ) | `[inline, virtual]`

Sort array.

Parameters:

  case_sensitive | If true, consider case when performing comparison. (default: yes)

Implements iStringArray.

Definition at line 135 of file scfstringarray.h.

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

- csutil/scfstringarray.h