|
Unicorn XML Toolkit Version 1.50.00 |
|||||||||
� PREV CLASS �� NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |
class CString { public: CString(); CString(const CString& strSrc); CString(WCHAR ch, int nRepeat=1); CString(const WCHAR *pch, int nLength); CString(const WCHAR *psz); CString(char *psz); CString(const wstring &wstr); ~CString(); public: int GetLength() const; bool IsEmpty() const; void Empty(); WCHAR GetAt(int nIndex) const; WCHAR operator [](int nIndex) const; void SetAt(int nIndex, WCHAR ch); operator PCWSTR() const; const CString& operator=(const CString& strSrc); const CString& operator=(const WCHAR ch); const CString& operator=(const WCHAR *psz); const CString& operator=(char *psz); friend CString operator+( const CString &str1, const CString &str2); friend CString operator+(const CString &str, WCHAR ch); friend CString operator+(WCHAR ch, const CString &str); friend CString operator+(const CString &str, const WCHAR *psz); friend CString operator+(const WCHAR *psz, const CString &str); const CString &operator+=(const CString &str); const CString &operator+=(WCHAR ch); const CString &operator+=(const WCHAR *psz); friend bool operator==(const CString &str1, const CString &str2); friend bool operator==(const CString &str1, const WCHAR *psz2); friend bool operator==(const WCHAR *psz1, const CString &str2); friend bool operator!=(const CString &str1, const CString &str2); friend bool operator!=(const CString &str1, const WCHAR *psz2); friend bool operator!=(const WCHAR *psz1, const CString &str2); friend bool operator<(const CString &str1, const CString &str2); friend bool operator<(const CString &str1, const WCHAR *psz2); friend bool operator<(const WCHAR *psz1, const CString &str2); friend bool operator>(const CString &str1, const CString &str2); friend bool operator>(const CString &str1, const WCHAR *psz2); friend bool operator>(const WCHAR *psz1, const CString &str2); friend bool operator<=(const CString &str1, const CString &str2); friend bool operator<=(const CString &str1, const WCHAR *psz2); friend bool operator<=(const WCHAR *psz1, const CString &str2); friend bool operator>=(const CString &str1, const CString &str2); friend bool operator>=(const CString &str1, const WCHAR *psz2); friend bool operator>=(const WCHAR *psz1, const CString &str2); int Compare(const WCHAR *psz) const; int CompareNoCase(const WCHAR *psz) const; CString Mid(int nFirst) const; CString Mid(int nFirst, int nCount) const; CString Left(int nCount) const; CString Right(int nCount) const; void MakeUpper(); void MakeLower(); void MakeReverse(); void TrimLeft(); void TrimRight(); int Find(WCHAR ch) const; int Find(const WCHAR *pszSub) const; };
The string of 16-bit characters.
This class is built on the top of the class
wstring
from the C++ Standard Template Library (STL).
Constructor/Destructor Summary | |
CString
();
����������Constructs the empty string |
|
CString
(const CString& strSrc);
����������Constructs the string copying another string. |
|
CString
(WCHAR ch, int nRepeat=1);
����������Constructs the string containing the specified character in all positions. |
|
CString
(const WCHAR *pch, int nLength);
����������Constructs the string from the array of 16-bit characters. |
|
CString
(const WCHAR *psz);
����������Constructs the string from the null-terminated array of 16-bit characters. |
|
CString
(char *psz);
����������Constructs the string from the null-terminated array of 8-bit characters. |
|
CString
(const wstring &wstr);
����������Constructs the string from the STL wide string. |
|
~CString
();
����������Destroys the string. |
Function Summary | |
int
|
GetLength
() const;
����������Returns the length of this string. |
bool
|
IsEmpty
() const;
����������Tests whether this string is empty (contains no characters). |
void
|
Empty
();
����������Removes all characters from this string. |
WCHAR
|
GetAt
(int nIndex) const;
����������Returns the character at the specified index in this string. |
WCHAR
|
operator []
(int nIndex) const;
����������Returns the character at the specified index in this string. |
void
|
SetAt
(int nIndex, WCHAR ch);
����������Sets the specified character at the specified index in this string. |
operator
|
PCWSTR
() const;
����������Returns the null-terminated array of all characters contained in this string. |
const�CString&
|
operator=
(const CString& strSrc);
����������Assigns the specified string to this string. |
const�CString&
|
operator=
(const WCHAR ch);
����������Assigns a string containing the specified single character to this string. |
const�CString&
|
operator=
(const WCHAR *psz);
����������Assigns the null-terminated array of 16-bit characters to this string. |
const�CString&
|
operator=
(char *psz);
����������Assigns the null-terminated array of 8-bit characters to this string. |
CString
|
operator+
(const CString &str1, const CString &str2);
����������Concatenates two strings. |
CString
|
operator+
(const CString &str, WCHAR ch);
����������Concatenates a string and a character. |
CString
|
operator+
(WCHAR ch, const CString &str);
����������Concatenates a character and a string. |
CString
|
operator+
(const CString &str, const WCHAR *psz);
����������Concatenates a string and a null-terminated array of characters. |
CString
|
operator+
(const WCHAR *psz, const CString &str);
����������Concatenates a null-terminated array of characters and a string. |
const�CString�&
|
operator+=
(const CString &str);
����������Appends the specified string to the end of this string. |
const�CString�&
|
operator+=
(WCHAR ch);
����������Appends the specified character to the end of this string. |
const�CString�&
|
operator+=
(const WCHAR *psz);
����������Appends the specified null-terminated array of characters to the end of this string. |
bool
|
operator==
(const CString &str1, const CString &str2);
����������Performs the equality comparison operation on two strings. |
bool
|
operator==
(const CString &str1, const WCHAR *psz2);
����������Performs the equality comparison operation on a string and a null-terminated array of characters. |
bool
|
operator==
(const WCHAR *psz1, const CString &str2);
����������Performs the equality comparison operation on a null-terminated array of characters and a string. |
bool
|
operator!=
(const CString &str1, const CString &str2);
����������Performs the non-equality comparison operation on two strings. |
bool
|
operator!=
(const CString &str1, const WCHAR *psz2);
����������Performs the non-equality comparison operation on a string and a null-terminated array of characters. |
bool
|
operator!=
(const WCHAR *psz1, const CString &str2);
����������Performs the non-equality comparison operation on a null-terminated array of characters and a string. |
bool
|
operator<
(const CString &str1, const CString &str2);
����������Performs the less-than comparison operation on two strings. |
bool
|
operator<
(const CString &str1, const WCHAR *psz2);
����������Performs the less-than comparison operation on a string and a null-terminated array of characters. |
bool
|
operator<
(const WCHAR *psz1, const CString &str2);
����������Performs the less-than comparison operation on a null-terminated array of characters and a string. |
bool
|
operator>
(const CString &str1, const CString &str2);
����������Performs the greater-than comparison operation on two strings. |
bool
|
operator>
(const CString &str1, const WCHAR *psz2);
����������Performs the greater-than comparison operation on a string and a null-terminated array of characters. |
bool
|
operator>
(const WCHAR *psz1, const CString &str2);
����������Performs the greater-than comparison operation on a null-terminated array of characters and a string. |
bool
|
operator<=
(const CString &str1, const CString &str2);
����������Performs the less-than-or-equal comparison operation on two strings. |
bool
|
operator<=
(const CString &str1, const WCHAR *psz2);
����������Performs the less-than-or-equal comparison operation on a string and a null-terminated array of characters. |
bool
|
operator<=
(const WCHAR *psz1, const CString &str2);
����������Performs the less-than-or-equal comparison operation on a null-terminated array of characters and a string. |
bool
|
operator>=
(const CString &str1, const CString &str2);
����������Performs the greater-than-or-equal comparison operation on two strings. |
bool
|
operator>=
(const CString &str1, const WCHAR *psz2);
����������Performs the greater-than-or-equal comparison operation on a string and a null-terminated array of characters. |
bool
|
operator>=
(const WCHAR *psz1, const CString &str2);
����������Performs the greater-than-or-equal comparison operation on a null-terminated array of characters and a string. |
int
|
Compare
(const WCHAR *psz) const;
����������Compares this string with the null-terminated array of charcters. |
int
|
CompareNoCase
(const WCHAR *psz) const;
����������Compares, ignoring case, this string with the null-terminated array of charcters. |
CString
|
Mid
(int nFirst) const;
����������Extracts the trailing part of this string. |
CString
|
Mid
(int nFirst, int nCount) const;
����������Extracts the middle part of this string. |
CString
|
Left
(int nCount) const;
����������Extracts the left part of this string. |
CString
|
Right
(int nCount) const;
����������Extracts the right part of this string. |
void
|
MakeUpper
();
����������Converts content of this string to an upper case. |
void
|
MakeLower
();
����������Converts content of this string to a lower case. |
void
|
MakeReverse
();
����������Places content of this string in a reverse order. |
void
|
TrimLeft
();
����������Removes leading whitespaces in the content of this string. |
void
|
TrimRight
();
����������Removes trailing whitespaces in the content of this string. |
int
|
Find
(WCHAR ch) const;
����������Searches for the first occurence of the specified character in this string. |
int
|
Find
(const WCHAR *pszSub) const;
����������Searches for the first occurence of the specified null-terminated character array in this string. |
Constructor/Destructor Detail |
CString();
Constructs the empty string
CString(const CString& strSrc);
Constructs the string copying another string.
strSrc
- the string to copyCString(WCHAR ch, int nRepeat=1);
Constructs the string containing the specified character in all positions.
ch
- the characternRepeat
- the repeat counterCString(const WCHAR *pch, int nLength);
Constructs the string from the array of 16-bit characters.
pch
- the array of charactersnLength
- the number of characters in the arrayCString(const WCHAR *psz);
Constructs the string from the null-terminated array of 16-bit characters.
psz
- the array of characters (null-terminated)CString(char *psz);
Constructs the string from the null-terminated array of 8-bit characters.
psz
- the array of characters (null-terminated)CString(const wstring &wstr);
Constructs the string from the STL wide string.
wstr
- the STL wide string~CString();
Destroys the string.
Function Detail |
int GetLength() const;
Returns the length of this string.
bool IsEmpty() const;
Tests whether this string is empty (contains no characters).
true
if this string is empty;
false
otherwisevoid Empty();
Removes all characters from this string.
WCHAR GetAt(int nIndex) const;
Returns the character at the specified index in this string.
The result is unspecified in the index is out of range.
nIndex
- the index (zero-based)WCHAR operator [](int nIndex) const;
Returns the character at the specified index in this string.
The result is unspecified in the index is out of range.
nIndex
- the index (zero-based)void SetAt(int nIndex, WCHAR ch);
Sets the specified character at the specified index in this string.
nIndex
- the index (zero-based)ch
- the characteroperator PCWSTR() const;
Returns the null-terminated array of all characters contained in this string.
This array may become invalid after any update operation performed on this string.
const CString& operator=(const CString& strSrc);
Assigns the specified string to this string.
strSrc
- the string to assignconst CString& operator=(const WCHAR ch);
Assigns a string containing the specified single character to this string.
ch
- the character to assignconst CString& operator=(const WCHAR *psz);
Assigns the null-terminated array of 16-bit characters to this string.
psz
- the null-terminated array of characters
to assignconst CString& operator=(char *psz);
Assigns the null-terminated array of 8-bit characters to this string.
psz
- the null-terminated array of characters
to assignfriend CString operator+( const CString &str1, const CString &str2);
Concatenates two strings.
str1
- the first stringstr2
- the second stringfriend CString operator+(const CString &str, WCHAR ch);
Concatenates a string and a character.
str
- the stringch
- the characterfriend CString operator+(WCHAR ch, const CString &str);
Concatenates a character and a string.
ch
- the characterstr
- the stringfriend CString operator+(const CString &str, const WCHAR *psz);
Concatenates a string and a null-terminated array of characters.
str
- the stringpsz
- the null-terminated array of charactersfriend CString operator+(const WCHAR *psz, const CString &str);
Concatenates a null-terminated array of characters and a string.
psz
- the null-terminated array of charactersstr
- the stringconst CString &operator+=(const CString &str);
Appends the specified string to the end of this string.
str
- the string to appendconst CString &operator+=(WCHAR ch);
Appends the specified character to the end of this string.
ch
- the character to appendconst CString &operator+=(const WCHAR *psz);
Appends the specified null-terminated array of characters to the end of this string.
psz
- the null-terminated array of characters
to appendfriend bool operator==(const CString &str1, const CString &str2);
Performs the equality comparison operation on two strings.
str1
- the first stringstr2
- the second stringfriend bool operator==(const CString &str1, const WCHAR *psz2);
Performs the equality comparison operation on a string and a null-terminated array of characters.
str1
- the stringpsz2
- the null-terminated array of charactersfriend bool operator==(const WCHAR *psz1, const CString &str2);
Performs the equality comparison operation on a null-terminated array of characters and a string.
psz1
- the null-terminated array of charactersstr2
- the stringfriend bool operator!=(const CString &str1, const CString &str2);
Performs the non-equality comparison operation on two strings.
str1
- the first stringstr2
- the second stringfriend bool operator!=(const CString &str1, const WCHAR *psz2);
Performs the non-equality comparison operation on a string and a null-terminated array of characters.
str1
- the stringpsz2
- the null-terminated array of charactersfriend bool operator!=(const WCHAR *psz1, const CString &str2);
Performs the non-equality comparison operation on a null-terminated array of characters and a string.
psz1
- the null-terminated array of charactersstr2
- the stringfriend bool operator<(const CString &str1, const CString &str2);
Performs the less-than comparison operation on two strings.
str1
- the first stringstr2
- the second stringfriend bool operator<(const CString &str1, const WCHAR *psz2);
Performs the less-than comparison operation on a string and a null-terminated array of characters.
str1
- the stringpsz2
- the null-terminated array of charactersfriend bool operator<(const WCHAR *psz1, const CString &str2);
Performs the less-than comparison operation on a null-terminated array of characters and a string.
psz1
- the null-terminated array of charactersstr2
- the stringfriend bool operator>(const CString &str1, const CString &str2);
Performs the greater-than comparison operation on two strings.
str1
- the first stringstr2
- the second stringfriend bool operator>(const CString &str1, const WCHAR *psz2);
Performs the greater-than comparison operation on a string and a null-terminated array of characters.
str1
- the stringpsz2
- the null-terminated array of charactersfriend bool operator>(const WCHAR *psz1, const CString &str2);
Performs the greater-than comparison operation on a null-terminated array of characters and a string.
psz1
- the null-terminated array of charactersstr2
- the stringfriend bool operator<=(const CString &str1, const CString &str2);
Performs the less-than-or-equal comparison operation on two strings.
str1
- the first stringstr2
- the second stringfriend bool operator<=(const CString &str1, const WCHAR *psz2);
Performs the less-than-or-equal comparison operation on a string and a null-terminated array of characters.
str1
- the stringpsz2
- the null-terminated array of charactersfriend bool operator<=(const WCHAR *psz1, const CString &str2);
Performs the less-than-or-equal comparison operation on a null-terminated array of characters and a string.
psz1
- the null-terminated array of charactersstr2
- the stringfriend bool operator>=(const CString &str1, const CString &str2);
Performs the greater-than-or-equal comparison operation on two strings.
str1
- the first stringstr2
- the second stringfriend bool operator>=(const CString &str1, const WCHAR *psz2);
Performs the greater-than-or-equal comparison operation on a string and a null-terminated array of characters.
str1
- the stringpsz2
- the null-terminated array of charactersfriend bool operator>=(const WCHAR *psz1, const CString &str2);
Performs the greater-than-or-equal comparison operation on a null-terminated array of characters and a string.
psz1
- the null-terminated array of charactersstr2
- the stringint Compare(const WCHAR *psz) const;
Compares this string with the null-terminated array of charcters.
This function returns a negative integer if this string is less than the string represented by the specified array, a positive integer if this string is greater than the string represented by the specified array, and zero if this string and the string represented by the specified array are equal.
psz
- the null-terminated array of charactersint CompareNoCase(const WCHAR *psz) const;
Compares, ignoring case, this string with the null-terminated array of charcters.
This function returns a negative integer if this string is less than the string represented by the specified array, a positive integer if this string is greater than the string represented by the specified array, and zero if this string and the string represented by the specified array are equal.
psz
- the null-terminated array of charactersCString Mid(int nFirst) const;
Extracts the trailing part of this string.
nFirst
- the index (zero-based) of the first
character of the part to extractCString Mid(int nFirst, int nCount) const;
Extracts the middle part of this string.
nFirst
- the index (zero-based) of the first
character of the part to extractnCount
- the number of characters to extractCString Left(int nCount) const;
Extracts the left part of this string.
nCount
- the number of characters to extractCString Right(int nCount) const;
Extracts the right part of this string.
nCount
- the number of characters to extractvoid MakeUpper();
Converts content of this string to an upper case.
void MakeLower();
Converts content of this string to a lower case.
void MakeReverse();
Places content of this string in a reverse order.
void TrimLeft();
Removes leading whitespaces in the content of this string.
void TrimRight();
Removes trailing whitespaces in the content of this string.
int Find(WCHAR ch) const;
Searches for the first occurence of the specified character in this string.
ch
- the character to search-1
if none was foundint Find(const WCHAR *pszSub) const;
Searches for the first occurence of the specified null-terminated character array in this string.
pszSub
- the null-terminated character array
to search-1
if none was found
|
Unicorn XML Toolkit Version 1.50.00 |
|||||||||
� PREV CLASS �� NEXT CLASS | FRAMES��NO FRAMES | |||||||||
SUMMARY: � CONSTR �|� FUNCTION �|�DATA | DETAIL: � CONSTR �|� FUNCTION �|�DATA |