Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

skAsciiString Class Reference

This class encapsulates a null-terminated 8-bit c-string It uses a pointer to a string plus a reference count to save copying when passed by value. More...

#include <skAsciiString.h>

List of all members.

Public Member Functions

 skAsciiString ()
 Default Constructor - constructs a blank string.

 skAsciiString (const char *)
 Constructor - from a null-terminated c-string.

 skAsciiString (const skAsciiString &)
 Copy Constructor.

 skAsciiString (const char *buffer, USize len)
 Constructor - from a non null-terminated buffer.

 skAsciiString (const char repeatchar, USize len)
 Constructor - a repeated list of characters.

virtual ~skAsciiString ()
 Destructor.

skAsciiString & operator= (const skAsciiString &)
 Assignment operator - increments reference count of underlying P_String object.

skAsciiString & operator= (const char *)
 Assignment operator - dereferences the P_String object and makes a new one by copying the given buffer.

bool operator< (const skAsciiString &) const
 Comparison operator.

bool operator== (const skAsciiString &) const
 Equality operator.

bool operator== (const char *) const
 Equality operator.

bool operator!= (const skAsciiString &) const
 Inequality operator.

bool operator!= (const char *) const
 Inequality operator.

 operator const char * () const
 Conversion operator.

const char * c_str () const
 Accesses underlying buffer.

USize hash () const
 Returns a hash value for this string.

char at (USize index) const
 Returns a character within the string.

skAsciiString substr (USize start, USize length) const
 Returns a substring of this string.

skAsciiString substr (USize start) const
 Returns the substring from the start up to the end of the current string.

skAsciiString operator+ (const skAsciiString &) const
 Addition operator.

skAsciiString & operator+= (const skAsciiString &)
 Increment operator - dereferences the P_String object, and replaces it with the concatenation of this string and the other one.

USize length () const
 Length of the string.

int indexOf (const skAsciiString &s) const
 returns the index of the first occurrence of the given string within the string

int indexOf (char c) const
 returns the index of the first occurrence of the given character within the string

int indexOfLast (char c) const
 returns the index of the last occurrence of the given character within the string

int to () const
 Converts the string to an integer.

float toFloat () const
 Converts the string to a float.

skAsciiString ltrim () const
 returns a version of this string with leading blanks removed


Static Public Member Functions

skAsciiString literal (const char *)
 Constructs a string from static string - the static string is *not* copied.

skAsciiString from (int)
 Constructs a string from a signed integer.

skAsciiString from (USize)
 Constructs a string from an unsigned integer.

skAsciiString from (float)
 Constructs a string from a float.

skAsciiString from (char ch)
 Constructs a string from a character.

skAsciiString fromBuffer (char *buffer)
 Constructs a string from a buffer, which is *not* copied.


Protected Member Functions

 skAsciiString (P_AsciiString *)
 Constructor - internal taking a P_String and not copying it.

 skAsciiString (const char *s, int)
 Constructor - internal, taking a buffer and not copying it.

void assign (const char *, int len=0)
 Assigns another buffer to this one, and copies it.

void deRef ()
 Dereferences the P_String object, deleting it if the reference count is zero.


Protected Attributes

P_AsciiString * pimp
 The underlying string object.


Detailed Description

This class encapsulates a null-terminated 8-bit c-string It uses a pointer to a string plus a reference count to save copying when passed by value.


Constructor & Destructor Documentation

skAsciiString::skAsciiString const char *   ) 
 

Constructor - from a null-terminated c-string.

Remarks:
not available in Symbian version

skAsciiString::skAsciiString const char *  buffer,
USize  len
 

Constructor - from a non null-terminated buffer.

Remarks:
not available in Symbian version
Parameters:
buffer - the buffer to be copied from
len - the length of the data to be copied

skAsciiString::skAsciiString const char  repeatchar,
USize  len
 

Constructor - a repeated list of characters.

Remarks:
not available in Symbian version
Parameters:
repeatchar - the character to be repeated
len - the number of times the character is repeated

skAsciiString::skAsciiString const char *  s,
int 
[protected]
 

Constructor - internal, taking a buffer and not copying it.

Remarks:
not available in Symbian version


Member Function Documentation

char skAsciiString::at USize  index  )  const [inline]
 

Returns a character within the string.

Parameters:
index - the index of the character, starting at 0
Returns:
the character, or 0 if the index does not lie within the length of the string

const char * skAsciiString::c_str  )  const [inline]
 

Accesses underlying buffer.

Returns:
a pointer to the buffer contained within the P_String object

skAsciiString skAsciiString::fromBuffer char *  buffer  )  [static]
 

Constructs a string from a buffer, which is *not* copied.

The string will delete the buffer when the reference count reaches zero

int skAsciiString::indexOf char  c  )  const
 

returns the index of the first occurrence of the given character within the string

Returns:
an index, or -1 if not found

int skAsciiString::indexOf const skAsciiString &  s  )  const
 

returns the index of the first occurrence of the given string within the string

Returns:
an index, or -1 if not found

int skAsciiString::indexOfLast char  c  )  const
 

returns the index of the last occurrence of the given character within the string

Returns:
an index, or -1 if not found

USize skAsciiString::length  )  const [inline]
 

Length of the string.

Returns:
the length of the buffer in the P_String object

skAsciiString::operator const char *  )  const [inline]
 

Conversion operator.

Remarks:
not available in Symbian version
Returns:
a pointer to the buffer contained within the P_String object

bool skAsciiString::operator!= const char *   )  const
 

Inequality operator.

Returns:
true if the other c-string is different to the current one

bool skAsciiString::operator!= const skAsciiString &   )  const
 

Inequality operator.

Returns:
true if the other string is different to the current one

skAsciiString skAsciiString::operator+ const skAsciiString &   )  const
 

Addition operator.

Returns:
a String that contains this string followed by the other string
Exceptions:
Symbian - a leaving function

skAsciiString & skAsciiString::operator+= const skAsciiString &   ) 
 

Increment operator - dereferences the P_String object, and replaces it with the concatenation of this string and the other one.

Returns:
this string
Exceptions:
Symbian - a leaving function

bool skAsciiString::operator< const skAsciiString &   )  const [inline]
 

Comparison operator.

Returns:
true if the current string is alphabetically before the other string

skAsciiString & skAsciiString::operator= const char *   ) 
 

Assignment operator - dereferences the P_String object and makes a new one by copying the given buffer.

Exceptions:
Symbian - a leaving function

skAsciiString & skAsciiString::operator= const skAsciiString &   )  [inline]
 

Assignment operator - increments reference count of underlying P_String object.

Exceptions:
Symbian - a leaving function

bool skAsciiString::operator== const char *   )  const [inline]
 

Equality operator.

Returns:
true if the other c-string is the same as the current one

bool skAsciiString::operator== const skAsciiString &   )  const [inline]
 

Equality operator.

Returns:
true if the other string is the same as the current one

skAsciiString skAsciiString::substr USize  start  )  const
 

Returns the substring from the start up to the end of the current string.

Parameters:
start - the 0-based start of the substring
Returns:
a new String for the substring, or a blank string if the start does not lie within the current string
Exceptions:
Symbian - a leaving function

skAsciiString skAsciiString::substr USize  start,
USize  length
const
 

Returns a substring of this string.

Parameters:
start - the 0-based start of the substring
length - the length of the substring
Returns:
a new String for the substring, or a blank string if the start and length do not lie within the current string
Exceptions:
Symbian - a leaving function


The documentation for this class was generated from the following files:
Generated on Fri Dec 17 20:27:34 2004 for Simkin by doxygen1.3