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

skString 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 <skString.h>

Inheritance diagram for skString:

List of all members.

Public Member Functions

 skString ()
 Default Constructor - constructs a blank string.

 skString (const skString &)
 Copy Constructor.

virtual ~skString ()
 Destructor.

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

IMPORT_C skString & operator= (Char c)
 Assigns a character.

IMPORT_C 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 Char *) const
 Equality operator.

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

IMPORT_C bool operator!= (const skString &) const
 Inequality operator.

IMPORT_C bool operator!= (const Char *) const
 Inequality operator.

skString & operator= (const TDesC &)
 Assignment operator from a Symbian descriptor.

TPtrC ptr () const
 Accesses underlying buffer.

const Char * c_str () const
 Accesses underlying buffer.

IMPORT_C bool equalsIgnoreCase (const skString &) const
 Case-insensitive equality.

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

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

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

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

IMPORT_C skString operator+ (const skString &) const
 Addition operator.

IMPORT_C 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.

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

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

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

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

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

skString IMPORT_C ltrim () const
skString IMPORT_C removeInitialBlankLines () const
 This method removes any initial blank lines from the given string.

IMPORT_C skString replace (const skString &old_substr, const skString &new_substr) const
 Replaces a substring with another.

IMPORT_C skString replace (const Char *old_substr, const Char *new_substr) const
 Replaces a substring with another.

IMPORT_C skString replace (const TDesC &old_substr, const TDesC &new_substr) const
 Replaces a substring with another.

IMPORT_C void replaceInPlace (Char old_char, Char new_char)
 This method replaces a character with a different one within this string.

 operator TCleanupItem ()
 Conversion operator to Symbian TCleanupItem.


Static Public Member Functions

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

IMPORT_C skString from (int)
 Constructs a string from a signed integer.

IMPORT_C skString from (USize)
 Constructs a string from an unsigned integer.

IMPORT_C skString from (float)
 Constructs a string from a float.

IMPORT_C skString from (Char ch)
 Constructs a string from a character.

IMPORT_C skString fromBuffer (Char *buffer)
 Constructs a string from a buffer, which is *not* copied.

IMPORT_C skString copyFromBuffer (const Char *buffer, USize length)
 Constructs a string from the subset of a buffer, the contents are copied.

IMPORT_C skString addStrings (const skString &s1, const skString &s2)
 Efficiently adds 2 strings.

IMPORT_C skString addStrings (const skString &s1, const skString &s2, const skString &s3)
 Efficiently adds 3 strings.

IMPORT_C skString addStrings (const skString &s1, const skString &s2, const skString &s3, const skString &s4)
 Efficiently adds 4 strings.

IMPORT_C skString addStrings (const skString &s1, const skString &s2, const skString &s3, const skString &s4, const skString &s5)
 Efficiently adds 5 strings.

IMPORT_C skString addStrings (const skString &s1, const skString &s2, const skString &s3, const skString &s4, const skString &s5, const skString &s6)
 Efficiently adds 6 strings.

IMPORT_C skString addStrings (const skString &s1, const skString &s2, const skString &s3, const skString &s4, const skString &s5, const skString &s6, const skString &s7)
 Efficiently adds 7 strings.

IMPORT_C skString addStrings (const skString &s1, const skString &s2, const skString &s3, const skString &s4, const skString &s5, const skString &s6, const skString &s7, const skString &s8)
 Efficiently adds 8 strings.

IMPORT_C skString addStrings (const TDesC &s1, const TDesC &s2)
 Efficiently adds 2 strings.

IMPORT_C skString addStrings (const TDesC &s1, const TDesC &s2, const TDesC &s3)
 Efficiently adds 3 strings.

IMPORT_C skString addStrings (const TDesC &s1, const TDesC &s2, const TDesC &s3, const TDesC &s4)
 Efficiently adds 4 strings.

IMPORT_C skString addStrings (const TDesC &s1, const TDesC &s2, const TDesC &s3, const TDesC &s4, const TDesC &s5)
 Efficiently adds 5 strings.

IMPORT_C skString addStrings (const TDesC &s1, const TDesC &s2, const TDesC &s3, const TDesC &s4, const TDesC &s5, const TDesC &s6)
 Efficiently adds 6 strings.

IMPORT_C skString addStrings (const TDesC &s1, const TDesC &s2, const TDesC &s3, const TDesC &s4, const TDesC &s5, const TDesC &s6, const TDesC &s7)
 Efficiently adds 7 strings.

IMPORT_C skString addStrings (const TDesC &s1, const TDesC &s2, const TDesC &s3, const TDesC &s4, const TDesC &s5, const TDesC &s6, const TDesC &s7, const TDesC &s8)
 Efficiently adds 8 strings.

void Cleanup (TAny *s)
 Called via Symbian CleanupStack in the event of a leave.


Protected Member Functions

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

IMPORT_C 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_String * pimp
 The underlying string object - this is null if the string is blank.


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.


Member Function Documentation

IMPORT_C skString skString::addStrings const TDesC &  s1,
const TDesC &  s2,
const TDesC &  s3,
const TDesC &  s4,
const TDesC &  s5,
const TDesC &  s6,
const TDesC &  s7,
const TDesC &  s8
[static]
 

Efficiently adds 8 strings.

Remarks:
only available in Symbian version
Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const TDesC &  s1,
const TDesC &  s2,
const TDesC &  s3,
const TDesC &  s4,
const TDesC &  s5,
const TDesC &  s6,
const TDesC &  s7
[static]
 

Efficiently adds 7 strings.

Remarks:
only available in Symbian version
Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const TDesC &  s1,
const TDesC &  s2,
const TDesC &  s3,
const TDesC &  s4,
const TDesC &  s5,
const TDesC &  s6
[static]
 

Efficiently adds 6 strings.

Remarks:
only available in Symbian version
Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const TDesC &  s1,
const TDesC &  s2,
const TDesC &  s3,
const TDesC &  s4,
const TDesC &  s5
[static]
 

Efficiently adds 5 strings.

Remarks:
only available in Symbian version
Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const TDesC &  s1,
const TDesC &  s2,
const TDesC &  s3,
const TDesC &  s4
[static]
 

Efficiently adds 4 strings.

Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const TDesC &  s1,
const TDesC &  s2,
const TDesC &  s3
[static]
 

Efficiently adds 3 strings.

Remarks:
only available in Symbian version
Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const TDesC &  s1,
const TDesC &  s2
[static]
 

Efficiently adds 2 strings.

Remarks:
only available in Symbian version
Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const skString &  s1,
const skString &  s2,
const skString &  s3,
const skString &  s4,
const skString &  s5,
const skString &  s6,
const skString &  s7,
const skString &  s8
[static]
 

Efficiently adds 8 strings.

Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const skString &  s1,
const skString &  s2,
const skString &  s3,
const skString &  s4,
const skString &  s5,
const skString &  s6,
const skString &  s7
[static]
 

Efficiently adds 7 strings.

Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const skString &  s1,
const skString &  s2,
const skString &  s3,
const skString &  s4,
const skString &  s5,
const skString &  s6
[static]
 

Efficiently adds 6 strings.

Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const skString &  s1,
const skString &  s2,
const skString &  s3,
const skString &  s4,
const skString &  s5
[static]
 

Efficiently adds 5 strings.

Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const skString &  s1,
const skString &  s2,
const skString &  s3,
const skString &  s4
[static]
 

Efficiently adds 4 strings.

Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const skString &  s1,
const skString &  s2,
const skString &  s3
[static]
 

Efficiently adds 3 strings.

Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::addStrings const skString &  s1,
const skString &  s2
[static]
 

Efficiently adds 2 strings.

Exceptions:
Symbian - a leaving function

IMPORT_C void skString::assign const Char *  ,
int  len = 0
[protected]
 

Assigns another buffer to this one, and copies it.

Exceptions:
Symbian - a leaving function

Char skString::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* skString::c_str  )  const [inline]
 

Accesses underlying buffer.

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

void skString::Cleanup TAny *  s  )  [inline, static]
 

Called via Symbian CleanupStack in the event of a leave.

This calls the deRef method in the string.

Remarks:
only available in Symbian version

IMPORT_C skString skString::copyFromBuffer const Char *  buffer,
USize  length
[static]
 

Constructs a string from the subset of a buffer, the contents are copied.

Exceptions:
Symbian - a leaving function

IMPORT_C bool skString::equalsIgnoreCase const skString &   )  const
 

Case-insensitive equality.

Remarks:
Symbian version performs a folding comparison
Returns:
true if the other string is the same as the current one, ignoring case

IMPORT_C skString skString::from Char  ch  )  [static]
 

Constructs a string from a character.

Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::from float   )  [static]
 

Constructs a string from a float.

Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::from USize   )  [static]
 

Constructs a string from an unsigned integer.

Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::from int   )  [static]
 

Constructs a string from a signed integer.

Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::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

Exceptions:
Symbian - a leaving function

IMPORT_C int skString::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

IMPORT_C int skString::indexOf const skString &  s  )  const
 

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

Returns:
an index, or -1 if not found

IMPORT_C int skString::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 skString::length  )  const [inline]
 

Length of the string.

Returns:
the length of the buffer in the P_String object

IMPORT_C skString skString::literal const Char *   )  [static]
 

Constructs a string from static string - the static string is *not* copied.

Exceptions:
Symbian - a leaving function

skString IMPORT_C skString::ltrim  )  const
 

Returns:
returns a version of this string with leading blanks removed
Exceptions:
Symbian - a leaving function

skString::operator TCleanupItem  )  [inline]
 

Conversion operator to Symbian TCleanupItem.

This is provided to allow this object to be pushed by value onto the Symbian Cleanup Stack

Remarks:
only available in Symbian version

IMPORT_C bool skString::operator!= const Char *   )  const
 

Inequality operator.

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

IMPORT_C bool skString::operator!= const skString &   )  const
 

Inequality operator.

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

IMPORT_C skString skString::operator+ const skString &   )  const
 

Addition operator.

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

IMPORT_C skString& 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
Exceptions:
Symbian - a leaving function

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

Comparison operator.

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

skString& skString::operator= const TDesC &   )  [inline]
 

Assignment operator from a Symbian descriptor.

Remarks:
only available in Symbian version
Exceptions:
Symbian - a leaving function

IMPORT_C skString& skString::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

IMPORT_C skString& skString::operator= Char  c  ) 
 

Assigns a character.

Parameters:
c - the character to be assigned
Exceptions:
Symbian - a leaving function

bool skString::operator== const TDesC &   )  const [inline]
 

Equality operator.

Remarks:
only available in Symbian version
Returns:
true if the other descriptor is the same as the current one

bool skString::operator== const Char *   )  const [inline]
 

Equality operator.

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

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

Equality operator.

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

TPtrC skString::ptr  )  const [inline]
 

Accesses underlying buffer.

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

skString IMPORT_C skString::removeInitialBlankLines  )  const
 

This method removes any initial blank lines from the given string.

This is useful for trimming the beginning of methods in Simkin scripts.

Returns:
returns the trimmed string
Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::replace const TDesC &  old_substr,
const TDesC &  new_substr
const
 

Replaces a substring with another.

Remarks:
only available in Symbian version
Parameters:
old_substr the substring to be replaced
new_substr the new substring
Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::replace const Char *  old_substr,
const Char *  new_substr
const
 

Replaces a substring with another.

Parameters:
old_substr the substring to be replaced
new_substr the new substring
Exceptions:
Symbian - a leaving function

IMPORT_C skString skString::replace const skString &  old_substr,
const skString &  new_substr
const
 

Replaces a substring with another.

Parameters:
old_substr the substring to be replaced
new_substr the new substring
Exceptions:
Symbian - a leaving function

IMPORT_C void skString::replaceInPlace Char  old_char,
Char  new_char
 

This method replaces a character with a different one within this string.

The underlying data *is* modified

IMPORT_C skString skString::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

IMPORT_C skString skString::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 file:
Generated on Fri Dec 17 20:28:27 2004 for Simkin C++ for Symbian by doxygen1.3