class skString

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

Public Methods

skString()
Default Constructor - constructs a blank string
skString(const char *)
Constructor - from a null-terminated c-string
skString(const unsigned char *)
Constructor - from a null-terminated c-string
skString(const skString&)
Copy Constructor
skString(const unsigned char * buffer, USize len)
Constructor - from a non null-terminated buffer
skString(const unsigned char repeatChar, USize len)
Constructor - a repeated list of characters
virtual ~skString()
Destructor
skString& operator=(const skString&)
Assignment operator - increments reference count of underlying P_String object
skString& operator=(const unsigned char *)
Assignment operator - dereferences the P_String object and makes a new one by copying the given buffer
skString& operator=(const char *)
Assignment operator - dereferences the P_String object and makes a new one by copying the given buffer
bool operator<(const skString&) const
Comparison operator
bool operator==(const skString&) const
Equality operator
bool operator==(const unsigned char *) const
Equality operator
bool operator==(const char *) const
Equality operator
bool operator!=(const skString&) const
Inequality operator
bool operator!=(const char *) const
Inequality operator
bool operator!=(const unsigned char *) const
Inequality operator
operator const unsigned char * () const
Conversion operator
operator const char * () const
Conversion operator
USize hash() const
Returns a hash value for this string
unsigned char at(USize index) const
Returns a character within the string
skString substr(USize start, USize length) const
Returns a substring of this string
skString substr(USize start) const
Returns the substring from the start up to the end of the current string
skString operator+(const skString&) const
Addition operator
skString& operator+=(const skString&)
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(char c)
returns the index of the first 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
static skString literal(const char *)
Constructs a string from static string - the static string is *not* copied
static skString from(int)
Constructs a string from a signed integer
static skString from(USize)
Constructs a string from an unsigned integer
static skString from(float)
Constructs a string from a float
static skString from(unsigned char ch)
Constructs a string from a character
static skString fromBuffer(unsigned char * buffer)
Constructs a string from a buffer, which is *not* copied

Protected Fields

P_String* pimp
The underlying string object

Protected Methods

skString(P_String *)
Constructor - internal taking a P_String and not copying it
skString(const unsigned char * s, int)
Constructor - internal, taking a buffer and not copying it
void assign(const unsigned 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

Documentation

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
skString()
Default Constructor - constructs a blank string

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

skString(const unsigned char *)
Constructor - from a null-terminated c-string

skString(const skString&)
Copy Constructor

skString(const unsigned char * buffer, USize len)
Constructor - from a non null-terminated buffer
Parameters:
buffer - - the buffer to be copied from
len - - the length of the data to be copied

skString(const unsigned char repeatChar, USize len)
Constructor - a repeated list of characters
Parameters:
repeatChar - - the character to be repeated
len - - the number of times the character is repeated

virtual ~skString()
Destructor

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

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

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

bool operator<(const skString&) const
Comparison operator
Returns:
true if the current string is alphabetically before the other string

bool operator==(const skString&) const
Equality operator
Returns:
true if the other string is the same as the current one

bool operator==(const unsigned char *) const
Equality operator
Returns:
true if the other c-string is the same as the current one

bool operator==(const char *) const
Equality operator
Returns:
true if the other c-string is the same as the current one

bool operator!=(const skString&) const
Inequality operator
Returns:
true if the other string is different to the current one

bool operator!=(const char *) const
Inequality operator
Returns:
true if the other c-string is different to the current one

bool operator!=(const unsigned char *) const
Inequality operator
Returns:
true if the other c-string is different to the current one

operator const unsigned char * () const
Conversion operator
Returns:
a pointer to the buffer contained within the P_String object

operator const char * () const
Conversion operator
Returns:
a pointer to the buffer contained within the P_String object

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

unsigned char at(USize index) const
Returns a character within the string
Returns:
the character, or 0 if the index does not lie within the length of the string
Parameters:
index - - the index of the character, starting at 0

skString substr(USize start, USize length) const
Returns a substring of this string
Returns:
a new String for the substring, or a blank string if the start and length do not lie within the current string
Parameters:
start - - the 0-based start of the substring
length - - the length of the substring

skString substr(USize start) const
Returns the substring from the start up to the end of the current string
Returns:
a new String for the substring, or a blank string if the start does not lie within the current string
Parameters:
start - - the 0-based start of the substring

skString operator+(const skString&) const
Addition operator
Returns:
a String that contains this string followed by the other string

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

USize length() const
Length of the string
Returns:
the length of the buffer in the P_String object

int indexOf(char c)
returns the index of the first occurrence of the given character within the string
Returns:
an index, or -1 if not found

int to() const
Converts the string to an integer

float toFloat() const
Converts the string to a float

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

static skString from(int)
Constructs a string from a signed integer

static skString from(USize)
Constructs a string from an unsigned integer

static skString from(float)
Constructs a string from a float

static skString from(unsigned char ch)
Constructs a string from a character

static skString fromBuffer(unsigned char * buffer)
Constructs a string from a buffer, which is *not* copied. The string will delete the buffer when the reference count reaches zero

skString(P_String *)
Constructor - internal taking a P_String and not copying it

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

void assign(const unsigned 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

P_String* pimp
The underlying string object


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de