class String

String is a reference counted, copy on write string class More...

Definition#include <sysadm/String.h>
InheritsHashable
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Members


Detailed Description

String is a reference counted, copy on write string class

 String (void)

NOTE: the void constructor gives a string with a NULL value as opposed to an empty string. To build an empty String, use String("").

 String (const char* string)

 String (const String& string)

 String (unsigned int initialBufferSize)

 String (unsigned int initialBufferSize, const char fill)

 String (const char* string, unsigned int length)

String (void)

[virtual]

String&  operator= (const String& string)

Reimplemented from Hashable.

HashValue  getHashValue (void)

[const virtual]

Reimplemented from Hashable.

Hashable*  clone ()

[const virtual]

Reimplemented from Hashable.

unsigned int  getLength (bool force = false)

[const]

getLength() returns the length of the string (like strlen).

An attempt is made to cache the length of the string, so the value returned by this method can be wrong if a writable char* is used to change the string multiple times combined with multiple uses of getLength(); Calling with force = true can be used in these cases to ensure the correct value at the cost of performance.

 operator const char* (void)

[const]

char*  writableCharPtr (void)

We can't use operator char*() since it will prevent operator const char*() from being used most of the time. Hence, we provide a functional interface for getting a pointer to the non-const characters.

char&  operator[] (CharIndex index)

These two array operators function on logical characters in the string. These take into account multi-byte issues. XXX: I don't think that multi-byte is handled.

char  operator[] (CharIndex index)

[const]

bool  operator== (const Hashable & other)

[const virtual]

Reimplemented from Hashable.

bool  operator!= (const Hashable & other)

[const virtual]

Reimplemented from Hashable.

bool  isSame ( const String& other)

[const]

bool  operator== (const String& other)

[const]

Reimplemented from Hashable.

bool  operator!= (const String& other)

[const]

Reimplemented from Hashable.

bool  operator< (const String& other)

[const]

bool  operator> (const String& other)

[const]

bool  operator<= (const String& other)

[const]

bool  operator>= (const String& other)

[const]

bool  isSame ( const char* other)

[const]

bool  operator== (const char* other)

[const]

Reimplemented from Hashable.

bool  operator!= (const char * other)

[const]

Reimplemented from Hashable.

bool  operator< (const char * other)

[const]

bool  operator> (const char * other)

[const]

bool  operator<= (const char * other)

[const]

bool  operator>= (const char * other)

[const]

String  operator+ (const String& string)

[const]

String&  operator+= (const String& string)

String  operator+ (const char* string)

[const]

String&  operator+= (const char* string)

CharIndex  find (const char toFind, CharIndex startIndex = 0, bool reverse = false)

[const]

CharIndex  find (const String& toFind, CharIndex startIndex = 0, bool reverse = false )

[const]

static CharIndex NotFound

String  getSubString (CharIndex startIndex, CharIndex endIndex)

[const]

Returns a new string that is a substring of this string. The substring begins at "startIndex" and extends to the character index at "endIndex - 1".

void  toLowerCase (void)

void  toUpperCase (void)

long  asLong (int base = 10)

[const]

double  asDouble (void)

[const]

void  fromNum ( long num )

void  fromNum ( double num )

static const String NUL

A "null" string, as opposed to an empty string. Useful for methods which return an String& to distinguish between "no string" and "emtpy string". For example, const String& str = func(); if (str == String::NUL) no_return_value();

static const String EMPTY

The empty string, encourages string sharing


Generated by: rusty@irem on Mon Sep 18 18:07:52 2000, using kdoc 2.0a36.