Foxit PDF SDK
|
BYTE STRING CLASS. More...
Inherits CFX_Object.
Public Member Functions | |
CFX_ByteString () | |
Construct a null byte string. | |
CFX_ByteString (const CFX_ByteString &str) | |
Copy constructor. More... | |
CFX_ByteString (char ch) | |
Construct from a single character. More... | |
CFX_ByteString (FX_LPCSTR ptr, FX_STRSIZE len=-1) | |
Construct from a character string. More... | |
CFX_ByteString (FX_LPCBYTE ptr, FX_STRSIZE len) | |
Construct from a byte string. More... | |
CFX_ByteString (FX_BSTR bstrc) | |
Construct from a constant ref to a CFX_ByteStringC object. More... | |
CFX_ByteString (FX_BSTR bstrc1, FX_BSTR bstrc2) | |
Concatenate constructor. More... | |
~CFX_ByteString () | |
int | Compare (FX_BSTR str) const |
Compare the the string with another. Case-sensitive. More... | |
void | ConvertFrom (const CFX_WideString &str, CFX_CharMap *pCharMap=NULL) |
Load unicode data into this byte string, using specified character mapper. If no character mapper specified, the system default mapper will be used. More... | |
FX_STRSIZE | Delete (FX_STRSIZE index, FX_STRSIZE count=1) |
Delete one or more characters starting from specific position. More... | |
void | Empty () |
Set this string to be empty. More... | |
bool | Equal (FX_BSTR str) const |
Check if current string is equal to another one. Case-sensitive. More... | |
bool | EqualNoCase (FX_BSTR str) const |
Check if current string is equal to another one, not considering case. More... | |
FX_STRSIZE | Find (FX_BSTR lpszSub, FX_STRSIZE start=0) const |
Find a sub-string, from specific position. Only first occurrence is found. More... | |
FX_STRSIZE | Find (FX_CHAR ch, FX_STRSIZE start=0) const |
Find a character, from specific position. Only first occurrence is found. More... | |
void | Format (FX_LPCSTR lpszFormat,...) |
Format a number of parameters into this byte string. More... | |
void | FormatV (FX_LPCSTR lpszFormat, va_list argList) |
Format a number of parameters into this byte string, using va_list. More... | |
FX_BYTE | GetAt (FX_STRSIZE nIndex) const |
Get a single byte specified by an index number. More... | |
FX_LPSTR | GetBuffer (FX_STRSIZE len) |
Get a buffer with specific number of bytes allocated. More... | |
FX_DWORD | GetID (FX_STRSIZE start_pos=0) const |
Get a DWORD identifier of the string. See function CFX_ByteStringC::GetID for details. More... | |
FX_STRSIZE | GetLength () const |
Get number of bytes in the byte string (not counting any possible terminator). More... | |
FX_STRSIZE | Insert (FX_STRSIZE index, FX_CHAR ch) |
Insert a character before specific position. More... | |
bool | IsEmpty () const |
Check whether current string object is empty. More... | |
CFX_ByteString | Left (FX_STRSIZE count) const |
Extracts the first (leftmost) count bytes from this CFX_ByteString object as a sub-string. More... | |
void | Load (FX_LPCBYTE str, FX_STRSIZE len) |
Load from a byte string. More... | |
FX_LPSTR | LockBuffer () |
Lock and get the current string buffer, so the caller can modify the returned buffer. More... | |
void | MakeLower () |
Change case of English letters to lower. More... | |
void | MakeUpper () |
Change case of English letters to upper. More... | |
CFX_ByteString | Mid (FX_STRSIZE first) const |
Extracts a substring from this CFX_ByteString object, starting at position nFirst (zero-based) to last. More... | |
CFX_ByteString | Mid (FX_STRSIZE first, FX_STRSIZE count) const |
Extracts a substring of count bytes from this CFX_ByteString object, starting at position nFirst (zero-based) to last. More... | |
bool | operator != (FX_LPCSTR str) const |
Comparison(!=) operator overload. case-sensitive. More... | |
bool | operator != (FX_BSTR str) const |
Comparison(!=) operator overload. case-sensitive. More... | |
bool | operator != (const CFX_ByteString &str) const |
Comparison(!=) operator overload. case-sensitive. More... | |
operator FX_LPCBYTE () const | |
FX_LPCBYTE type conversion operator. CFX_ByteString can be used in places where FX_LPCSTR or FX_LPCBYTE is needed. | |
operator FX_LPCSTR () const | |
FX_LPCSTR type conversion operator. CFX_ByteString can be used in places where FX_LPCSTR or FX_LPCBYTE is needed. | |
const CFX_ByteString & | operator+= (FX_CHAR ch) |
Concatenation(+=) operator overload. Concatenate a single character. More... | |
const CFX_ByteString & | operator+= (FX_LPCSTR str) |
Concatenation(+=) operator overload. Concatenate a null-terminated character string. More... | |
const CFX_ByteString & | operator+= (const CFX_ByteString &str) |
Concatenation(+=) operator overload. Concatenate a CFX_ByteString object. More... | |
const CFX_ByteString & | operator+= (FX_BSTR bstrc) |
Concatenation(+=) operator overload. Concatenate a constant CFX_ByteStringC object. More... | |
bool | operator< (const CFX_ByteString &rhs) const |
Comparison(<) operator overload. case-sensitive. More... | |
const CFX_ByteString & | operator= (FX_LPCSTR str) |
Assignment(=) operator overload. From a character string. More... | |
const CFX_ByteString & | operator= (FX_BSTR bstrc) |
Assignment(=) operator overload. From a constant byte string. More... | |
const CFX_ByteString & | operator= (const CFX_ByteString &stringSrc) |
Assignment(=) operator overload. From a CFX_ByteString object. More... | |
const CFX_ByteString & | operator= (const CFX_BinaryBuf &buf) |
Assignment(=) operator overload. From a CFX_BinaryBuf object. More... | |
bool | operator== (FX_LPCSTR str) const |
Comparison(==) operator overload. case-sensitive. More... | |
bool | operator== (FX_BSTR str) const |
Comparison(==) operator overload. case-sensitive. More... | |
bool | operator== (const CFX_ByteString &str) const |
Comparison(==) operator overload. case-sensitive. More... | |
FX_BYTE | operator[] (FX_STRSIZE nIndex) const |
Subscript([]) operator overload. It retrieves a single byte specified by the zero-based index in nIndex. More... | |
void | ReleaseBuffer (FX_STRSIZE len=-1) |
Release the buffer fetched by function CFX_ByteString::GetBuffer or CFX_ByteString::LockBuffer, and set the length of modified string. More... | |
FX_STRSIZE | Remove (FX_CHAR ch) |
Remove all occurrence of a particular character. More... | |
FX_STRSIZE | Replace (FX_BSTR lpszOld, FX_BSTR 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 bytes. More... | |
FX_STRSIZE | ReverseFind (FX_CHAR ch) const |
Find a character from end of the string. More... | |
CFX_ByteString | Right (FX_STRSIZE count) const |
Extracts the last (rightmost) count bytes from this CFX_ByteString object as a sub-string. More... | |
void | SetAt (FX_STRSIZE nIndex, FX_CHAR ch) |
Overwrites a single byte specified by an index number. More... | |
void | TrimLeft () |
Trim white spaces from the left side of the byte string. More... | |
void | TrimLeft (FX_CHAR chTarget) |
Trim continuous occurrences of specified characters from left side of the byte string. More... | |
void | TrimLeft (FX_BSTR lpszTargets) |
Trim continuous occurrences of specified characters from left side of the byte string. More... | |
void | TrimRight () |
Trim white spaces from the right side of the byte string. More... | |
void | TrimRight (FX_CHAR chTarget) |
Trim continuous occurrences of specified character from right side of the byte string. More... | |
void | TrimRight (FX_BSTR lpszTargets) |
Trim continuous occurrences of specified characters from right side of the byte string. More... | |
CFX_WideString | UTF8Decode () const |
Decode a UTF-8 unicode string (assume this byte string is UTF-8 encoded). More... | |
Static Public Member Functions | |
static CFX_ByteString | FormatFloat (FX_FLOAT f, int precision=0) |
Convert from floating-point number. More... | |
static CFX_ByteString | FormatInteger (FX_INT32 i, FX_DWORD flags=0) |
Convert from Integer. More... | |
static CFX_ByteString | FromUnicode (FX_LPCWSTR ptr, FX_STRSIZE len=-1) |
Create a CFX_ByteString object from a Unicode string. Convert from Unicode to system multi-byte charset. More... | |
static CFX_ByteString | FromUnicode (const CFX_WideString &str) |
Create a CFX_ByteString object from a CFX_WideString object. More... | |
static CFX_ByteString | LoadFromFile (FX_BSTR file_path) |
Load the whole content of a file. More... | |
BYTE STRING CLASS.
CFX_ByteString::CFX_ByteString | ( | const CFX_ByteString & | str | ) |
Copy constructor.
[in] | str | A constant ref to a CFX_ByteString object. |
|
explicit |
Construct from a single character.
[in] | ch | A single character. |
CFX_ByteString::CFX_ByteString | ( | FX_LPCSTR | ptr, |
FX_STRSIZE | len = -1 |
||
) |
Construct from a character string.
[in] | ptr | Pointer to a constant character string. |
[in] | len | The length of the character string. len can be -1 for zero terminated string. |
CFX_ByteString::CFX_ByteString | ( | FX_LPCBYTE | ptr, |
FX_STRSIZE | len | ||
) |
Construct from a byte string.
[in] | ptr | Pointer to a constant byte string. |
[in] | len | The length of the byte string. |
CFX_ByteString::CFX_ByteString | ( | FX_BSTR | bstrc | ) |
Construct from a constant ref to a CFX_ByteStringC object.
[in] | bstrc | A constant ref to a CFX_ByteStringC object. |
Concatenate constructor.
[in] | bstrc1 | Fist constant ref to a CFX_ByteStringC object. |
[in] | bstrc2 | Second constant ref to a CFX_ByteStringC object. |
CFX_ByteString::~CFX_ByteString | ( | ) |
Destructor.
int CFX_ByteString::Compare | ( | FX_BSTR | str | ) | const |
Compare the the string with another. Case-sensitive.
[in] | str | The byte string to be compared. |
void CFX_ByteString::ConvertFrom | ( | const CFX_WideString & | str, |
CFX_CharMap * | pCharMap = NULL |
||
) |
Load unicode data into this byte string, using specified character mapper. If no character mapper specified, the system default mapper will be used.
[in] | str | The input unicode string. |
[in] | pCharMap | Specified character mapper to be used for converting. |
FX_STRSIZE CFX_ByteString::Delete | ( | FX_STRSIZE | index, |
FX_STRSIZE | count = 1 |
||
) |
Delete one or more characters starting from specific position.
[in] | index | Specifies the zero-based index in the byte string for starting deleting. |
[in] | count | Count of bytes to be deleted. |
void CFX_ByteString::Empty | ( | ) |
Set this string to be empty.
bool CFX_ByteString::Equal | ( | FX_BSTR | str | ) | const |
Check if current string is equal to another one. Case-sensitive.
This function is faster than function CFX_ByteString::Compare if only need to check whether two strings are equal.
[in] | str | The byte string to be compared. |
bool CFX_ByteString::EqualNoCase | ( | FX_BSTR | str | ) | const |
Check if current string is equal to another one, not considering case.
This function will treat letters 'A'-'Z' just same as 'a'-'z'.
[in] | str | The byte string to be compared. |
FX_STRSIZE CFX_ByteString::Find | ( | FX_BSTR | 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. |
The | position where first occurrence is found. -1 means not found. |
FX_STRSIZE CFX_ByteString::Find | ( | FX_CHAR | 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. |
The | position where first occurrence is found. -1 means not found. |
void CFX_ByteString::Format | ( | FX_LPCSTR | lpszFormat, |
... | |||
) |
Format a number of parameters into this byte string.
On desktop platforms, this function supports all the sprintf() formats.
On embedded platforms, it supports only a subset of formats:
[in] | lpszFormat | Specifies a format-control string. |
|
static |
Convert from floating-point number.
[in] | f | The input floating-point number. |
[in] | precision | The number of decimal digits. Not used. Default value: 0. |
|
static |
Convert from Integer.
The flags can be following flags (single or compound):
[in] | i | The input 32-bit integer. |
[in] | flags | The formating flags. Default value: 0. |
void CFX_ByteString::FormatV | ( | FX_LPCSTR | lpszFormat, |
va_list | argList | ||
) |
Format a number of parameters into this byte string, using va_list.
[in] | lpszFormat | Specifies a format-control string. |
[in] | argList | Variable-argument lists. |
|
static |
Create a CFX_ByteString object from a Unicode string. Convert from Unicode to system multi-byte charset.
[in] | ptr | Pointer to a constant Unicode string. |
[in] | len | The length of the Unicode string. len can be -1 for zero terminated Unicode string. |
|
static |
Create a CFX_ByteString object from a CFX_WideString object.
[in] | str | A ref to a constant CFX_WideString object. |
|
inline |
Get a single byte specified by an index number.
[in] | nIndex | Specifies the zero-based index in the byte string. |
FX_LPSTR CFX_ByteString::GetBuffer | ( | FX_STRSIZE | len | ) |
Get a buffer with specific number of bytes allocated.
The content of this string won't be affected by function CFX_ByteString::GetBuffer. Caller can modified the returned buffer, and should call function CFX_ByteString::ReleaseBuffer after modification done.
[in] | len | the Length expected to get. |
FX_DWORD CFX_ByteString::GetID | ( | FX_STRSIZE | start_pos = 0 | ) | const |
Get a DWORD identifier of the string. See function CFX_ByteStringC::GetID for details.
[in] | start_pos | Start position in the constant byte string. |
|
inline |
Get number of bytes in the byte string (not counting any possible terminator).
FX_STRSIZE CFX_ByteString::Insert | ( | FX_STRSIZE | index, |
FX_CHAR | ch | ||
) |
Insert a character before specific position.
[in] | index | Specifies the zero-based index in the byte string. |
[in] | ch | A single character. |
|
inline |
Check whether current string object is empty.
CFX_ByteString CFX_ByteString::Left | ( | FX_STRSIZE | count | ) | const |
Extracts the first (leftmost) count bytes from this CFX_ByteString object as a sub-string.
[in] | count | The count of bytes expected to extract for the sub-string. |
void CFX_ByteString::Load | ( | FX_LPCBYTE | str, |
FX_STRSIZE | len | ||
) |
Load from a byte string.
[in] | str | Pointer to a constant byte string. |
[in] | len | The length of the byte string. |
|
static |
Load the whole content of a file.
[in] | file_path | The file path. |
FX_LPSTR CFX_ByteString::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 function CFX_ByteString::ReleaseBuffer after modification done.
void CFX_ByteString::MakeLower | ( | ) |
Change case of English letters to lower.
void CFX_ByteString::MakeUpper | ( | ) |
Change case of English letters to upper.
CFX_ByteString CFX_ByteString::Mid | ( | FX_STRSIZE | first | ) | const |
Extracts a substring from this CFX_ByteString object, starting at position nFirst (zero-based) to last.
[in] | first | Specifies the zero-based index of the starting position in this CFX_ByteString object. |
CFX_ByteString CFX_ByteString::Mid | ( | FX_STRSIZE | first, |
FX_STRSIZE | count | ||
) | const |
Extracts a substring of count bytes from this CFX_ByteString object, starting at position nFirst (zero-based) to last.
[in] | first | Specifies the zero-based index of the starting position in this CFX_ByteString object. |
[in] | count | The count of bytes expected to extract for the sub-string. |
|
inline |
Comparison(!=) operator overload. case-sensitive.
[in] | str | The null-terminated character string to be compared. |
|
inline |
Comparison(!=) operator overload. case-sensitive.
[in] | str | The null-terminated constant byte string to be compared. |
|
inline |
Comparison(!=) operator overload. case-sensitive.
[in] | str | The null-terminated byte string to be compared. |
const CFX_ByteString& CFX_ByteString::operator+= | ( | FX_CHAR | ch | ) |
Concatenation(+=) operator overload. Concatenate a single character.
[in] | ch | A single character. |
const CFX_ByteString& CFX_ByteString::operator+= | ( | FX_LPCSTR | str | ) |
Concatenation(+=) operator overload. Concatenate a null-terminated character string.
[in] | str | Pointer to a constant null-terminated character string. |
const CFX_ByteString& CFX_ByteString::operator+= | ( | const CFX_ByteString & | str | ) |
Concatenation(+=) operator overload. Concatenate a CFX_ByteString object.
[in] | str | A ref to a constant CFX_ByteString object. |
const CFX_ByteString& CFX_ByteString::operator+= | ( | FX_BSTR | bstrc | ) |
Concatenation(+=) operator overload. Concatenate a constant CFX_ByteStringC object.
[in] | bstrc | A ref to a constant CFX_ByteStringC object. |
bool CFX_ByteString::operator< | ( | const CFX_ByteString & | rhs | ) | const |
Comparison(<) operator overload. case-sensitive.
[in] | rhs | The right hand side string. |
const CFX_ByteString& CFX_ByteString::operator= | ( | FX_LPCSTR | str | ) |
Assignment(=) operator overload. From a character string.
[in] | str | A pointer to a constant character string. |
const CFX_ByteString& CFX_ByteString::operator= | ( | FX_BSTR | bstrc | ) |
Assignment(=) operator overload. From a constant byte string.
[in] | bstrc | A ref to a constant byte string. |
const CFX_ByteString& CFX_ByteString::operator= | ( | const CFX_ByteString & | stringSrc | ) |
Assignment(=) operator overload. From a CFX_ByteString object.
[in] | stringSrc | A ref to a constant CFX_ByteString object. |
const CFX_ByteString& CFX_ByteString::operator= | ( | const CFX_BinaryBuf & | buf | ) |
Assignment(=) operator overload. From a CFX_BinaryBuf object.
[in] | buf | A ref to a constant CFX_BinaryBuf object. |
|
inline |
Comparison(==) operator overload. case-sensitive.
[in] | str | The null-terminated character string to be compared. |
|
inline |
Comparison(==) operator overload. case-sensitive.
[in] | str | The null-terminated constant byte string to be compared. |
bool CFX_ByteString::operator== | ( | const CFX_ByteString & | str | ) | const |
Comparison(==) operator overload. case-sensitive.
[in] | str | The null-terminated byte string to be compared. |
|
inline |
Subscript([]) operator overload. It retrieves a single byte specified by the zero-based index in nIndex.
[in] | nIndex | Specifies the zero-based index in the byte string. |
void CFX_ByteString::ReleaseBuffer | ( | FX_STRSIZE | len = -1 | ) |
Release the buffer fetched by function CFX_ByteString::GetBuffer or CFX_ByteString::LockBuffer, and set the length of modified string.
If parameter len parameter is -1, then it's assumed to be a zero-terminated string.
[in] | len | Length expected to release to. Default value: -1. |
FX_STRSIZE CFX_ByteString::Remove | ( | FX_CHAR | ch | ) |
Remove all occurrence of a particular character.
[in] | ch | Specified the character to be removed. |
FX_STRSIZE CFX_ByteString::Replace | ( | FX_BSTR | lpszOld, |
FX_BSTR | lpszNew | ||
) |
Replace all patterns in the string with a new sub-string.
[in] | lpszOld | Specified the string to be matched and replaced in the byte string. |
[in] | lpszNew | Specified the string to replace. |
void CFX_ByteString::Reserve | ( | FX_STRSIZE | len | ) |
Reserve a buffer that can hold specific number of bytes.
The content of this string won't be changed. This can be used if application anticipates the string may grow many times, in this case, reserving a larger buffer will support string growth without buffer reallocation.
[in] | len | Length expected to reserve. |
FX_STRSIZE CFX_ByteString::ReverseFind | ( | FX_CHAR | ch | ) | const |
Find a character from end of the string.
[in] | ch | A character to be found in curren string, from the end. |
CFX_ByteString CFX_ByteString::Right | ( | FX_STRSIZE | count | ) | const |
Extracts the last (rightmost) count bytes from this CFX_ByteString object as a sub-string.
[in] | count | The count of bytes expected to extract for the sub-string. |
void CFX_ByteString::SetAt | ( | FX_STRSIZE | nIndex, |
FX_CHAR | ch | ||
) |
Overwrites a single byte specified by an index number.
[in] | nIndex | Specifies the zero-based index in the byte string. |
[in] | ch | A single character. |
void CFX_ByteString::TrimLeft | ( | ) |
Trim white spaces from the left side of the byte string.
void CFX_ByteString::TrimLeft | ( | FX_CHAR | chTarget | ) |
Trim continuous occurrences of specified characters from left side of the byte string.
[in] | chTarget | The specified character. |
void CFX_ByteString::TrimLeft | ( | FX_BSTR | lpszTargets | ) |
Trim continuous occurrences of specified characters from left side of the byte string.
[in] | lpszTargets | The specified characters. |
void CFX_ByteString::TrimRight | ( | ) |
Trim white spaces from the right side of the byte string.
void CFX_ByteString::TrimRight | ( | FX_CHAR | chTarget | ) |
Trim continuous occurrences of specified character from right side of the byte string.
[in] | chTarget | The specified character. |
void CFX_ByteString::TrimRight | ( | FX_BSTR | lpszTargets | ) |
Trim continuous occurrences of specified characters from right side of the byte string.
[in] | lpszTargets | The specified characters. |
CFX_WideString CFX_ByteString::UTF8Decode | ( | ) | const |
Decode a UTF-8 unicode string (assume this byte string is UTF-8 encoded).