Crystal Space: iStringArray Struct Reference (Crystal Space Public API Reference)

| ## Public API Reference

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

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

# iStringArray Struct Reference
[Utilities]

This is an SCF-compatible interface for csStringArray. More...

`#include <iutil/stringarray.h>`

Inheritance diagram for iStringArray:

[legend]
List of all members.

## Public Member Functions
virtual size_t | Contains (const char *str, bool case_sensitive=true) const =0
| Alias for Find() and FindCaseInsensitive().
virtual void | DeleteAll ()=0
| Remove all strings from array.
virtual bool | DeleteIndex (size_t n)=0
| Delete string `n` from the array.
virtual void | Empty ()=0
| Remove all strings from array, releasing allocated memory.
virtual size_t | Find (const char *value) const =0
| Find a string, case-sensitive.
virtual size_t | FindCaseInsensitive (const char *value) const =0
| Find a string, case-insensitive.
virtual size_t | FindSortedKey (const char *value) const =0
| Find an element based on some key, using a comparison function.
virtual char const * | Get (size_t n) const =0
| Get a particular string from the array.
virtual size_t | GetSize () const =0
| Get array length.
virtual bool | Insert (size_t n, char const *value)=0
| Insert a string before entry `n` in the array.
virtual bool | IsEmpty () const =0
| Return true if the array is empty.
virtual size_t | Length () const =0
| Get array length.
virtual char * | Pop ()=0
| Pop an element from tail end of array.
virtual void | Push (const char *value)=0
| Push a string onto the stack.
virtual void | Sort (bool case_sensitive=true)=0
| Sort array.

## Detailed Description

This is an SCF-compatible interface for csStringArray.

Definition at line 33 of file stringarray.h.

## Member Function Documentation

virtual size_t iStringArray::Contains | ( | const char * | str,
|  | bool | case_sensitive = `true` |
| ) |  |  | const`[pure 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().

Implemented in scfStringArray.

virtual void iStringArray::DeleteAll | ( |  | ) | `[pure virtual]`

Remove all strings from array.

Deprecated:
  Use Empty() instead.

Implemented in scfStringArray.

virtual bool iStringArray::DeleteIndex | ( | size_t | n | ) | `[pure virtual]`

Delete string `n` from the array.

Implemented in scfStringArray.

virtual void iStringArray::Empty | ( |  | ) | `[pure virtual]`

Remove all strings from array, releasing allocated memory.

Implemented in scfStringArray.

virtual size_t iStringArray::Find | ( | const char * | value | ) | const`[pure 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.

Implemented in scfStringArray.

virtual size_t iStringArray::FindCaseInsensitive | ( | const char * | value | ) | const`[pure 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.

Implemented in scfStringArray.

virtual size_t iStringArray::FindSortedKey | ( | const char * | value | ) | const`[pure 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.

Implemented in scfStringArray.

virtual char const* iStringArray::Get | ( | size_t | n | ) | const`[pure virtual]`

Get a particular string from the array.

Implemented in scfStringArray.

virtual size_t iStringArray::GetSize | ( |  | ) | const`[pure virtual]`

Get array length.

Implemented in scfStringArray.

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

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

Implemented in scfStringArray.

virtual bool iStringArray::IsEmpty | ( |  | ) | const`[pure virtual]`

Return true if the array is empty.

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

Implemented in scfStringArray.

virtual size_t iStringArray::Length | ( |  | ) | const`[pure virtual]`

Get array length.

Deprecated:
  Use GetSize() instead.

Implemented in scfStringArray.

virtual char* iStringArray::Pop | ( |  | ) | `[pure virtual]`

Pop an element from tail end of array.

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

Implemented in scfStringArray.

virtual void iStringArray::Push | ( | const char * | value | ) | `[pure virtual]`

Push a string onto the stack.

Implemented in scfStringArray.

virtual void iStringArray::Sort | ( | bool | case_sensitive = `true` | ) | `[pure virtual]`

Sort array.

Parameters:

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

Implemented in scfStringArray.

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

- iutil/stringarray.h