Foxit PDF SDK
|
WIDE STRING CLASS. More...
Inherits CFX_Object.
Public Member Functions | |
CFX_WideString () | |
Construct a null wide string. | |
CFX_WideString (const CFX_WideString &str) | |
Copy constructor. More... | |
CFX_WideString (FX_LPCWSTR ptr, FX_STRSIZE len=-1) | |
Construct from a wide character string. More... | |
CFX_WideString (FX_WCHAR ch) | |
Construct from a single wide character. More... | |
CFX_WideString (const CFX_WideStringC &str) | |
Construct from a constant ref to a CFX_WideStringC object. More... | |
CFX_WideString (const CFX_WideStringC &str1, const CFX_WideStringC &str2) | |
Concatenate constructor. More... | |
~CFX_WideString () | |
The Destructor. | |
int | Compare (FX_LPCWSTR str) const |
Compare current string with a wide character string. Case-sensitive. More... | |
int | Compare (const CFX_WideString &str) const |
Compare the the string with another. Case-sensitive. More... | |
int | CompareNoCase (FX_LPCWSTR str) const |
Compare the the string with a wide character string. No case-insensitive. More... | |
void | ConvertFrom (const CFX_ByteString &str, CFX_CharMap *pCharMap=NULL) |
Load MBCS data into this wide string, using specified character mapper. More... | |
FX_STRSIZE | Delete (FX_STRSIZE index, FX_STRSIZE count=1) |
Delete one or more wide characters starting from specific position. More... | |
void | Empty () |
Set this string to be empty. More... | |
bool | Equal (const CFX_WideStringC &str) const |
Check if current string is equal to another. More... | |
FX_STRSIZE | Find (FX_LPCWSTR lpszSub, FX_STRSIZE start=0) const |
Find a sub-string, from specific position. Only first occurrence is found. More... | |
FX_STRSIZE | Find (FX_WCHAR ch, FX_STRSIZE start=0) const |
Find a character, from specific position. Only first occurrence is found. More... | |
void | Format (FX_LPCWSTR lpszFormat,...) |
Format a number of parameters into this wide string. More... | |
void | FormatV (FX_LPCWSTR lpszFormat, va_list argList) |
Format a number of parameters into this wide string. using va_list. More... | |
FX_WCHAR | GetAt (FX_STRSIZE nIndex) const |
Retrieves a single wide character specified by an index number. More... | |
FX_LPWSTR | GetBuffer (FX_STRSIZE len) |
Get a buffer with specific number of characters allocated. More... | |
FX_FLOAT | GetFloat () const |
Convert to other data type. More... | |
int | GetInteger () const |
Convert to other data type. More... | |
FX_STRSIZE | GetLength () const |
Get number of characters, not bytes. Trailing zero not counted. More... | |
FX_STRSIZE | Insert (FX_STRSIZE index, FX_WCHAR ch) |
Insert a wide character before specific position. More... | |
FX_BOOL | IsEmpty () const |
Check whether current string object is empty. More... | |
CFX_WideString | Left (FX_STRSIZE count) const |
Extracts the first (leftmost) count wide characters from this CFX_WideString object as a sub-string. More... | |
FX_LPWSTR | LockBuffer () |
Lock and get the current string buffer, so the caller can modify the returned buffer. Caller can modified the returned buffer, and should call CFX_WideString::ReleaseBuffer after modification done. More... | |
void | MakeLower () |
Change case of English letters to lower. More... | |
void | MakeUpper () |
Change case of English letters to upper. More... | |
CFX_WideString | Mid (FX_STRSIZE first) const |
Extracts a substring from this CFX_WideString object, starting at position nFirst (zero-based) to last. More... | |
CFX_WideString | Mid (FX_STRSIZE first, FX_STRSIZE count) const |
Extracts a substring of count wide character from this CFX_WideString object, starting at position nFirst (zero-based) to last. More... | |
operator FX_LPCWSTR () const | |
FX_LPCWSTR type conversion operator. | |
const CFX_WideString & | operator+= (FX_LPCWSTR str) |
Concatenation(+=) operator overload. Concatenate a wide character string. More... | |
const CFX_WideString & | operator+= (FX_WCHAR ch) |
Concatenation(+=) operator overload. Concatenate a single wide character. More... | |
const CFX_WideString & | operator+= (const CFX_WideString &str) |
Concatenation(+=) operator overload. Concatenate a wide string. More... | |
const CFX_WideString & | operator+= (const CFX_WideStringC &str) |
Concatenation(+=) operator overload. Concatenate a constant wide string. More... | |
const CFX_WideString & | operator= (FX_LPCWSTR str) |
Assignment(=) operator overload. From a wide character string. More... | |
const CFX_WideString & | operator= (const CFX_WideString &stringSrc) |
Assignment(=) operator overload. From a wide string. More... | |
const CFX_WideString & | operator= (const CFX_WideStringC &stringSrc) |
Assignment(=) operator overload. From a const wide string. More... | |
FX_WCHAR | operator[] (FX_STRSIZE nIndex) const |
Subscript([]) operator overload. It retrieves a wide character specified by the zero-based index in nIndex. More... | |
void | ReleaseBuffer (FX_STRSIZE len=-1) |
Release the buffer fetched by function CFX_WideString::GetBuffer or CFX_WideString::LockBuffer, and set the length of modified string. More... | |
FX_STRSIZE | Remove (FX_WCHAR ch) |
Remove all occurrence of a particular character. More... | |
FX_STRSIZE | Replace (FX_LPCWSTR lpszOld, FX_LPCWSTR lpszNew) |
Replace all patterns in the string with a new sub-string. More... | |
void | Reserve (FX_STRSIZE len) |
Reserve a buffer that can hold specific number of characters. More... | |
CFX_WideString | Right (FX_STRSIZE count) const |
Extracts the last (rightmost) count wide characters from this CFX_WideString object as a sub-string. More... | |
void | SetAt (FX_STRSIZE nIndex, FX_WCHAR ch) |
Overwrites a single wide character specified by an index number. More... | |
void | TrimLeft () |
Trim white spaces from the left side of the wide string. More... | |
void | TrimLeft (FX_WCHAR chTarget) |
Trim continuous occurrences of specified character from left side of the wide string. More... | |
void | TrimLeft (FX_LPCWSTR lpszTargets) |
Trim continuous occurrences of specified characters from left side of the wide string. More... | |
void | TrimRight () |
Trim white spaces from the right side of the wide string. More... | |
void | TrimRight (FX_WCHAR chTarget) |
Trim continuous occurrences of specified character from right side of the wide string. More... | |
void | TrimRight (FX_LPCWSTR lpszTargets) |
Trim continuous occurrences of specified characters from right side of the wide string. More... | |
CFX_ByteString | UTF16LE_Encode (FX_BOOL bTerminate=true) const |
Do UTF16LE encoding. More... | |
CFX_ByteString | UTF8Encode () const |
Do UTF8 encoding. More... | |
Static Public Member Functions | |
static CFX_WideString | FromLocal (const char *str, FX_STRSIZE len=-1) |
Create a wide string from system multi-byte charset. More... | |
static CFX_WideString | FromUTF16BE (const unsigned short *str, FX_STRSIZE len=-1) |
Create a wide string from UTF16BE encoded string. More... | |
static CFX_WideString | FromUTF16LE (const unsigned short *str, FX_STRSIZE len=-1) |
Create a wide string from UTF16LE encoded string. More... | |
static CFX_WideString | FromUTF8 (const char *str, FX_STRSIZE len=-1) |
Create a wide string from UTF-8 string (ASCII string compatible). More... | |
static FX_STRSIZE | WStringLength (const unsigned short *str) |
Length of string. More... | |
WIDE STRING CLASS.
On Windows platforms, a wide string is represented by UTF-16LE encoding; On Unix/Linux platforms, a wide string is represented by UCS-4 encoding.
CFX_WideString::CFX_WideString | ( | const CFX_WideString & | str | ) |
Copy constructor.
[in] | str | A constant ref to a CFX_WideString object. |
|
inline |
Construct from a wide character string.
[in] | ptr | Pointer to a constant wide character string. |
[in] | len | The length of the wide character string. This can be -1 for zero terminated wide character string. |
CFX_WideString::CFX_WideString | ( | FX_WCHAR | ch | ) |
Construct from a single wide character.
[in] | ch | A single wide character. |
CFX_WideString::CFX_WideString | ( | const CFX_WideStringC & | str | ) |
Construct from a constant ref to a CFX_WideStringC object.
[in] | str | A constant ref to a CFX_WideStringC object. |
CFX_WideString::CFX_WideString | ( | const CFX_WideStringC & | str1, |
const CFX_WideStringC & | str2 | ||
) |
Concatenate constructor.
[in] | str1 | Fist constant ref to a CFX_WideStringC object. |
[in] | str2 | Second constant ref to a CFX_WideStringC object. |
int CFX_WideString::Compare | ( | FX_LPCWSTR | str | ) | const |
Compare current string with a wide character string. Case-sensitive.
[in] | str | The wide character string to be compared. |
int CFX_WideString::Compare | ( | const CFX_WideString & | str | ) | const |
Compare the the string with another. Case-sensitive.
[in] | str | The wide string to be compared. |
int CFX_WideString::CompareNoCase | ( | FX_LPCWSTR | str | ) | const |
Compare the the string with a wide character string. No case-insensitive.
[in] | str | The wide character string to be compared. |
void CFX_WideString::ConvertFrom | ( | const CFX_ByteString & | str, |
CFX_CharMap * | pCharMap = NULL |
||
) |
Load MBCS data into this wide string, using specified character mapper.
If no character mapper specified, the system default mapper will be used.
[in] | str | A byte string. |
[in] | pCharMap | A character mapper. |
FX_STRSIZE CFX_WideString::Delete | ( | FX_STRSIZE | index, |
FX_STRSIZE | count = 1 |
||
) |
Delete one or more wide characters starting from specific position.
[in] | index | Specifies the zero-based index in the wide string for starting deleting. |
[in] | count | Count of wide characters to be deleted. |
void CFX_WideString::Empty | ( | ) |
Set this string to be empty.
bool CFX_WideString::Equal | ( | const CFX_WideStringC & | str | ) | const |
Check if current string is equal to another.
This function os faster than CFX_WideString::Comparewhen only need to check whether two strings are equal.
[in] | str | The wide string to be compared. |
FX_STRSIZE CFX_WideString::Find | ( | FX_LPCWSTR | lpszSub, |
FX_STRSIZE | start = 0 |
||
) | const |
Find a sub-string, from specific position. Only first occurrence is found.
[in] | lpszSub | The sub-string to be found. |
[in] | start | Specifies the zero-based index of the starting position to do finding. Default value: 0. |
FX_STRSIZE CFX_WideString::Find | ( | FX_WCHAR | ch, |
FX_STRSIZE | start = 0 |
||
) | const |
Find a character, from specific position. Only first occurrence is found.
[in] | ch | The character to be found. |
[in] | start | Specifies the zero-based index of the starting position to do finding.Default value: 0. |
void CFX_WideString::Format | ( | FX_LPCWSTR | lpszFormat, |
... | |||
) |
Format a number of parameters into this wide string.
[in] | lpszFormat | Specifies a format-control string. |
void CFX_WideString::FormatV | ( | FX_LPCWSTR | lpszFormat, |
va_list | argList | ||
) |
Format a number of parameters into this wide string. using va_list.
[in] | lpszFormat | Specifies a format-control string. |
[in] | argList | Variable-argument lists. |
|
static |
Create a wide string from system multi-byte charset.
[in] | str | a multi-byte charset string. |
[in] | len | The length in bytes of the multi-byte charset string. This can be -1 for zero terminated multi-byte charset string. |
|
static |
Create a wide string from UTF16BE encoded string.
[in] | str | A UTF16BE encoded string. |
[in] | len | The length in bytes of the UTF16BE encoded string. This can be -1 for zero terminated UTF16BE string. |
|
static |
Create a wide string from UTF16LE encoded string.
[in] | str | A UTF16LE encoded string. |
[in] | len | The length in bytes of the UTF16LE encoded string. This can be -1 for zero terminated UTF16LE string. |
|
static |
Create a wide string from UTF-8 string (ASCII string compatible).
[in] | str | A UTF8 string. |
[in] | len | The length in bytes of the UTF8 string. This can be -1 for zero terminated UTF8 string. |
|
inline |
Retrieves a single wide character specified by an index number.
[in] | nIndex | Specifies the zero-based index in the wide string. |
FX_LPWSTR CFX_WideString::GetBuffer | ( | FX_STRSIZE | len | ) |
Get a buffer with specific number of characters allocated.
[in] | len | the Length expected to get. |
FX_FLOAT CFX_WideString::GetFloat | ( | ) | const |
Convert to other data type.
int CFX_WideString::GetInteger | ( | ) | const |
Convert to other data type.
|
inline |
Get number of characters, not bytes. Trailing zero not counted.
FX_STRSIZE CFX_WideString::Insert | ( | FX_STRSIZE | index, |
FX_WCHAR | ch | ||
) |
Insert a wide character before specific position.
[in] | index | Specifies the zero-based index in the wide string. |
[in] | ch | A single wide character. |
|
inline |
Check whether current string object is empty.
CFX_WideString CFX_WideString::Left | ( | FX_STRSIZE | count | ) | const |
Extracts the first (leftmost) count wide characters from this CFX_WideString object as a sub-string.
[in] | count | The count of wide characters expected to extract for the sub-string. |
FX_LPWSTR CFX_WideString::LockBuffer | ( | ) |
Lock and get the current string buffer, so the caller can modify the returned buffer. Caller can modified the returned buffer, and should call CFX_WideString::ReleaseBuffer after modification done.
void CFX_WideString::MakeLower | ( | ) |
Change case of English letters to lower.
void CFX_WideString::MakeUpper | ( | ) |
Change case of English letters to upper.
CFX_WideString CFX_WideString::Mid | ( | FX_STRSIZE | first | ) | const |
Extracts a substring from this CFX_WideString object, starting at position nFirst (zero-based) to last.
[in] | first | Specifies the zero-based index of the starting position in this CFX_WideString object. |
CFX_WideString CFX_WideString::Mid | ( | FX_STRSIZE | first, |
FX_STRSIZE | count | ||
) | const |
Extracts a substring of count wide character from this CFX_WideString object, starting at position nFirst (zero-based) to last.
[in] | first | Specifies the zero-based index of the starting position in this CFX_WideString object. |
[in] | count | The count of wide characters expected to extract for the sub-string. |
const CFX_WideString& CFX_WideString::operator+= | ( | FX_LPCWSTR | str | ) |
Concatenation(+=) operator overload. Concatenate a wide character string.
[in] | str | The wide character string. |
const CFX_WideString& CFX_WideString::operator+= | ( | FX_WCHAR | ch | ) |
Concatenation(+=) operator overload. Concatenate a single wide character.
[in] | ch | The single wide character. |
const CFX_WideString& CFX_WideString::operator+= | ( | const CFX_WideString & | str | ) |
Concatenation(+=) operator overload. Concatenate a wide string.
[in] | str | The input wide string. |
const CFX_WideString& CFX_WideString::operator+= | ( | const CFX_WideStringC & | str | ) |
Concatenation(+=) operator overload. Concatenate a constant wide string.
[in] | str | The input wide string. |
const CFX_WideString& CFX_WideString::operator= | ( | FX_LPCWSTR | str | ) |
Assignment(=) operator overload. From a wide character string.
[in] | str | The wide character string. |
const CFX_WideString& CFX_WideString::operator= | ( | const CFX_WideString & | stringSrc | ) |
Assignment(=) operator overload. From a wide string.
[in] | stringSrc | The Input wide string. |
const CFX_WideString& CFX_WideString::operator= | ( | const CFX_WideStringC & | stringSrc | ) |
Assignment(=) operator overload. From a const wide string.
[in] | stringSrc | The Input wide string. |
|
inline |
Subscript([]) operator overload. It retrieves a wide character specified by the zero-based index in nIndex.
[in] | nIndex | Specifies the zero-based index in the wide string. |
void CFX_WideString::ReleaseBuffer | ( | FX_STRSIZE | len = -1 | ) |
Release the buffer fetched by function CFX_WideString::GetBuffer or CFX_WideString::LockBuffer, and set the length of modified string.
[in] | len | Length expected to release to. -1 means that current string is assumed to be a zero-terminated string. |
FX_STRSIZE CFX_WideString::Remove | ( | FX_WCHAR | ch | ) |
Remove all occurrence of a particular character.
[in] | ch | Specified the character to be removed. |
FX_STRSIZE CFX_WideString::Replace | ( | FX_LPCWSTR | lpszOld, |
FX_LPCWSTR | lpszNew | ||
) |
Replace all patterns in the string with a new sub-string.
[in] | lpszOld | Specified the string to be matched and replaced in the wide string. |
[in] | lpszNew | Specified the string to replace. |
void CFX_WideString::Reserve | ( | FX_STRSIZE | len | ) |
Reserve a buffer that can hold specific number of characters.
[in] | len | the Length expected to reserve. |
CFX_WideString CFX_WideString::Right | ( | FX_STRSIZE | count | ) | const |
Extracts the last (rightmost) count wide characters from this CFX_WideString object as a sub-string.
[in] | count | The count of wide characters expected to extract for the sub-string. |
void CFX_WideString::SetAt | ( | FX_STRSIZE | nIndex, |
FX_WCHAR | ch | ||
) |
Overwrites a single wide character specified by an index number.
[in] | nIndex | Specifies the zero-based index in the wide string. |
[in] | ch | A single wide character. |
void CFX_WideString::TrimLeft | ( | ) |
Trim white spaces from the left side of the wide string.
void CFX_WideString::TrimLeft | ( | FX_WCHAR | chTarget | ) |
Trim continuous occurrences of specified character from left side of the wide string.
[in] | chTarget | The specified character. |
void CFX_WideString::TrimLeft | ( | FX_LPCWSTR | lpszTargets | ) |
Trim continuous occurrences of specified characters from left side of the wide string.
[in] | lpszTargets | The specified characters. |
void CFX_WideString::TrimRight | ( | ) |
Trim white spaces from the right side of the wide string.
void CFX_WideString::TrimRight | ( | FX_WCHAR | chTarget | ) |
Trim continuous occurrences of specified character from right side of the wide string.
[in] | chTarget | The specified character. |
void CFX_WideString::TrimRight | ( | FX_LPCWSTR | lpszTargets | ) |
Trim continuous occurrences of specified characters from right side of the wide string.
[in] | lpszTargets | The specified characters. |
CFX_ByteString CFX_WideString::UTF16LE_Encode | ( | FX_BOOL | bTerminate = true | ) | const |
Do UTF16LE encoding.
[in] | bTerminate |
CFX_ByteString CFX_WideString::UTF8Encode | ( | ) | const |
Do UTF8 encoding.
|
static |
Length of string.
[in] | str | A string. |