Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_String Class Reference

A class for dealing with strings. More...

Inheritance diagram for CP_String:

CP_PropertyList::String List of all members.

Assignment

CP_Stringoperator= (char inChar)
CP_Stringoperator= (CPUniChar inChar)
CP_Stringoperator= (const char *inString)
CP_Stringoperator= (const CPUniChar *inString)
CP_Stringoperator= (const CP_String &inString)
CP_Stringassign (char inChar, const CP_TextEncoder *inTextEncoder=NULL)
CP_Stringassign (CPUniChar inChar)
CP_Stringassign (UInt32 inCount, char inChar, const CP_TextEncoder *inTextEncoder=NULL)
CP_Stringassign (UInt32 inCount, CPUniChar inChar)
CP_Stringassign (const char *inString, const CP_TextEncoder *inTextEncoder=NULL)
CP_Stringassign (const char *inString, UInt32 inLength, const CP_TextEncoder *inTextEncoder=NULL)
CP_Stringassign (const CPUniChar *inString)
CP_Stringassign (const CPUniChar *inString, UInt32 inLength)
CP_Stringassign (const CP_String &inString, UInt32 inStartIndex=0, UInt32 inLength=npos)

Conversion

CP_Stringoperator= (CFStringRef inStringRef)
CP_Stringoperator= (const CP_ResourcePtr< CFStringRef > &inStringRef)
CP_Stringoperator= (CFMutableStringRef inStringRef)
CP_Stringoperator= (const CP_ResourcePtr< CFMutableStringRef > &inStringRef)
CFStringRef GetCFStringRef () const
CFMutableStringRef GetMutableCFStringRef ()
CP_ResourcePtr< CFStringRef > GetCFStringRefPtr () const
CP_ResourcePtr< CFMutableStringRef > GetMutableCFStringRefPtr ()

Public Types

typedef CFStringRef StringRef
typedef std::reverse_iterator<
const_iterator
const_reverse_iterator
typedef std::reverse_iterator<
iterator
reverse_iterator
enum  { kCP_E_String_BufferSize = 32, npos = MAX_UINT_32 }

Public Member Functions

Constructor / Destructor
 CP_String ()
 Constructor.
 CP_String (const char *inCString, const CP_TextEncoder *inTextEncoder=NULL)
 CP_String (const char *inCString, UInt32 inLength, const CP_TextEncoder *inTextEncoder=NULL)
 CP_String (UInt32 inCharCount, char inChar, const CP_TextEncoder *inTextEncoder=NULL)
 CP_String (const CPUniChar *inWString)
 CP_String (const CPUniChar *inWString, UInt32 inLength)
 CP_String (UInt32 inCharCount, CPUniChar inChar)
 CP_String (const unsigned char *inPString, const CP_TextEncoder *inTextEncoder=NULL)
 CP_String (const std::string &inString, const CP_TextEncoder *inTextEncoder=NULL)
 CP_String (const std::wstring &inString)
 CP_String (const CP_String &inString, UInt32 inStartIndex=0, UInt32 inLength=npos)
 CP_String (CFStringRef inStringRef)
 CP_String (CFMutableStringRef inStringRef)
 CP_String (const CP_ResourcePtr< CFStringRef > &inStringRef)
 CP_String (const CP_ResourcePtr< CFMutableStringRef > &inStringRef)
virtual ~CP_String ()
 Destructor.

Static Public Attributes

static const CP_String emptyString

Protected Member Functions

void AssertUniqueMutableCFStringRef ()

Protected Attributes

char * fCStringDataPtr
UInt32 fCStringDataCapacity
bool fDirty
CFStringRef fImmutableString
CFMutableStringRef fMutableString
CPUniCharfStringData
UInt32 fStringDataCapacity

Classes

class  __iterator_base
class  const_iterator
class  iterator
class  reference

Detailed Description

The CP_String class provides a std::string like interface for string data used in the CPLAT framework.

Internally all string data is stored as Unicode data, and the class provides converters to convert to non-unicode as well as return the data as a Unicode string.

Under MacOS Carbon we use the CFString data type provided by the MacOS to manage all data.

Under Windows and Linux the data is stored as CPUniChar data.


Member Typedef Documentation

typedef CFStringRef CP_String::StringRef
 

typedef std::reverse_iterator<const_iterator> CP_String::const_reverse_iterator
 

typedef std::reverse_iterator<iterator> CP_String::reverse_iterator
 


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
kCP_E_String_BufferSize 
npos 


Constructor & Destructor Documentation

CP_String::CP_String  ) 
 

Constructor. This constructor creates an empty string.

Exceptions:
none 

CP_String::CP_String const char *  inCString,
const CP_TextEncoder inTextEncoder = NULL
 

Constructor. This constructor creates the string from the passed in characters.

Parameters:
inCString C style string of characters that is NULL terminated.
inTextEncoder CP_TextEncoder object used to encode the data if needed. Under Carbon the text encoder only specifies the built in CFString handling of the MacOS. Pass NULL to use default encoder.
Exceptions:
std::bad_cast raised if conversion from specified encoding fails

CP_String::CP_String const char *  inCString,
UInt32  inLength,
const CP_TextEncoder inTextEncoder = NULL
 

Constructor. This constructor creates the string from the passed in characters.

Parameters:
inCString C style string of characters that is NULL terminated.
inLength The number of characters to copy from the original string. If the string is shorter than the passed in length, then the string will only be the length of the original string.
inTextEncoder CP_TextEncoder object used to encode the data if needed. Under Carbon the text encoder only specifies the built in CFString handling of the MacOS. Pass NULL to use default encoder.
Exceptions:
std::bad_cast raised if conversion from specified encoding fails

CP_String::CP_String UInt32  inCharCount,
char  inChar,
const CP_TextEncoder inTextEncoder = NULL
 

Constructor. This constructor creates the string using the passed in char. The char inChar will be repeated inCharCount times in the string.

Parameters:
inCharCount Number of times to repeat the passed in char in the string.
inChar The character that will be repeated in the string.
inTextEncoder CP_TextEncoder object used to encode the data if needed. Under Carbon the text encoder only specifies the built in CFString handling of the MacOS. Pass NULL to use default encoder.
Exceptions:
none 

CP_String::CP_String const CPUniChar inWString  ) 
 

Constructor. This constructor creates the string from the passed in UnicodeCharacters.

Parameters:
inWString Unicode string of characters.
Exceptions:
none 

CP_String::CP_String const CPUniChar inWString,
UInt32  inLength
 

Constructor. This constructor creates the string from the passed in CPUniChar string using inLength number of characters from the string.

Parameters:
inWString Unicode style string of characters that is NULL terminated.
inLength Number of character to copy from the passed in string.
Exceptions:
none 

CP_String::CP_String UInt32  inCharCount,
CPUniChar  inChar
 

Constructor. This constructor creates the string using the passed in Unicode char. The Unicode char inChar will be repeated inCharCount times in the string.

Parameters:
inCharCount Number of times to repeat the passed in char in the string.
inChar The Unicode character that will be repeated in the string.
Exceptions:
none 

CP_String::CP_String const unsigned char *  inPString,
const CP_TextEncoder inTextEncoder = NULL
 

Constructor. This constructor creates the string from the passed in characters.

Parameters:
inPString array of unsigned characters, also known as a a p string.
inTextEncoder CP_TextEncoder object used to encode the data if needed. Under Carbon the text encoder only specifies the built in CFString handling of the MacOS. Pass NULL to use default encoder.
Exceptions:
std::bad_cast raised if conversion from specified encoding fails.

CP_String::CP_String const std::string &  inString,
const CP_TextEncoder inTextEncoder = NULL
 

Constructor. This constructor creates the string from the passed in std::string.

Parameters:
inString Standard string containing the string data.
inTextEncoder CP_TextEncoder object used to encode the data if needed. Under Carbon the text encoder only specifies the built in CFString handling of the MacOS. Pass NULL to use default encoder.
Exceptions:
std::bad_cast raised if conversion from specified encoding fails.

CP_String::CP_String const std::wstring &  inString  ) 
 

Constructor. This constructor creates the string from the passed in std::string.

Parameters:
inString Standard wstring containing the string data.
Exceptions:
none 
Todo:
not strictly correct, since it does not take into account the actual encoding, but should be pretty close

CP_String::CP_String const CP_String inString,
UInt32  inStartIndex = 0,
UInt32  inLength = npos
 

Constructor. This constructor creates the string from a CP_String.

Parameters:
inString CP_String to copy the characters from
inStartIndex First character in passed in string to start copying from.
inLength Number of characters to copy from the string.
Exceptions:
none 

CP_String::CP_String CFStringRef  inStringRef  ) 
 

Constructor from a Carbon CFStringRef string.

Exceptions:
none 
Parameters:
inStringRef CFStringRef to used to construct this string.

CP_String::CP_String CFMutableStringRef  inStringRef  ) 
 

Constructor from a Carbon CFMutableStringRef string.

Exceptions:
none 
Parameters:
inStringRef CFStringRef to used to construct this string.

CP_String::CP_String const CP_ResourcePtr< CFStringRef > &  inStringRef  )  [explicit]
 

Constructor from a Carbon CFStringRef string.

Exceptions:
none 
Parameters:
inStringRef CFStringRef to used to construct this string.

CP_String::CP_String const CP_ResourcePtr< CFMutableStringRef > &  inStringRef  )  [explicit]
 

Constructor from a Carbon CFMutableStringRef string.

Exceptions:
none 
Parameters:
inStringRef CFStringRef to used to construct this string.

CP_String::~CP_String  )  [virtual]
 

Destructor. This will also free all memory allocated by this string.

Exceptions:
none 


Member Function Documentation

CP_String CP_String::StringWithFormat const char *  inFormat,
  ...
[static]
 

Creates a string from the given format and parameters. Same as CP_String::StringWithFormatAndArguments, except that the parameters are passed as C-style variable argument list.

See also:
CP_String::StringWithFormatAndArguments for more information about using format strings and parameters.
Exceptions:
Any exception raised by CP_String constructors and accessors.
Parameters:
inFormat The format string defining the skeleton for the generated string.
... The parameters to replace the placeholders in the skeleton string.
Returns:
CP_String The formatted string.

CP_String CP_String::StringWithFormatAndArguments const CP_String inFormat,
va_list  args
[static]
 

Creates a string from the given format and parameter list.
The format string is a printf-style format string that specifies the skeleton string and argument placeholders. The function will create a string that has the skeleton format string with argument placeholders replaced from the string representations of the remaining parameters.
Enhancements w.r.t. printf format strings are:

  • support for CP_String parameters (see below) using the "%@" placeholder
  • reordering arguments (see below) using a n$ prefix for the placeholder (e.g. "%2$@")

CP_String Parameters
You can use CP_Strings as replacement arguments, by using the "%@" format placeholder and passing a CP_String::StringRef as the replacement value:
	 CP_String	aString;
	 CP_String	formattedString = CP_String::StringWithFormat(CP_String("Hello %@"), aString.Ref());
	 
Reordering Arguments
You can specify the index of the argument to use for a specific placeholder in the skeleton string by using a modifier of the form "n$" with the format specifier (e.g. 2$d). This will use the n-th argument parameter to replace the placeholder in the skeleton string. These modifiers are very useful when localizing format strings, since they allow to reorder the placeholders in the format string.
See also:
printf for basic format string information
Exceptions:
Any exception raised by CP_String constructors and accessors. Also an exception will be thrown if the format string is not correct
Parameters:
inFormat The format string defining the skeleton for the generated string.
args The parameters to replace the placeholders in the skeleton string.
Returns:
CP_String The formatted string.

const char * CP_String::c_str bool  inLossy = false,
const CP_TextEncoder inTextEncoder = NULL
const
 

Returns a pointer to the first character of the string and the end of the string is NULL terminated.

Note:
Since the C string is kept in a temporary buffer, don't expect it to remain valid past the next call...
Exceptions:
bad_cast exception is raised if string can't be converted into specified encoding.
Parameters:
inLossy Specifies whether to use replacement character for characters that can't be encoded in specified encoding. If , a replacement character will be used, if false a bad_cast exception will be raised if a character can't be encoded.
inTextEncoder Text encoder used to encode the characters into plain c style characters. Pass NULL to use default encoder.
Returns:
const char * C style string of characters that is NULL terminated.

const CPUniChar * CP_String::w_str  )  const
 

Returns a pointer to the first character of the string and the end of the string is NULL terminated. The characters returns are Unicode characters.

Note:
Since the string is kept in a temporary buffer, don't expect it to remain valid past the next call...
Exceptions:
none 
Returns:
const CPUniChar * C style string of Unicode characters that is NULL terminated.

const char * CP_String::utf8_str  )  const
 

Returns a pointer to a buffer or characters that contains a UTF-8 encoded representation of the string.

Note:
Since the C string is kept in a temporary buffer, don't expect it to remain valid past the next call...
Exceptions:
none 
Returns:
const char * UTF-8 encoded C string.

CPUniChar CP_String::operator[] UInt32  inIndex  )  const
 

Returns the Unicode character at the passed in 0 based index. Const version.

Parameters:
inIndex 0 based index of the character to return.
Exceptions:
std::out_of_range if index is out of range (i.e. >= length())
Returns:
const CPUniChar Unicode character.

reference CP_String::operator[] UInt32  inIndex  ) 
 

CPUniChar CP_String::at UInt32  inIndex  )  const
 

Returns the Unicode character at the passed in 0 (zero) based index. Const version.

Parameters:
inIndex 0 (zero) based index of the character to return. If the passed in inIndex is greater than or equal to the length of the string a std::out_of_range exception is thrown.
Exceptions:
none 
Returns:
const CPUniChar Unicode character.

reference CP_String::at UInt32  inIndex  ) 
 

CPUniChar CP_String::front  )  const
 

Returns the first character in our string as a Unicode character. Const version.

Exceptions:
std::out_of_range exception raised when called for an empty string
Returns:
CPUniChar First Unicode character of string.

reference CP_String::front  ) 
 

CPUniChar CP_String::back  )  const
 

Returns the last character in our string as a Unicode character. Const version.

Exceptions:
std::out_of_range exception raised when called for an empty string
Returns:
CPUniChar Last Unicode character of string.

reference CP_String::back  ) 
 

CP_String::StringRef CP_String::Ref  )  const
 

CP_String & CP_String::operator+= char  inChar  ) 
 

* Adds the passed in inChar to the end of our string.

Parameters:
inChar The char to be added to the string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::operator+= unsigned char  inChar  ) 
 

Adds the passed in inChar to the end of our string.

Parameters:
nChar The unsigned char to be added to the string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::operator+= CPUniChar  inChar  ) 
 

Adds the passed in inChar to the end of our string.

Parameters:
inChar The Unicode char to be added to the string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String& CP_String::operator+= const char *  inString  ) 
 

Adds the passed in c style (NULL terminated) string to the end of our string.

Parameters:
inChar The c style (NULL terminated) string to be added to the string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String& CP_String::operator+= const CPUniChar inString  ) 
 

Adds the passed in Unicode (NULL terminated) string to the end of our string.

Parameters:
inChar The Unicode (NULL terminated) string to be added to the string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String& CP_String::operator+= const CP_String inString  ) 
 

Adds the passed in CP_String string to the end of our string.

Parameters:
inChar The CP_String string to be added to the string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::append char  inChar,
const CP_TextEncoder inTextEncoder = NULL
 

Appends the passed in inChar to the end of our string.

Parameters:
inChar The char to be appended to the string.
inTextEncoder The text encoder to use to encode the character. Pass NULL to use the default text encoder.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::append unsigned char  inChar,
const CP_TextEncoder inTextEncoder = NULL
 

Appends the passed in inChar to the end of our string.

Parameters:
inChar The unsigned char to be appended to the string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::append CPUniChar  inChar  ) 
 

Appends the passed in inChar to the end of our string.

Parameters:
inChar The Unicode char to be appended to the string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::append UInt32  inCount,
CPUniChar  inChar
 

Appends the passed in inChar to the end of our string repeating inCount times.

Parameters:
inCount The number of times to repeat inChar in the string.
inChar The char to be appended to the string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::append const char *  inString,
const CP_TextEncoder inTextEncoder = NULL
 

Appends the passed in c style string to the end of our string.

Parameters:
inString C style (NULL terminated) string to append from.
inTextEncoder Text encoder to use to encode the C style string into UTF-16. Pass NULL to use the default encoder.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::append const char *  inString,
UInt32  inLength,
const CP_TextEncoder inTextEncoder = NULL
 

Appends the passed in c style string to the end of our string starting at the beginning and copying inLength characters.

Parameters:
inString C style string to append from.
inLength Number of characters to add to the string.
inTextEncoder Text encoder to use to encode the C style string into UTF-16. Pass NULL to use the default encoder.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::append const CPUniChar inString  ) 
 

Appends the passed in NULL terminated string of Unicode characters to the end of our string.

Parameters:
inString Unicode string of NULL terminated characters to append from.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::append const CPUniChar inString,
UInt32  inLength
 

Appends the passed in NULL terminated string of Unicode characters to the end of our string, copying the number of characters specified in inLength.

Parameters:
inString Unicode string of NULL terminated characters to append from.
inLength Number of characters to copy from the passed in string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::append const CP_String inString,
UInt32  inStartIndex = 0,
UInt32  inLength = npos
 

Appends characters from the passed in string starting at the character specified in inStartIndex and going for the number of characters specified in inLength.

Parameters:
inString CP_String to append the characters from.
inStartIndex First character to start copying from (zero based index).
inLength Number of characters to copy from inString.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

void CP_String::push_back CPUniChar  inChar  ) 
 

Add the CPUniChar to the end of this string.

Parameters:
inChar Unicode character being added.
Exceptions:
none 
Returns:
void

CP_String& CP_String::operator= char  inChar  ) 
 

Resets the contents of this string to the passed in char.

Parameters:
inChar char
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String& CP_String::operator= CPUniChar  inChar  ) 
 

Resets the contents of this string to the passed in Unicode characer.

Parameters:
inChar Unicode character
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String& CP_String::operator= const char *  inString  ) 
 

Resets the contents of this string to the passed in char * to a c style (NULL terminated) string.

Parameters:
inChar c style (NULL terminated) string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String& CP_String::operator= const CPUniChar inString  ) 
 

Resets the contents of this string to the passed in Unicode (NULL terminated) string.

Parameters:
inChar Unicode (NULL terminated) string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String& CP_String::operator= const CP_String inString  ) 
 

Resets the contents of this string to the passed in CP_String.

Parameters:
inString CP_String string to replace contents with.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::assign char  inChar,
const CP_TextEncoder inTextEncoder = NULL
 

Replaces the current contents of the string with the passed in char.

Parameters:
inChar char to replace string contents with
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::assign CPUniChar  inChar  ) 
 

Replaces the current contents of the string with the passed in Unicode char.

Parameters:
inChar Unicode char to replace string contents with
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::assign UInt32  inCount,
char  inChar,
const CP_TextEncoder inTextEncoder = NULL
 

Replaces the current contents of the string with the passed in char repeating inCount number of times.

Parameters:
inCount number of times to repeat the passed in char.
inChar char to repeat in string
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::assign UInt32  inCount,
CPUniChar  inChar
 

Replaces the current contents of the string with the passed in Unicode char repeating inCount number of times.

Parameters:
inCount number of times to repeat the passed in char.
inChar Unicode char to repeat in string
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::assign const char *  inString,
const CP_TextEncoder inTextEncoder = NULL
 

Replaces the current contents of the string with the passed in c style (NULL terminated) string.

Parameters:
inString C style string to assign contents from.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::assign const char *  inString,
UInt32  inLength,
const CP_TextEncoder inTextEncoder = NULL
 

Replaces the current contents of the string with the passed in c style (NULL terminated) string, using inLength characters from the string. If the string is shorter than the number of characters, then the string will only contain the actual characers and be shorter than the passed in length.

Parameters:
inString C style string to assign contents from.
inLength number of characters to assign to the new string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::assign const CPUniChar inString  ) 
 

Replaces the current contents of the string with the passed in NULL terminated string of Unicode characters.

Parameters:
inString NULL terminated string of Unicode characters
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::assign const CPUniChar inString,
UInt32  inLength
 

Replaces the current contents of the string with the passed in NULL terminated string of Unicode characters, copying inLength characters from the passed in string.

Parameters:
inString NULL terminated string of Unicode characters
inLength Number of characters to copy from the passed in string.
Exceptions:
none 
Returns:
P_String& Returns a reference to ourselves.

CP_String & CP_String::assign const CP_String inString,
UInt32  inStartIndex = 0,
UInt32  inLength = npos
 

Replaces the current contents of the string with the passed in CP_String. We start from the source string in the passed in inStartIndex and copy inLength characters.

Parameters:
inString CP_String containing the data to be copied.
inStartIndex First character to start coping from in the source string (zero based index).
inLength Number of characters to copy from the source string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::operator= CFStringRef  inStringRef  ) 
 

Assignment operator to set the string from a Carbon CFStringRef string.

Parameters:
inStringRef CFStringRef to used to construct this string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::operator= const CP_ResourcePtr< CFStringRef > &  inStringRef  ) 
 

Assignment operator to set the string from a Carbon CFStringRef string.

Parameters:
inStringRef CFStringRef to used to construct this string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::operator= CFMutableStringRef  inStringRef  ) 
 

Assignment operator to set the string from a Carbon CFMutableStringRef string.

Parameters:
inStringRef CFMutableStringRef to used to construct this string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::operator= const CP_ResourcePtr< CFMutableStringRef > &  inStringRef  ) 
 

Assignment operator to set the string from a Carbon CFMutableStringRef string.

Parameters:
inStringRef CFMutableStringRef to used to construct this string.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CFStringRef CP_String::GetCFStringRef  )  const
 

Return the CFStringRef containing the string data.

Exceptions:
none 
Returns:
CFStringRef The CFStringRef for our strings data.

CFMutableStringRef CP_String::GetMutableCFStringRef  ) 
 

Return the CFMutableStringRef containing the string data.

Exceptions:
CP_OSErrorException(coreFoundationUnknownErr) raised if converting immutable string to mutable string fails.
Returns:
CFMutableStringRef The CFMutableStringRef for our strings data.

CP_ResourcePtr<CFStringRef> CP_String::GetCFStringRefPtr  )  const
 

Return the CFStringRef containing the string data as a CP_ResourcePtr wrapped resource.

Exceptions:
none 
Returns:
CP_ResourcePtr const A CP_ResourcePtr that contains the CFStringRef for the string.

CP_ResourcePtr<CFMutableStringRef> CP_String::GetMutableCFStringRefPtr  ) 
 

Return the CFMutableStringRef containing the string data as a CP_ResourcePtr wrapped resource.

Exceptions:
CP_OSErrorException(coreFoundationUnknownErr) raised if converting immutable string to mutable string fails.
Returns:
CP_ResourcePtr const A CP_ResourcePtr that contains the CFMutableStringRef for the string.

SInt32 CP_String::compare const char *  inChar,
const CP_TextEncoder inTextEncoder = NULL
const
 

Compare the contents of the passed in string to the contents of this string.

Parameters:
inChar c style (NULL terminated) string to compare against.
inTextEncoder Text encoder to use to encode the C style string into UTF-16. Pass NULL to use the default encoder.
Exceptions:
none 
Returns:
SInt32 Returns the result of the compare as follows: 0 - strings are equal -1 - this string is less than passed in string. +1 - this string is greater than passed in string.

SInt32 CP_String::compare const CPUniChar inChar  )  const
 

Compare the contents of the passed in string to the contents of this string.

Parameters:
inChar Unicode (NULL terminated) string to compare against.
Exceptions:
none 
Returns:
SInt32 Returns the result of the compare as follows: 0 - strings are equal -1 - this string is less than passed in string. +1 - this string is greater than passed in string.

SInt32 CP_String::compare const CP_String inString  )  const
 

Compare the contents of the passed in string to the contents of this string.

Parameters:
inChar CP_String string to compare against.
Exceptions:
none 
Returns:
SInt32 Returns the result of the compare as follows: 0 - strings are equal -1 - this string is less than passed in string. +1 - this string is greater than passed in string.

SInt32 CP_String::compare UInt32  inIndex,
UInt32  inCount,
const CPUniChar inString,
UInt32  inLength
const
 

Compare the contents of the passed in string to the contents of this string. This version uses only a portion of both strings to compare against as listed below in the parameters.

Parameters:
inIndex First character in this string to start comparing with.
inCount Number of characters in this string to compare with.
inString Unicode string to compare against this string.
inLength Number of characters in the passed in Unicode string to to compare with in the string portion constructed from the first 2 parameters.
Exceptions:
none 
Returns:
SInt32 Returns the result of the compare as follows: 0 - strings are equal -1 - this string is less than passed in string. +1 - this string is greater than passed in string.

SInt32 CP_String::compare UInt32  inIndex,
UInt32  inCount,
const CP_String inString,
UInt32  inStartIndex = 0,
UInt32  inLength = npos
const
 

Compare the contents of the passed in string to the contents of this string. This version uses only a portion of both strings to compare against as listed below in the parameters.

Parameters:
inIndex First character in this string to start comparing with.
inCount Number of characters in this string to compare with.
inString CP_String to compare against this string.
inStartIndex First character to start with in the passed in string.
inLength Number of characters in the passed in string to to compare with in the string portion constructed from the first 2 parameters.
Exceptions:
none 
Returns:
SInt32 Returns the result of the compare as follows: 0 - strings are equal -1 - this string is less than passed in string. +1 - this string is greater than passed in string.

CP_String & CP_String::erase UInt32  inIndex = 0,
UInt32  inCount = npos
 

Erase some of the characters in this string. The erasure begins at inIndex and goes for inCount number of characters.

Parameters:
inIndex Location to begin erasing from.
inCount Number of characters to remove from string, or npos to remove the remaining characters up to the end.
Exceptions:
CP_BoundsException raised if index is out of bounds.
Returns:
iterator reverse_iterator non const version

void CP_String::pop_back  ) 
 

Erases the last character in the string.

Exceptions:
none 
Returns:
void

UInt32 CP_String::find CPUniChar  inChar,
UInt32  inIndex = 0
const
 

Return the index into this string of the passed in character starting at the passed in starting location.

Parameters:
inChar The Unicode character we are looking for.
inIndex Starting position of this string to begin the search at.
Exceptions:
none 
Returns:
UInt32 Returns the position that inChar is located at within this string. If the characrer is not found, then the index of npos (ULONG_MAX) will be returned.

UInt32 CP_String::find const char *  inString,
UInt32  inIndex = 0,
const CP_TextEncoder inTextEncoder = NULL
const
 

Return the index into this string of the passed in c style (NULL terminated) string starting at the passed in starting location.

Parameters:
inString c style (NULL terminated) string to match in this string.
inIndex Starting position of this string to begin the search at.
Exceptions:
none 
Returns:
UInt32 Returns the position that inString is located at within this string. If the string is not found, then the index of npos (ULONG_MAX) will be returned.

UInt32 CP_String::find const char *  inString,
UInt32  inIndex,
UInt32  inLength,
const CP_TextEncoder inTextEncoder = NULL
const
 

Return the index into this string of the passed in c style (NULL terminated) string starting at the passed in starting location and using inLength characters from the passed in string.

Parameters:
inString c style (NULL terminated) string to match in this string.
inIndex Starting position of this string to begin the search at.
inLength Number of characters to use from the passed in string.
Exceptions:
none 
Returns:
UInt32 Returns the position that inString is located at within this string. If the string is not found, then the index of npos (ULONG_MAX) will be returned.

UInt32 CP_String::find const CPUniChar inString,
UInt32  inIndex = 0
const
 

Return the index into this string of the passed in Unicode (NULL terminated) string starting at the passed in starting location.

Parameters:
inString Unicode (NULL terminated) string to match in this string.
inIndex Starting position of this string to begin the search at.
Exceptions:
none 
Returns:
UInt32 Returns the position that inString is located at within this string. If the string is not found, then the index of npos (ULONG_MAX) will be returned.

UInt32 CP_String::find const CPUniChar inString,
UInt32  inIndex,
UInt32  inLength
const
 

Return the index into this string of the passed in Unicode (NULL terminated) string starting at the passed in starting location and using inLength characters from the passed in string.

Parameters:
inString Unicode (NULL terminated) string to match in this string.
inIndex Starting position of this string to begin the search at.
inLength Number of characters to use from the passed in string.
Exceptions:
none 
Returns:
UInt32 Returns the position that inString is located at within this string. If the string is not found, then the index of npos (ULONG_MAX) will be returned.

UInt32 CP_String::find const CP_String inString,
UInt32  inIndex = 0
const
 

Return the index into this string of the passed in CP_String string starting at the passed in starting location.

Parameters:
inString CP_String string to match in this string.
inIndex Starting position of this string to begin the search at.
Exceptions:
none 
Returns:
UInt32 Returns the position that inString is located at within this string. If the string is not found, then the index of npos (ULONG_MAX) will be returned.

UInt32 CP_String::rfind CPUniChar  inChar,
UInt32  inIndex = npos
const
 

Return the index into this string of the passed in Unicode character, searching the string backwards and starting at inIndex.

Parameters:
inChar Unicode character to match in this string.
inIndex Starting position of this char to begin the search at. If inIndex is npos it will search from the end of the string.
Exceptions:
none 
Returns:
UInt32 Returns the position that inChar is located at within this string. If the char is not found, then the index of npos (ULONG_MAX) will be returned.

UInt32 CP_String::rfind const char *  inString,
UInt32  inIndex = npos,
const CP_TextEncoder inTextEncoder = NULL
const
 

Return the index into this string of the passed in c style (NULL terminated) string, searching the string backwards and starting at inIndex.

Parameters:
inString c style (NULL terminated) string to match in this string.
inIndex Starting position of this string to begin the search at. If inIndex is npos it will search from the end of the string.
Exceptions:
none 
Returns:
UInt32 Returns the position that inString is located at within this string. If the string is not found, then the index of npos (ULONG_MAX) will be returned.

UInt32 CP_String::rfind const char *  inString,
UInt32  inIndex,
UInt32  inLength,
const CP_TextEncoder inTextEncoder = NULL
const
 

Return the index into this string of the passed in c style (NULL terminated) string, searching the string backwards and starting at inIndex and using inLength characters from the source string.

Parameters:
inString c style (NULL terminated) string to match in this string.
inIndex Starting position of this string to begin the search at. If inIndex is npos it will search from the end of the string.
inLength Number of characters from the soruce string to use.
Exceptions:
none 
Returns:
UInt32 Returns the position that inString is located at within this string. If the string is not found, then the index of npos (ULONG_MAX) will be returned.

UInt32 CP_String::rfind const CPUniChar inString,
UInt32  inIndex = npos
const
 

Return the index into this string of the passed in Unicode (NULL terminated) string, searching the string backwards and starting at inIndex.

Parameters:
inString Unicode (NULL terminated) string to match in this string.
inIndex Starting position of this string to begin the search at. If inIndex is npos it will search from the end of the string.
Exceptions:
none 
Returns:
UInt32 Returns the position that inString is located at within this string. If the string is not found, then the index of npos (ULONG_MAX) will be returned.

UInt32 CP_String::rfind const CPUniChar inString,
UInt32  inIndex,
UInt32  inLength
const
 

Return the index into this string of the passed in Unicode (NULL terminated) string, searching the string backwards and starting at inIndex and using inLength characters from the source string.

Parameters:
inString Unicode (NULL terminated) string to match in this string.
inIndex Starting position of this string to begin the search at. If inIndex is npos it will search from the end of the string.
inLength Number of characters from the soruce string to use.
Exceptions:
none 
Returns:
UInt32 Returns the position that inString is located at within this string. If the string is not found, then the index of npos (ULONG_MAX) will be returned.

UInt32 CP_String::rfind const CP_String inString,
UInt32  inIndex = npos
const
 

Return the index into this string of the passed in CP_String string, searching the string backwards and starting at inIndex.

Parameters:
inString CP_String string to match in this string.
inIndex Starting position of this string to begin the search at. If inIndex is npos it will search from the end of the string.
Exceptions:
none 
Returns:
UInt32 Returns the position that inString is located at within this string. If the string is not found, then the index of npos (ULONG_MAX) will be returned.

UInt32 CP_String::find_first_of CPUniChar  inChar,
UInt32  inIndex = 0
const
 

Return the index of the first occurrance of inChar in this string.

Parameters:
inChar Unicode character we are looking for.
inIndex Starting index to being search at, default is the beginning.
Exceptions:
none 
Returns:
UInt32 Location of first occurrance of inChar in this string. npos if not found.

UInt32 CP_String::find_first_of const char *  inString,
UInt32  inIndex = 0,
const CP_TextEncoder inTextEncoder = NULL
const
 

Return the index of the first occurrance of inSting in this string.

Parameters:
inString c style (NULL terminated) we are looking for.
inIndex Starting index to being search at, default is the beginning.
inTextEncoder Text encoder used to convert c style string into UTF-16 representation if needed.
Exceptions:
none 
Returns:
UInt32 Location of first occurrance of inChar in this string. npos if not found.

UInt32 CP_String::find_first_of const char *  inString,
UInt32  inIndex,
UInt32  inLength,
const CP_TextEncoder inTextEncoder = NULL
const
 

Return the index of the first occurrance of inSting in this string.

Parameters:
inString c style (NULL terminated) we are looking for.
inIndex Starting index to being search at, default is the beginning.
inLength Number of characters in inString to use in the search.
inTextEncoder Text encoder used to convert c style string into UTF-16 representation if needed.
Exceptions:
none 
Returns:
UInt32 Location of first occurrance of inChar in this string. npos if not found.

UInt32 CP_String::find_first_of const CPUniChar inString,
UInt32  inIndex = 0
const
 

Return the index of the first occurrance of inSting in this string.

Parameters:
inString Unicode (NULL terminated) we are looking for.
inIndex Starting index to being search at, default is the beginning.
Exceptions:
none 
Returns:
UInt32 Location of first occurrance of inChar in this string. npos if not found.

UInt32 CP_String::find_first_of const CPUniChar inString,
UInt32  inIndex,
UInt32  inLength
const
 

Return the index of the first occurrance of inSting in this string.

Parameters:
inString Unicode (NULL terminated) we are looking for.
inIndex Starting index to being search at, default is the beginning.
inLength Number of characters in inString to use in the search.
Exceptions:
none 
Returns:
UInt32 Location of first occurrance of inString in this string. npos if not found.

UInt32 CP_String::find_first_of const CP_String inString,
UInt32  inIndex = 0
const
 

Return the index of the first occurrance of inSting in this string.

Parameters:
inString CP_String we are looking for.
inIndex Starting index to being search at, default is the beginning.
Exceptions:
none 
Returns:
UInt32 Location of first occurrance of inString in this string. npos if not found.

UInt32 CP_String::find_last_of CPUniChar  inChar,
UInt32  inIndex = npos
const
 

Return the index of the last occurrance of inChar in this string. The search is backwards in the string

Parameters:
inString Unicode character we are looking for.
inIndex Starting index to being search at, default is the end of the string.
Exceptions:
none 
Returns:
UInt32 Location of last occurrance of inChar in this string. npos if not found.

UInt32 CP_String::find_last_of const char *  inString,
UInt32  inIndex = npos,
const CP_TextEncoder inTextEncoder = NULL
const
 

Return the index of the last occurrance of inChar in this string. The search is backwards in the string

Parameters:
inString c style (NULL terminated) string we are looking for.
inIndex Starting index to being search at, default is the end of the string.
inTextEncoder Text encoder used to convert c style string into UTF-16 representation if needed.
Exceptions:
none 
Returns:
UInt32 Location of last occurrance of inString in this string. npos if not found.

UInt32 CP_String::find_last_of const char *  inString,
UInt32  inIndex,
UInt32  inLength,
const CP_TextEncoder inTextEncoder = NULL
const
 

Return the index of the last occurrance of inString in this string. The search is backwards in the string

Parameters:
inString c style (NULL terminated) string we are looking for.
inIndex Starting index to being search at, default is the end of the string.
inLength Number of characters from inString to use in search.
inTextEncoder Text encoder used to convert c style string into UTF-16 representation if needed.
Exceptions:
none 
Returns:
UInt32 Location of last occurrance of inString in this string. npos if not found.

UInt32 CP_String::find_last_of const CPUniChar inString,
UInt32  inIndex = npos
const
 

Return the index of the last occurrance of inString in this string. The search is backwards in the string

Parameters:
inString Unicode (NULL terminated) string we are looking for.
inIndex Starting index to being search at, default is the end of the string.
Exceptions:
none 
Returns:
UInt32 Location of last occurrance of inString in this string. npos if not found.

UInt32 CP_String::find_last_of const CPUniChar inString,
UInt32  inIndex,
UInt32  inLength
const
 

Return the index of the last occurrance of inString in this string. The search is backwards in the string

Parameters:
inString Unicode (NULL terminated) string we are looking for.
inIndex Starting index to being search at, default is the end of the string.
inLength Number of characters from inString to use in search.
Exceptions:
none 
Returns:
UInt32 Location of last occurrance of inString in this string. npos if not found.

UInt32 CP_String::find_last_of const CP_String inString,
UInt32  inIndex = npos
const
 

Return the index of the last occurrance of inString in this string. The search is backwards in the string

Parameters:
inString CP_String string we are looking for.
inIndex Starting index to being search at, default is the end of the string.
Exceptions:
none 
Returns:
UInt32 Location of last occurrance of inString in this string. npos if not found.

UInt32 CP_String::find_first_not_of CPUniChar  inChar,
UInt32  inIndex = 0
const
 

Return the index of the first occurrance of inChar that is not in this string.

Parameters:
inChar Unicode character string we are looking for.
inIndex Starting index to being search at, default is the beginning of the string.
Exceptions:
none 
Returns:
UInt32 Location of first occurrance that is not in this string. npos if not found.

UInt32 CP_String::find_first_not_of const char *  inString,
UInt32  inIndex = 0,
const CP_TextEncoder inTextEncoder = NULL
const
 

Return the index of the first occurrance of inString that is not in this string.

Parameters:
inString c style (NULL terminated) character string we are looking for.
inIndex Starting index to being search at, default is the beginning of the string.
inTextEncoder Text encoder used to convert c style string into UTF-16 representation if needed.
Exceptions:
none 
Returns:
UInt32 Location of first occurrance that is not in this string. npos if not found.

UInt32 CP_String::find_first_not_of const char *  inString,
UInt32  inIndex,
UInt32  inLength,
const CP_TextEncoder inTextEncoder = NULL
const
 

Return the index of the first occurrance of inString that is not in this string.

Parameters:
inString c style (NULL terminated) character string we are looking for.
inIndex Starting index to being search at, default is the beginning of the string.
inLength Number of characters from passed in string to use in search.
inTextEncoder Text encoder used to convert c style string into UTF-16 representation if needed.
Exceptions:
none 
Returns:
UInt32 Location of first occurrance that is not in this string. npos if not found.

UInt32 CP_String::find_first_not_of const CPUniChar inString,
UInt32  inIndex = 0
const
 

Return the index of the first occurrance of inString that is not in this string.

Parameters:
inString Unicode (NULL terminated) character string we are looking for.
inIndex Starting index to being search at, default is the beginning of the string.
Exceptions:
none 
Returns:
UInt32 Location of first occurrance that is not in this string. npos if not found.

UInt32 CP_String::find_first_not_of const CPUniChar inString,
UInt32  inIndex,
UInt32  inLength
const
 

Return the index of the first occurrance of inString that is not in this string.

Parameters:
inString Unicode (NULL terminated) character string we are looking for.
inIndex Starting index to being search at, default is the beginning of the string.
inLength Number of characters from passed in string to use in search.
Exceptions:
none 
Returns:
UInt32 Location of first occurrance that is not in this string. npos if not found.

UInt32 CP_String::find_first_not_of const CP_String inString,
UInt32  inIndex = 0
const
 

Return the index of the first occurrance of inString that is not in this string.

Parameters:
inString CP_String character string we are looking for.
inIndex Starting index to being search at, default is the beginning of the string.
Exceptions:
none 
Returns:
UInt32 Location of first occurrance that is not in this string. npos if not found.

UInt32 CP_String::find_last_not_of CPUniChar  inChar,
UInt32  inIndex = npos
const
 

Return the index of the last occurrance of inChar that is not in this string. The search is backwards in the string

Parameters:
inChar Unicode character we are looking for.
inIndex Starting index to being search at, default is the end of the string.
Exceptions:
none 
Returns:
UInt32 Location of last occurrance that is not in this string.

UInt32 CP_String::find_last_not_of const char *  inString,
UInt32  inIndex = npos,
const CP_TextEncoder inTextEncoder = NULL
const
 

Return the index of the last occurrance of inString that is not in this string. The search is backwards in the string

Parameters:
inString c style (NULL terminated) string we are looking for.
inIndex Starting index to being search at, default is the end of the string.
inTextEncoder Text encoder used to convert c style string into UTF-16 representation if needed.
Exceptions:
none 
Returns:
UInt32 Location of last occurrance that is not in this string.

UInt32 CP_String::find_last_not_of const char *  inString,
UInt32  inIndex,
UInt32  inLength,
const CP_TextEncoder inTextEncoder = NULL
const
 

Return the index of the last occurrance of inString that is not in this string. The search is backwards in the string

Parameters:
inString c style (NULL terminated) string we are looking for.
inIndex Starting index to being search at, default is the end of the string.
inLength Number of characters from inString to use in search.
inTextEncoder Text encoder used to convert c style string into UTF-16 representation if needed.
Exceptions:
none 
Returns:
UInt32 Location of last occurrance that is not in this string.

UInt32 CP_String::find_last_not_of const CPUniChar inString,
UInt32  inIndex = npos
const
 

Return the index of the last occurrance of inString that is not in this string. The search is backwards in the string

Parameters:
inString Unicode (NULL terminated) string we are looking for.
inIndex Starting index to being search at, default is the end of the string.
Exceptions:
none 
Returns:
UInt32 Location of last occurrance that is not in this string.

UInt32 CP_String::find_last_not_of const CPUniChar inString,
UInt32  inIndex,
UInt32  inLength
const
 

Return the index of the last occurrance of inString that is not in this string. The search is backwards in the string

Parameters:
inString Unicode (NULL terminated) string we are looking for.
inIndex Starting index to being search at, default is the end of the string.
inLength Number of characters in string to use in search.
Exceptions:
none 
Returns:
UInt32 Location of last occurrance that is not in this string.

UInt32 CP_String::find_last_not_of const CP_String inString,
UInt32  inIndex = npos
const
 

Return the index of the last occurrance of inString that is not in this string. The search is backwards in the string

Parameters:
inString CP_String string we are looking for.
inIndex Starting index to being search at, default is the end of the string.
Exceptions:
none 
Returns:
UInt32 Location of last occurrance that is not in this string.

CP_String & CP_String::insert UInt32  inIndex,
CPUniChar  inChar
 

Insert the passed in Unicode character into this string starting at inIndex.

Parameters:
inIndex Location to begin inserting into this string.
inChar Unicode character to insert.
Exceptions:
CP_BoundsException raised if index is out of bounds.
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::insert UInt32  inIndex,
UInt32  inCount,
CPUniChar  inChar
 

Insert the passed in Unicode character into this string starting at inIndex and repeating inCount number of times.

Parameters:
inIndex Location to begin inserting into this string.
inIndex Number of times to insert the character.
inChar Unicode character to insert.
Exceptions:
CP_BoundsException raised if index is out of bounds.
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::insert UInt32  inIndex,
const char *  inString,
const CP_TextEncoder inTextEncoder = NULL
 

Insert the passed in c style (NULL terminated) string into this string starting at inIndex.

Parameters:
inIndex Location to begin inserting into this string.
inString c style (NULL terminated) string to insert.
Exceptions:
CP_BoundsException raised if index is out of bounds.
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::insert UInt32  inIndex,
const char *  inString,
UInt32  inLength,
const CP_TextEncoder inTextEncoder = NULL
 

Insert the passed in c style (NULL terminated) string into this string starting at inIndex and using inLength number of characters from the source string.

Parameters:
inIndex Location to begin inserting into this string.
inString c style (NULL terminated) string to insert.
inLength Number of characters to insert into this string from passed in string.
Exceptions:
CP_BoundsException raised if index is out of bounds.
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::insert UInt32  inIndex,
const CPUniChar inString
 

Insert the passed in Unicode (NULL terminated) string into this string starting at inIndex.

Parameters:
inIndex Location to begin inserting into this string.
inString Unicode (NULL terminated) string to insert.
Exceptions:
CP_BoundsException raised if index is out of bounds.
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::insert UInt32  inIndex,
const CPUniChar inString,
UInt32  inLength
 

Insert the passed in Unicode (NULL terminated) string into this string starting at inIndex and using inLength characters from the soruce string.

Parameters:
inIndex Location to begin inserting into this string.
inString Unicode (NULL terminated) string to insert.
inLength Number of characters to copy from the source string.
Exceptions:
CP_BoundsException raised if index is out of bounds.
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::insert UInt32  inIndex,
const CP_String inString,
UInt32  inStartIndex = 0,
UInt32  inLength = npos
 

Insert a portion of the passed in CP_String string into this string starting at inIndex in this string. The portion of the string begin used begins at inStartIndex into the passed in string, and uses inLength characters from that string.

Parameters:
inIndex Location to begin inserting into this string.
inString CP_String string to insert.
inStartIndex Number of characters to copy from the source string.
Exceptions:
CP_BoundsException raised if index is out of bounds.
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::replace UInt32  inIndex,
UInt32  inCount,
UInt32  inCharCount,
CPUniChar  inChar
 

Replaces some of the characers in this string with the passed in Unicode character. The passed in character replaces the characters in this string starting at inIndex and going for inCount length in this string. The passed in character is repeated inCharCount times.

Parameters:
inIndex Location to begin replacing in source from.
inCount Number of characters to remove in this string.
inCharCount Number of characters to copy in this string.
inChar The character that is replacing the contents with.
Exceptions:
CP_BoundsException raised if index is out of bounds.
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::replace UInt32  inIndex,
UInt32  inCount,
const char *  inString,
const CP_TextEncoder inTextEncoder = NULL
 

Replaces some of the characers in this string with the passed in c style (NULL terminated) string. The passed in character replaces the characters in this string starting at inIndex and going for inCount length in this string.

Parameters:
inIndex Location to begin replacing in source from.
inCount Number of characters to remove in this string.
inString c style (NULL terminated) string to replace characters from.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::replace UInt32  inIndex,
UInt32  inCount,
const char *  inString,
UInt32  inLength,
const CP_TextEncoder inTextEncoder = NULL
 

Replaces some of the characers in this string with the passed in c style (NULL terminated) string. The passed in character replaces the characters in this string starting at inIndex and going for inCount length in this string. Only the number of characters specified in inLength are used from the source string.

Parameters:
inIndex Location to begin replacing in source from.
inCount Number of characters to remove in this string.
inString c style (NULL terminated) string to replace characters from.
inLength Number of characters from source string to use.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::replace UInt32  inIndex,
UInt32  inCount,
const CPUniChar inString
 

Replaces some of the characers in this string with the passed in Unicode (NULL terminated) string. The passed in character replaces the characters in this string starting at inIndex and going for inCount length in this string.

Parameters:
inIndex Location to begin replacing in source from.
inCount Number of characters to remove in this string.
inString Unicode (NULL terminated) string to replace characters from.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::replace UInt32  inIndex,
UInt32  inCount,
const CPUniChar inString,
UInt32  inLength
 

Replaces some of the characers in this string with the passed in Unicode (NULL terminated) string. The passed in character replaces the characters in this string starting at inIndex and going for inCount length in this string. Only the number of characters specified in inLength are used from the source string.

Parameters:
inIndex Location to begin replacing in source from.
inCount Number of characters to remove in this string.
inString Unicode (NULL terminated) string to replace characters from.
inLength Number of characters from source string to use.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

CP_String & CP_String::replace UInt32  inIndex,
UInt32  inCount,
const CP_String inString,
UInt32  inStartIndex = 0,
UInt32  inLength = npos
 

Replaces some of the characers in this string with the passed in CP_String string. The passed in character replaces the characters in this string starting at inIndex and going for inCount length in this string. Only the number of characters specified in inLength are used from the source string, and starting at inStartIndex in the source string.

Parameters:
inIndex Location to begin replacing in source from.
inCount Number of characters to remove in this string.
inString CP_String string to replace characters from.
inStartIndex Beginning position in passed in string to copy from.
inLength Number of characters from source string to use.
Exceptions:
none 
Returns:
CP_String& Returns a reference to ourselves.

UInt32 CP_String::length  )  const
 

Returns the number of characters in this string.

Exceptions:
none 
Returns:
UInt32 Returns a count of the characters in this string.

UInt32 CP_String::size  )  const
 

void CP_String::resize UInt32  inNewSize  ) 
 

Resizes this string to hold the passed in number of characters. If the string is made shorter, then any extra characters are removed, and if the string is made longer, then extra space is added to the end of the existing string.

Parameters:
inNewSize Size (i.e. number of characters) to make this string.
Exceptions:
none 
Returns:
void

void CP_String::resize UInt32  inNewSize,
CPUniChar  inChar
 

Resizes this string to hold the passed in number of characters. If the string is made shorter, then any extra characters are remved, and if the string is made longer, then extra space is added to the end of the existing string.

Parameters:
inNewSize Size to make this string.
inChar Unicode character to insert in any blank space if string is made bigger.
Exceptions:
none 
Returns:
void

UInt32 CP_String::capacity  )  const
 

Return the capacity of this string. This is the amount of memory allocated at the moment, and might not be the same as the length/size returned.

Note:
For the Carbon implementation, the capacity is always equivalent to the size, since there is no notion of reserving space.
Exceptions:
none 
Returns:
UInt32 Capacity of the string. const version.

bool CP_String::Empty  )  const
 

Return true if this string contains 0 characters.

Exceptions:
none 
Returns:
bool const True if length == 0

bool CP_String::empty  )  const
 

Return true if this string contains 0 characters.

Exceptions:
none 
Returns:
bool const True if length == 0

void CP_String::clear  ) 
 

Clears out or erases all of the current content of the string, and makes this into a zero length string.

Exceptions:
none 
Returns:
void

CP_String::iterator CP_String::begin  ) 
 

Returns an iterator for accessing the contents of this string. The iterator points to the beginning of the string and is a forward_iterator.

Exceptions:
none 
Returns:
iterator forward_iterator non const version

CP_String::const_iterator CP_String::begin  )  const
 

Returns an iterator for accessing the contents of this string. The iterator points to the beginning of the string and is a forward_iterator.

Exceptions:
none 
Returns:
iterator forward_iterator const version

CP_String::iterator CP_String::end  ) 
 

Returns an iterator for accessing the contents of this string. The iterator points to the end of the string and is a forward_iterator.

Exceptions:
none 
Returns:
iterator forward_iterator non const version

CP_String::const_iterator CP_String::end  )  const
 

Returns an iterator for accessing the contents of this string. The iterator points to the end of the string and is a forward_iterator.

Exceptions:
none 
Returns:
iterator forward_iterator const version

CP_String::reverse_iterator CP_String::rbegin  ) 
 

Returns a reverse_iterator for accessing the contents of this string. The iterator points to the end of the string and is a reverse_iterator.

Exceptions:
none 
Returns:
iterator reverse_iterator non const version

CP_String::const_reverse_iterator CP_String::rbegin  )  const
 

Returns a reverse_iterator for accessing the contents of this string. The iterator points to the end of the string and is a reverse_iterator.

Exceptions:
none 
Returns:
iterator reverse_iterator const version

CP_String::reverse_iterator CP_String::rend  ) 
 

Returns a reverse_iterator for accessing the contents of this string. The iterator points to the end of the string and is a reverse_iterator.

Exceptions:
none 
Returns:
iterator reverse_iterator non const version

CP_String::const_reverse_iterator CP_String::rend  )  const
 

Returns a reverse_iterator for accessing the contents of this string. The iterator points to the end of the string and is a reverse_iterator.

Exceptions:
none 
Returns:
iterator reverse_iterator const version

CP_String CP_String::substr UInt32  inIndex = 0,
UInt32  inCount = npos
const
 

Return a string containing a portion of this string.

Parameters:
inIndex Starting index to return. Defaults to beginning of string.
inLength Number of characters to return. Default is to use entire string.
Exceptions:
none 
Returns:
CP_String const String containing a the substring of this string.

UInt32 CP_String::copy char *  inOutBuffer,
UInt32  inBufferSize,
UInt32  inCount,
UInt32 *  outUsedBufferSize,
UInt32  inIndex = 0,
const CP_TextEncoder inTextEncoder = NULL,
bool  inLossy = false
const
 

Copy some characters from our string into the passed in char * inOutBuffer.

Parameters:
inOutBuffer Buffer to hold the data we are copying.
inBufferSize The maximum number of bytes the provided buffer can hold.
inCount Number of characters to copy to the passed in buffer. Pass npos to copy all remaining characters.
outUsedBufferSize On exit will hold the number of bytes actually copied into the buffer. Pass NULL if you're not interested.
inIndex Location of first character to begin copying from.
inTextEncoder Text encoder to use when encoding the characters from UTF-16. Pass NULL to use the default text encoder.
inLossy If true, characters that can't be encoded in the specified encoding will be replaced by a replacement character. If false an exception will be raised in that case.
Exceptions:
std::bad_cast if non-lossy conversion fails because some characters can't be encoded in the specified encoding.
CP_BoundsException if index is out of range.
Returns:
UInt32 Number of actual characters copied. This number could be less than inCount if the string hold less data than requested.

UInt32 CP_String::copy CPUniChar inOutBuffer,
UInt32  inCount,
UInt32  inIndex = 0
const
 

Copy some characters from our string into the passed in Unicode * inOutBuffer. Determines the effective length rlen of the string to copy as the smaller of inCount and size(). inOutBuffer shall designate an array of at least rlen elements. The function then copies rlen characters starting at index into the buffer provided.

Parameters:
inOutBuffer Buffer to hold the data we are copying.
inCount Number of characters to copy to the passed in buffer.
inIndex Location of first character to begin copying from.
Exceptions:
CP_BoundsException if index is out of bounds.
Returns:
UInt32 Number of actual characters copied. This number could be less than inCount if the string hold less data than requested.

void CP_String::swap CP_String inString  ) 
 

Swap the contents of the passed in string with the contents of ourselves.

Parameters:
inString CP_String to swap the contents with.
Exceptions:
none 
Returns:
void

void CP_String::reserve UInt32  inCapacity  ) 
 

Reserve space to hold the passed in number of characters in our string.

Note:
For the Carbon implementation, this function does nothing as there is no notion of reserving space in CoreFoundation strings.
Parameters:
inCapacity Amount of space we want to reserve.
Exceptions:
none 
Returns:
void

void CP_String::Set const unsigned char *  inPString,
CFStringEncoding  inEncoding
 

void CP_String::Substring CFRange  inRange,
CPUniChar outBuffer
const
 

Return a portion of this string in the passed in outBuffer.

Parameters:
inRange CFRange of characters to retrieve.
outBuffer Buffer to hold the returned data.
Exceptions:
none 
Returns:
void

void CP_String::AssertUniqueMutableCFStringRef  )  [protected]
 

Make sure our CoreFoundation string ref is mutable and has a retain count of 1 (i.e. we're the only one referencing it). If it isn't, create a mutable copy that we can work on (copy-on-write).
When this function completes, fMutableString points to a CFMutableStringRef that is used by nobody else and can freely be modified.

Exceptions:
CP_OSErrorException(coreFoundationUnknownErr) raised if converting immutable string to mutable string fails.
Returns:
CP_ResourcePtr const A CP_ResourcePtr that contains the CFMutableStringRef for the string.


Friends And Related Function Documentation

CP_String operator+ const CP_String inLeftSide,
const CP_String inRightSide
[friend]
 

Combines the contents of the passed in strings to each other and returns a new string.

Parameters:
inLeftSide First portion of the string.
inRightSide Second portion of the string. This is the portion of the string added to the passed in inLeftSide.
Exceptions:
none 
Returns:
CP_String Returns a new string containing the 2 passed in strings.

CP_String operator+ const CPUniChar inLeftSide,
const CP_String inRightSide
[friend]
 

Combines the contents of the passed in strings to each other and returns a new string.

Parameters:
inLeftSide First portion of the string as a Unicode string.
inRightSide Second portion of the string. This is the portion of the string added to the passed in inLeftSide.
Exceptions:
none 
Returns:
CP_String Returns a new string containing the 2 passed in strings.

CP_String operator+ CPUniChar  inLeftSide,
const CP_String inRightSide
[friend]
 

Combines the contents of the passed in strings to each other and returns a new string.

Parameters:
inLeftSide Single Unicode character to start new string.
inRightSide Second portion of the string. This is the portion of the string added to the passed in inLeftSide.
Exceptions:
none 
Returns:
CP_String Returns a new string containing the 2 passed in strings.

CP_String operator+ const CP_String inLeftSide,
const CPUniChar inRightSide
[friend]
 

Combines the contents of the passed in strings to each other and returns a new string.

Parameters:
inLeftSide First portion of the string.
inRightSide Second portion of the string. This is the portion of the string added to the passed in inLeftSide. The contents are a Unicode NULL terminated string.
Exceptions:
none 
Returns:
CP_String Returns a new string containing the 2 passed in strings.

CP_String operator+ const CP_String inLeftSide,
CPUniChar  inRightSide
[friend]
 

Combines the contents of the passed in strings to each other and returns a new string.

Parameters:
inLeftSide First portion of the string as a CP_String.
inRightSide Second portion of the string. This is the portion of the string added to the passed in inLeftSide. This is a single CPUniChar.
Exceptions:
none 
Returns:
CP_String Returns a new string containing the 2 passed in strings.

bool operator== char  inLeftSide,
const CP_String inRightSide
[friend]
 

Compares the passed in inLeftSide character to the contents of the passed in CP_String.

Parameters:
inLeftSide Character to compare against second parameter.
inRightSide CP_String that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide == inRightSide, otherwise false is returned.

bool operator== const char *  inLeftSide,
const CP_String inRightSide
[friend]
 

Compares the passed in inLeftSide Unicode character string to the contents of the passed in CP_String.

Parameters:
inLeftSide Character string to compare against second parameter.
inRightSide CP_String that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide == inRightSide, otherwise false is returned.

bool operator== CPUniChar  inLeftSide,
const CP_String inRightSide
[friend]
 

Compares the passed in inLeftSide character to the contents of the passed in CP_String.

Parameters:
inLeftSide Unicode character to compare against second parameter.
inRightSide CP_String that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide == inRightSide, otherwise false is returned.

bool operator== const CPUniChar inLeftSide,
const CP_String inRightSide
[friend]
 

Compares the passed in inLeftSide Unicode character string to the contents of the passed in CP_String.

Parameters:
inLeftSide Unicode character string to compare against second parameter.
inRightSide CP_String that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide == inRightSide, otherwise false is returned.

bool operator== const CP_String inLeftSide,
CPUniChar  inRightSide
[friend]
 

Compares the passed in inLeftSide CP_String to the Unicode character.

Parameters:
inLeftSide CP_String to compare against second parameter.
inRightSide Unicode character that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide == inRightSide, otherwise false is returned.

bool operator== const CP_String inLeftSide,
const char *  inRightSide
[friend]
 

Compares the passed in inLeftSide CP_String to the Unicode character.

Parameters:
inLeftSide CP_String to compare against second parameter.
inRightSide char * string (NULL terminated) that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide == inRightSide, otherwise false is returned.

bool operator== const CP_String inLeftSide,
const CPUniChar inRightSide
[friend]
 

Compares the passed in inLeftSide CP_String to the Unicode character string.

Parameters:
inLeftSide CP_String to compare against second parameter.
inRightSide Unicode character string (NULL terminated) that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide == inRightSide, otherwise false is returned.

bool operator== const CP_String inLeftSide,
const CP_String inRightSide
[friend]
 

Compares the passed in inLeftSide CP_String to the passed in CP_String.

Parameters:
inLeftSide CP_String to compare against second parameter.
inRightSide CP_String that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide == inRightSide, otherwise false is returned.

bool operator!= CPUniChar  inLeftSide,
const CP_String inRightSide
[friend]
 

Compares the passed in inLeftSide character to the contents of the passed in CP_String.

Parameters:
inLeftSide Unicode character to compare against second parameter.
inRightSide CP_String that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide != inRightSide, otherwise false is returned.

bool operator!= const CPUniChar inLeftSide,
const CP_String inRightSide
[friend]
 

Compares the passed in inLeftSide Unicode character string to the contents of the passed in CP_String.

Parameters:
inLeftSide Unicode character string to compare against second parameter.
inRightSide CP_String that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide != inRightSide, otherwise false is returned.

bool operator!= const CP_String inLeftSide,
CPUniChar  inRightSide
[friend]
 

Compares the passed in inLeftSide CP_String to the Unicode character.

Parameters:
inLeftSide CP_String to compare against second parameter.
inRightSide Unicode character that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide != inRightSide, otherwise false is returned.

bool operator!= const CP_String inLeftSide,
const char *  inRightSide
[friend]
 

Compares the passed in inLeftSide CP_String to the Unicode character.

Parameters:
inLeftSide CP_String to compare against second parameter.
inRightSide char * string (NULL terminated) that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide != inRightSide, otherwise false is returned.

bool operator!= const CP_String inLeftSide,
const CPUniChar inRightSide
[friend]
 

Compares the passed in inLeftSide CP_String to the Unicode character string.

Parameters:
inLeftSide CP_String to compare against second parameter.
inRightSide Unicode character string (NULL terminated) that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide != inRightSide, otherwise false is returned.

bool operator!= const CP_String inLeftSide,
const CP_String inRightSide
[friend]
 

Compares the passed in inLeftSide CP_String to the passed in CP_String.

Parameters:
inLeftSide CP_String to compare against second parameter.
inRightSide CP_String that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide != inRightSide, otherwise false is returned.

bool operator< const CP_String inLeftSide,
const CP_String inRightSide
[friend]
 

Compares the passed in inLeftSide CP_String to the passed in CP_String.

Parameters:
inLeftSide CP_String to compare against second parameter.
inRightSide CP_String that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide < inRightSide, otherwise false is returned.

bool operator<= const CP_String inLeftSide,
const CP_String inRightSide
[friend]
 

Compares the passed in inLeftSide CP_String to the passed in CP_String.

Parameters:
inLeftSide CP_String to compare against second parameter.
inRightSide CP_String that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide <= inRightSide, otherwise false is returned.

bool operator> const CP_String inLeftSide,
const CP_String inRightSide
[friend]
 

Compares the passed in inLeftSide CP_String to the passed in CP_String.

Parameters:
inLeftSide CP_String to compare against second parameter.
inRightSide CP_String that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide > inRightSide, otherwise false is returned.

bool operator>= const CP_String inLeftSide,
const CP_String inRightSide
[friend]
 

Compares the passed in inLeftSide CP_String to the passed in CP_String.

Parameters:
inLeftSide CP_String to compare against second parameter.
nRightSide CP_String that is compared against.
Exceptions:
none 
Returns:
bool Returns true if inLeftSide >= inRightSide, otherwise false is returned.


Member Data Documentation

const CP_String CP_String::emptyString [static]
 

char* CP_String::fCStringDataPtr [mutable, protected]
 

Pointer to buffer returned for calls to c_str().

UInt32 CP_String::fCStringDataCapacity [mutable, protected]
 

Amount of data our c style string member can hold (excluding terminating zero character).

bool CP_String::fDirty [mutable, protected]
 

Flag to indicate if our return buffers need to be rebuilt.

CFStringRef CP_String::fImmutableString [protected]
 

CoreFoundation CFString holding our string data. Only one of fImmutableString and fMutableString are != NULL at any time, depending on the mutability of the string.

CFMutableStringRef CP_String::fMutableString [protected]
 

CoreFoundation CFString holding our string data. Only one of fImmutableString and fMutableString are != NULL at any time, depending on the mutability of the string.

CPUniChar* CP_String::fStringData [mutable, protected]
 

Pointer to buffer returned for calls to w_str().

UInt32 CP_String::fStringDataCapacity [mutable, protected]
 

Number of characters our fStringData member can hold (excluding terminating zero character).


The documentation for this class was generated from the following files:
Generated on Tue Sep 20 20:22:11 2005 for CPLAT_MacOS by  doxygen 1.4.0