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

# deString2 Class Reference

`#include <deString.hpp>`

Collaboration diagram for deString2:

[legend]
List of all members.

## Public Types
typedef char | deString_char
enum | string_flag { search_forwards = 0, search_backwards, flag_32bit = 0x7fffffff }
## Public Member Functions
| deString2 ()
| deString2 (const deString_char *ref)
| deString2 (const deString2 &ref)
| ~deString2 ()
void | reserve (long max_size)
void | resize (long size)
long | size () const
| get the length of the string
void | SetCaseSensitivity (deBoolean Sensitive)
const deString_char * | const_str () const
| get a const C-string without creating a copy of the data
deString_char | get_at (long index) const
| get a character at an offset from the start of the string
void | set_at (long index, deString_char ch)
| [write] set a character at an offset from the start of the string
deString2 | operator+ (const deString2 &rhs) const
| create a new string containing this string and another string appended
void | operator+= (const deString2 &rhs)
| [write] append another string onto this one
void | operator+= (const deString_char *str)
| [write] append another string onto this one
void | operator= (const deString2 &rhs)
| [write] assign another string to this one
bool | operator== (const deString2 &rhs) const
| test equality, using current case-sensitivity setting.
bool | operator!= (const deString2 &rhs) const
| test equality, using current case-sensitivity setting.
bool | operator== (const deString_char *rhs) const
| test equality, using current case-sensitivity setting.
bool | operator!= (const deString_char *rhs) const
| test equality, using current case-sensitivity setting.
bool | operator< (const deString2 &rhs) const
| test equality, using current case-sensitivity setting.
bool | operator< (const deString_char *rhs) const
| test equality, using current case-sensitivity setting.
void | Replace (deString_char find, deString_char replace)
| [write] replace all instances of 'find' with 'replace'
long | Find (deString_char find, long start_at=0, string_flag search_order=search_forwards) const
void | Trim (long newsize)
| [write] cut the string down to at most length 'newsize', discarding any characters past that size.
deString2 | DropChars (const deString2 &Chars) const
deString2 | SubString (int start, int stop) const
| retrieve a sub-string over the half-open intervace [start,stop)
void | ToLower ()
| [write] convert this string to lowercase
void | ToUpper ()
| [write] convert this string to uppercase
u32 | Hash () const
## Private Member Functions
void | resizeData (long newlen)
void | OwnBuffer ()
deString_char * | c_str ()
| deString2 (StringData *ref)
## Private Attributes
StringData * | mData
deBoolean | mCaseSensitive

## Detailed Description

A string class that uses a reference-counted inner class to manage the actual data. Making unmodified copies of this class will have negligible impact on memory usage, since they will all point at the same data. A copy-on-write mechanism allocates space only when needed. Methods marked with [write] will cause a copy to be made if more than one reference is held on the data.

## Member Typedef Documentation

typedef char deString2::deString_char

## Member Enumeration Documentation

enum deString2::string_flag

  | Enumeration values:
  search_forwards |
  search_backwards |
  flag_32bit |

## Constructor & Destructor Documentation

deString2::deString2 | ( | StringData * | ref | ) | `[private]`

deString2::deString2 | ( |  | ) |

deString2::deString2 | ( | const deString_char * | ref | ) |

deString2::deString2 | ( | const deString2 & | ref | ) |

deString2::~deString2 | ( |  | ) |

## Member Function Documentation

deString2::deString_char * deString2::c_str | ( |  | ) | `[private]`

const deString_char* deString2::const_str | ( |  | ) | const`[inline]`

| get a const C-string without creating a copy of the data

deString2 deString2::DropChars | ( | const deString2 & | Chars | ) | const

long deString2::Find | ( | deString_char | find,
|  | long | start_at = 0,
|  | string_flag | search_order = search_forwards
| ) | const

| linearly searches for the first instance of 'find', starting at offset 'start_at' and searching in direction according to 'search_order'

deString2::deString_char deString2::get_at | ( | long | index | ) | const

| get a character at an offset from the start of the string

u32 deString2::Hash | ( |  | ) | const

bool deString2::operator!= | ( | const deString_char * | rhs | ) | const

| test equality, using current case-sensitivity setting.

bool deString2::operator!= | ( | const deString2 & | rhs | ) | const

| test equality, using current case-sensitivity setting.

deString2 deString2::operator+ | ( | const deString2 & | rhs | ) | const

| create a new string containing this string and another string appended

void deString2::operator+= | ( | const deString_char * | str | ) |

| [write] append another string onto this one

void deString2::operator+= | ( | const deString2 & | rhs | ) |

| [write] append another string onto this one

bool deString2::operator< | ( | const deString_char * | rhs | ) | const

| test equality, using current case-sensitivity setting.

bool deString2::operator< | ( | const deString2 & | rhs | ) | const

| test equality, using current case-sensitivity setting.

void deString2::operator= | ( | const deString2 & | rhs | ) |

| [write] assign another string to this one

bool deString2::operator== | ( | const deString_char * | rhs | ) | const

| test equality, using current case-sensitivity setting.

bool deString2::operator== | ( | const deString2 & | rhs | ) | const

| test equality, using current case-sensitivity setting.

void deString2::OwnBuffer | ( |  | ) | `[private]`

void deString2::Replace | ( | deString_char | find,
|  | deString_char | replace
| ) |

| [write] replace all instances of 'find' with 'replace'

void deString2::reserve | ( | long | max_size | ) |

void deString2::resize | ( | long | size | ) |

void deString2::resizeData | ( | long | newlen | ) | `[private]`

void deString2::set_at | ( | long | index,
|  | deString_char | ch
| ) |

| [write] set a character at an offset from the start of the string

void deString2::SetCaseSensitivity | ( | deBoolean | Sensitive | ) | `[inline]`

long deString2::size | ( |  | ) | const`[inline]`

| get the length of the string

deString2 deString2::SubString | ( | int | start,
|  | int | stop
| ) | const

| retrieve a sub-string over the half-open intervace [start,stop)

void deString2::ToLower | ( |  | ) |

| [write] convert this string to lowercase

void deString2::ToUpper | ( |  | ) |

| [write] convert this string to uppercase

void deString2::Trim | ( | long | newsize | ) |

| [write] cut the string down to at most length 'newsize', discarding any characters past that size.

## Member Data Documentation

deBoolean deString2::mCaseSensitive`[private]`

StringData* deString2::mData`[private]`

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

- deString.hpp
- deString.cpp