#include <CHMstring.h>
Because Chameleon is cross platform is it necessary to use a string class which is independent of the various compilers, operating systems, and C++ class libraries we support. This string is efficiently implemented with reference counting.
Public Types | |
enum | StripType { Leading, Trailing, Both } |
Used as an argument for the strip function to specify its behavior. More... | |
Public Member Functions | |
CHMstring (void) | |
Construct an empty string. | |
CHMstring (const CHMstring &s) | |
Copy constructor. | |
CHMstring (const CHMstring &s, const size_t &orig, const size_t &n=npos) | |
Construct a string from a substring of the string s starting at index orig for n characters. | |
CHMstring (const CHMchar *cp) | |
Construct a string from a null terminated string cp . | |
CHMstring (const CHMchar *cp, const size_t &orig, const size_t &n=npos) | |
Construct a string from a substring of a null terminated string cp starting at index orig for n characters. | |
CHMstring (CHMchar c) | |
Construct a string from the character c . | |
CHMstring (size_t n, CHMchar c) | |
Construct a string that consists of n characters of type c . | |
~CHMstring (void) | |
Destructor. | |
CHMstring & | operator= (const CHMstring &s) |
Assignment operator. | |
CHMstring & | operator+= (const CHMchar *cp) |
Concatenation operator for adding a null terminated string to this string. | |
CHMstring & | operator+= (const CHMstring &s) |
Concatenation operator for adding another string to this string. | |
const CHMchar | operator[] (const size_t &pos) const |
Const operator [pos] returns the character at index pos in this string. | |
CHMchar & | operator[] (const size_t &pos) |
Non-const operator [pos] returns the character at index pos in this string. | |
CHMstring & | append (const CHMchar *cp, const size_t &orig=0, const size_t &n=npos) |
Append the null terminated string cp of size n to this string at index orig . | |
CHMstring & | append (size_t SizeOfBuffer, const CHMchar *Buffer) |
Append the first SizeOfBuffer characters from Buffer to this string. | |
CHMstring & | append (const CHMstring &s, const size_t &orig=0, const size_t &n=npos) |
Append string s of size n to this string at index orig . | |
void | assign (size_t n, CHMchar Filler) |
Change this string to consist of an array of n characters of type Filler . | |
const CHMchar * | c_str (void) const |
Get a const CHMchar pointer to the buffer of this string object. | |
void | clear (void) |
Clear this string. | |
int | compare (const CHMchar *Compare) const |
Compare this string for equality to the null terminated string Compare . | |
int | compare (const CHMstring &s) const |
Compare this string for equality to another string s . | |
const size_t | find (const CHMstring &s, const size_t &pos=0) const |
Find the first instance of string s from index pos in this string. | |
CHMchar * | get_buffer (void) |
Get a non-const CHMchar pointer to the buffer of this string. | |
CHMstring & | insert (size_t pos, const CHMchar *cp, const size_t &orig=0, const size_t &n=npos) |
Insert the null terminated string cp of length n starting at index orig into this string at index pos . | |
CHMstring & | insert (size_t pos, const CHMstring &s, const size_t &orig=0, const size_t &n=npos) |
Insert the string s of length n starting at index orig into this string at index pos . | |
const CHMboolean | is_null (void) const |
Check if this string is empty. | |
CHMstring & | prepend (const CHMchar *cp, const size_t &orig=0, const size_t &n=npos) |
Prepend the null terminated string cp of size n to this string at index orig . | |
CHMstring & | prepend (const CHMstring &s, const size_t &orig=0, const size_t &n=npos) |
Prepend the string s of size n to this string at index orig . | |
CHMstring & | remove (const size_t &pos, const size_t &n=npos) |
Remove the substring starting at index pos of length n from this string. | |
CHMstring & | replace (const size_t &pos, const size_t &n1, const CHMstring &s, const size_t &orig=0, const size_t &n2=npos) |
Replace the substring of size n1 starting at index pos with string s of size n2 starting at index orig . | |
const size_t | rfind (const CHMstring &s, const size_t &pos) const |
Find the first instance of string s searching backwards through this string from index pos . | |
const size_t | rfind (const CHMstring &s) const |
Find the first instance of string s searching backwards through this string. | |
const size_t & | size (void) const |
Get the length of this string. | |
CHMstring | strip (const StripType &s=Trailing, const CHMchar &c= ' ') const |
Strip char c from the beginning or the end or from both ends of this string depending on the value of the enumerator StripType . | |
void | stripAll (const CHMchar &c= ' ') |
Strip all copies of char c from this string. | |
void | subChar (const CHMchar pTarget, const CHMchar pReplacement) |
Substitute characters of type pTarget with those of pReplacement . | |
CHMstring | substr (const size_t &pos, const size_t &n=npos) const |
Get the substring at index pos of n characters in length or until the end of the original string has been reached. |
|
Used as an argument for the strip function to specify its behavior.
|
|
Construct an empty string.
|
|
Copy constructor.
|
|
Construct a string from a substring of the string
|
|
Construct a string from a null terminated string
|
|
Construct a string from a substring of a null terminated string
|
|
Construct a string from the character
|
|
Construct a string that consists of
|
|
Destructor.
|
|
Append string Returns the resulting string. |
|
Append the first
|
|
Append the null terminated string Returns the resulting string. |
|
Change
|
|
Get a const CHMchar pointer to the buffer of The caller is not allowed to write to this buffer since other string objects may be referencing it. |
|
Clear
|
|
Compare
This method invokes the standard C |
|
Compare
This method invokes the standard C |
|
Find the first instance of string
Returns the index of the string if found; otherwise, returns |
|
Get a non-const CHMchar pointer to the buffer of The caller is allowed to write to the buffer since this call ensures that no other strings reference the buffer. |
|
Insert the string Returns the resulting string. |
|
Insert the null terminated string Returns the resulting string. |
|
Check if
|
|
Concatenation operator for adding another string to
|
|
Concatenation operator for adding a null terminated string to
|
|
Assignment operator.
|
|
Non-const operator
|
|
Const operator
|
|
Prepend the string Returns the resulting string. |
|
Prepend the null terminated string Returns the resulting string. |
|
Remove the substring starting at index Returns the resulting string. |
|
Replace the substring of size
|
|
Find the first instance of string
Returns the index of the string if found; otherwise, returns |
|
Find the first instance of string
Returns the index of the string if found; otherwise, returns |
|
Get the length of
|
|
Strip char Returns the resulting string. |
|
Strip all copies of char
|
|
Substitute characters of type
|
|
Get the substring at index
|