Foxit PDF SDK

Public Member Functions | Static Public Member Functions | List of all members
CFX_ByteString Class Reference
FXCRT

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 | FormatInteger64 (FX_INT64 i)
| Convert from Integer64. 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...

## Detailed Description

BYTE STRING CLASS.

## Constructor & Destructor Documentation

## ◆ CFX_ByteString() [1/6]

CFX_ByteString::CFX_ByteString | ( | const CFX_ByteString & | str | ) |

Copy constructor.

Parameters

  [in] | str | A constant ref to a CFX_ByteString object.

## ◆ CFX_ByteString() [2/6]

CFX_ByteString::CFX_ByteString | ( | char | ch | ) |
| explicit

Construct from a single character.

Parameters

  [in] | ch | A single character.

## ◆ CFX_ByteString() [3/6]

CFX_ByteString::CFX_ByteString | ( | FX_LPCSTR | ptr,
|  | FX_STRSIZE | len = `-1`
| ) |  |

Construct from a character string.

Parameters

  [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() [4/6]

CFX_ByteString::CFX_ByteString | ( | FX_LPCBYTE | ptr,
|  | FX_STRSIZE | len
| ) |  |

Construct from a byte string.

Parameters

  [in] | ptr | Pointer to a constant byte string.
  [in] | len | The length of the byte string.

## ◆ CFX_ByteString() [5/6]

CFX_ByteString::CFX_ByteString | ( | FX_BSTR | bstrc | ) |

Construct from a constant ref to a CFX_ByteStringC object.

Parameters

  [in] | bstrc | A constant ref to a CFX_ByteStringC object.

## ◆ CFX_ByteString() [6/6]

CFX_ByteString::CFX_ByteString | ( | FX_BSTR | bstrc1,
|  | FX_BSTR | bstrc2
| ) |  |

Concatenate constructor.

Parameters

  [in] | bstrc1 | Fist constant ref to a CFX_ByteStringC object.
  [in] | bstrc2 | Second constant ref to a CFX_ByteStringC object.

## ◆ ~CFX_ByteString()

CFX_ByteString::~CFX_ByteString | ( |  | ) |

Destructor.

## Member Function Documentation

## ◆ Compare()

int CFX_ByteString::Compare | ( | FX_BSTR | str | ) | const

Compare the the string with another. Case-sensitive.

Parameters

  [in] | str | The byte string to be compared.

Returns
  - -1 means current string is "smaller" (in alphabetic order) than the other one.
  - 0 means equal.
  - 1 means current string is "larger" (in alphabetic order) than the other one.

## ◆ ConvertFrom()

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.

Parameters

  [in] | str | The input unicode string.
  [in] | pCharMap | Specified character mapper to be used for converting.

Returns
  None.

## ◆ Delete()

FX_STRSIZE CFX_ByteString::Delete | ( | FX_STRSIZE | index,
|  | FX_STRSIZE | count = `1`
| ) |  |

Delete one or more characters starting from specific position.

Parameters

  [in] | index | Specifies the zero-based index in the byte string for starting deleting.
  [in] | count | Count of bytes to be deleted.

Returns
  The new length of the byte string.

## ◆ Empty()

void CFX_ByteString::Empty | ( |  | ) |

Set this string to be empty.

Returns
  None.

## ◆ Equal()

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.

Parameters

  [in] | str | The byte string to be compared.

Returns
  true means current string is equal to the other one, while false means not.

## ◆ EqualNoCase()

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'.

Parameters

  [in] | str | The byte string to be compared.

Returns
  true means current string is equal to the other one, while false means not.

## ◆ Find() [1/2]

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.

Parameters

  [in] | lpszSub | The sub-string to be found.
  [in] | start | Specifies the zero-based index of the starting position to do finding.

Return values

  The | position where first occurrence is found. -1 means not found.

## ◆ Find() [2/2]

FX_STRSIZE CFX_ByteString::Find | ( | FX_CHAR | ch,
|  | FX_STRSIZE | start = `0`
| ) |  | const

Find a character, from specific position. Only first occurrence is found.

Parameters

  [in] | ch | The character to be found.
  [in] | start | Specifies the zero-based index of the starting position to do finding.

Return values

  The | position where first occurrence is found. -1 means not found.

## ◆ Format()

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:

- Supported types: d, u, f, g, x, X, s, c, %.
- Width field supported.
- Precision not supported
- Flags supported: '0'.

Parameters

  [in] | lpszFormat | Specifies a format-control string.

Returns
  None.

## ◆ FormatFloat()

static CFX_ByteString CFX_ByteString::FormatFloat | ( | FX_FLOAT | f,
|  | int | precision = `0`
| ) |  |
| static

Convert from floating-point number.

Parameters

  [in] | f | The input floating-point number.
  [in] | precision | The number of decimal digits. Default value: 0.

Returns
  A CFX_ByteString object.

## ◆ FormatInteger()

static CFX_ByteString CFX_ByteString::FormatInteger | ( | FX_INT32 | i,
|  | FX_DWORD | flags = `0`
| ) |  |
| static

Convert from Integer.

The flags can be following flags (single or compound):

- FXFORMAT_SIGNED
- FXFORMAT_HEX
- FXFORMAT_CAPITAL

Parameters

  [in] | i | The input 32-bit integer.
  [in] | flags | The formating flags. Default value: 0.

Returns
  A CFX_ByteString object.

## ◆ FormatInteger64()

static CFX_ByteString CFX_ByteString::FormatInteger64 | ( | FX_INT64 | i | ) |
| static

Convert from Integer64.

Parameters

  [in] | i | The input 64-bit integer.

Returns
  A CFX_ByteString object.

## ◆ FormatV()

void CFX_ByteString::FormatV | ( | FX_LPCSTR | lpszFormat,
|  | va_list | argList
| ) |  |

Format a number of parameters into this byte string, using va_list.

Parameters

  [in] | lpszFormat | Specifies a format-control string.
  [in] | argList | Variable-argument lists.

Returns
  None.

See also
  CFX_ByteString::Format

## ◆ FromUnicode() [1/2]

static CFX_ByteString CFX_ByteString::FromUnicode | ( | FX_LPCWSTR | ptr,
|  | FX_STRSIZE | len = `-1`
| ) |  |
| static

Create a CFX_ByteString object from a Unicode string. Convert from Unicode to system multi-byte charset.

Parameters

  [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.

Returns
  A byte string.

## ◆ FromUnicode() [2/2]

static CFX_ByteString CFX_ByteString::FromUnicode | ( | const CFX_WideString & | str | ) |
| static

Create a CFX_ByteString object from a CFX_WideString object.

Parameters

  [in] | str | A ref to a constant CFX_WideString object.

Returns
  A byte string.

## ◆ GetAt()

FX_BYTE CFX_ByteString::GetAt | ( | FX_STRSIZE | nIndex | ) | const
| inline

Get a single byte specified by an index number.

Parameters

  [in] | nIndex | Specifies the zero-based index in the byte string.

Returns
  A single byte.

## ◆ GetBuffer()

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.

Parameters

  [in] | len | the Length expected to get.

Returns
  A character string pointer to the byte string.

## ◆ GetID()

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.

Parameters

  [in] | start_pos | Start position in the constant byte string.

Returns
  A FX_DWORD identifier.

## ◆ GetLength()

FX_STRSIZE CFX_ByteString::GetLength | ( |  | ) | const
| inline

Get number of bytes in the byte string (not counting any possible terminator).

Returns
  The Length of the byte string.

## ◆ Insert()

FX_STRSIZE CFX_ByteString::Insert | ( | FX_STRSIZE | index,
|  | FX_CHAR | ch
| ) |  |

Insert a character before specific position.

Parameters

  [in] | index | Specifies the zero-based index in the byte string.
  [in] | ch | A single character.

Returns
  The new length of the byte string.

## ◆ IsEmpty()

bool CFX_ByteString::IsEmpty | ( |  | ) | const
| inline

Check whether current string object is empty.

Returns
  true means current string object is empty, while false means not.

## ◆ Left()

CFX_ByteString CFX_ByteString::Left | ( | FX_STRSIZE | count | ) | const

Extracts the first (leftmost) count bytes from this CFX_ByteString object as a sub-string.

Parameters

  [in] | count | The count of bytes expected to extract for the sub-string.

Returns
  A CFX_ByteString sub-string.

## ◆ Load()

void CFX_ByteString::Load | ( | FX_LPCBYTE | str,
|  | FX_STRSIZE | len
| ) |  |

Load from a byte string.

Parameters

  [in] | str | Pointer to a constant byte string.
  [in] | len | The length of the byte string.

Returns
  None.

## ◆ LoadFromFile()

static CFX_ByteString CFX_ByteString::LoadFromFile | ( | FX_BSTR | file_path | ) |
| static

Load the whole content of a file.

Parameters

  [in] | file_path | The file path.

Returns
  A CFX_ByteString object.

## ◆ LockBuffer()

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.

Returns
  A character string pointer to the byte string.

## ◆ MakeLower()

void CFX_ByteString::MakeLower | ( |  | ) |

Change case of English letters to lower.

Returns
  None.

## ◆ MakeUpper()

void CFX_ByteString::MakeUpper | ( |  | ) |

Change case of English letters to upper.

Returns
  None.

## ◆ Mid() [1/2]

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.

Parameters

  [in] | first | Specifies the zero-based index of the starting position in this CFX_ByteString object.

Returns
  A CFX_ByteString sub-string.

## ◆ Mid() [2/2]

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.

Parameters

  [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.

Returns
  A CFX_ByteString sub-string.

## ◆ operator !=() [1/3]

bool CFX_ByteString::operator != | ( | FX_LPCSTR | str | ) | const
| inline

Comparison(!=) operator overload. case-sensitive.

Parameters

  [in] | str | The null-terminated character string to be compared.

Returns
  true means not equal, while false means equal.

## ◆ operator !=() [2/3]

bool CFX_ByteString::operator != | ( | FX_BSTR | str | ) | const
| inline

Comparison(!=) operator overload. case-sensitive.

Parameters

  [in] | str | The null-terminated constant byte string to be compared.

Returns
  true means not equal, while false means equal.

## ◆ operator !=() [3/3]

bool CFX_ByteString::operator != | ( | const CFX_ByteString & | str | ) | const
| inline

Comparison(!=) operator overload. case-sensitive.

Parameters

  [in] | str | The null-terminated byte string to be compared.

Returns
  true means not equal, while false means equal.

## ◆ operator+=() [1/4]

const CFX_ByteString& CFX_ByteString::operator+= | ( | FX_CHAR | ch | ) |

Concatenation(+=) operator overload. Concatenate a single character.

Parameters

  [in] | ch | A single character.

Returns
  A reference to current object itself.

## ◆ operator+=() [2/4]

const CFX_ByteString& CFX_ByteString::operator+= | ( | FX_LPCSTR | str | ) |

Concatenation(+=) operator overload. Concatenate a null-terminated character string.

Parameters

  [in] | str | Pointer to a constant null-terminated character string.

Returns
  A reference to current object itself.

## ◆ operator+=() [3/4]

const CFX_ByteString& CFX_ByteString::operator+= | ( | const CFX_ByteString & | str | ) |

Concatenation(+=) operator overload. Concatenate a CFX_ByteString object.

Parameters

  [in] | str | A ref to a constant CFX_ByteString object.

Returns
  A reference to current object itself.

## ◆ operator+=() [4/4]

const CFX_ByteString& CFX_ByteString::operator+= | ( | FX_BSTR | bstrc | ) |

Concatenation(+=) operator overload. Concatenate a constant CFX_ByteStringC object.

Parameters

  [in] | bstrc | A ref to a constant CFX_ByteStringC object.

Returns
  A reference to current object itself.

## ◆ operator<()

bool CFX_ByteString::operator< | ( | const CFX_ByteString & | rhs | ) | const

Comparison(<) operator overload. case-sensitive.

Parameters

  [in] | rhs | The right hand side string.

Returns
  true means current string is smaller than parameter rhs, while false means not.

## ◆ operator=() [1/4]

const CFX_ByteString& CFX_ByteString::operator= | ( | FX_LPCSTR | str | ) |

Assignment(=) operator overload. From a character string.

Parameters

  [in] | str | A pointer to a constant character string.

Returns
  A reference to current object itself.

## ◆ operator=() [2/4]

const CFX_ByteString& CFX_ByteString::operator= | ( | FX_BSTR | bstrc | ) |

Assignment(=) operator overload. From a constant byte string.

Parameters

  [in] | bstrc | A ref to a constant byte string.

Returns
  A reference to current object itself.

## ◆ operator=() [3/4]

const CFX_ByteString& CFX_ByteString::operator= | ( | const CFX_ByteString & | stringSrc | ) |

Assignment(=) operator overload. From a CFX_ByteString object.

Parameters

  [in] | stringSrc | A ref to a constant CFX_ByteString object.

Returns
  A reference to current object itself.

## ◆ operator=() [4/4]

const CFX_ByteString& CFX_ByteString::operator= | ( | const CFX_BinaryBuf & | buf | ) |

Assignment(=) operator overload. From a CFX_BinaryBuf object.

Parameters

  [in] | buf | A ref to a constant CFX_BinaryBuf object.

Returns
  A reference to current object itself.

## ◆ operator==() [1/3]

bool CFX_ByteString::operator== | ( | FX_LPCSTR | str | ) | const
| inline

Comparison(==) operator overload. case-sensitive.

Parameters

  [in] | str | The null-terminated character string to be compared.

Returns
  true means equal, while false means not equal.

## ◆ operator==() [2/3]

bool CFX_ByteString::operator== | ( | FX_BSTR | str | ) | const
| inline

Comparison(==) operator overload. case-sensitive.

Parameters

  [in] | str | The null-terminated constant byte string to be compared.

Returns
  true means equal, while false means not equal.

## ◆ operator==() [3/3]

bool CFX_ByteString::operator== | ( | const CFX_ByteString & | str | ) | const

Comparison(==) operator overload. case-sensitive.

Parameters

  [in] | str | The null-terminated byte string to be compared.

Returns
  true means equal, while false means not equal.

## ◆ operator[]()

FX_BYTE CFX_ByteString::operator[] | ( | FX_STRSIZE | nIndex | ) | const
| inline

Subscript([]) operator overload. It retrieves a single byte specified by the zero-based index in nIndex.

Parameters

  [in] | nIndex | Specifies the zero-based index in the byte string.

Returns
  A single byte.

## ◆ ReleaseBuffer()

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.

Parameters

  [in] | len | Length expected to release to. Default value: -1.

Returns
  None.

## ◆ Remove()

FX_STRSIZE CFX_ByteString::Remove | ( | FX_CHAR | ch | ) |

Remove all occurrence of a particular character.

Parameters

  [in] | ch | Specified the character to be removed.

Returns
  The number of characters removed.

## ◆ Replace()

FX_STRSIZE CFX_ByteString::Replace | ( | FX_BSTR | lpszOld,
|  | FX_BSTR | lpszNew
| ) |  |

Replace all patterns in the string with a new sub-string.

Parameters

  [in] | lpszOld | Specified the string to be matched and replaced in the byte string.
  [in] | lpszNew | Specified the string to replace.

Returns
  The number of replaced patterns.

## ◆ Reserve()

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.

Parameters

  [in] | len | Length expected to reserve.

Returns
  None.

## ◆ ReverseFind()

FX_STRSIZE CFX_ByteString::ReverseFind | ( | FX_CHAR | ch | ) | const

Find a character from end of the string.

Parameters

  [in] | ch | A character to be found in curren string, from the end.

Returns
  The position of input character in current string. -1 means Not found.

## ◆ Right()

CFX_ByteString CFX_ByteString::Right | ( | FX_STRSIZE | count | ) | const

Extracts the last (rightmost) count bytes from this CFX_ByteString object as a sub-string.

Parameters

  [in] | count | The count of bytes expected to extract for the sub-string.

Returns
  A CFX_ByteString sub-string.

## ◆ SetAt()

void CFX_ByteString::SetAt | ( | FX_STRSIZE | nIndex,
|  | FX_CHAR | ch
| ) |  |

Overwrites a single byte specified by an index number.

Parameters

  [in] | nIndex | Specifies the zero-based index in the byte string.
  [in] | ch | A single character.

Returns
  None.

## ◆ TrimLeft() [1/3]

void CFX_ByteString::TrimLeft | ( |  | ) |

Trim white spaces from the left side of the byte string.

Returns
  None.

## ◆ TrimLeft() [2/3]

void CFX_ByteString::TrimLeft | ( | FX_CHAR | chTarget | ) |

Trim continuous occurrences of specified characters from left side of the byte string.

Parameters

  [in] | chTarget | The specified character.

Returns
  None.

## ◆ TrimLeft() [3/3]

void CFX_ByteString::TrimLeft | ( | FX_BSTR | lpszTargets | ) |

Trim continuous occurrences of specified characters from left side of the byte string.

Parameters

  [in] | lpszTargets | The specified characters.

Returns
  None.

## ◆ TrimRight() [1/3]

void CFX_ByteString::TrimRight | ( |  | ) |

Trim white spaces from the right side of the byte string.

Returns
  None.

## ◆ TrimRight() [2/3]

void CFX_ByteString::TrimRight | ( | FX_CHAR | chTarget | ) |

Trim continuous occurrences of specified character from right side of the byte string.

Parameters

  [in] | chTarget | The specified character.

Returns
  None.

## ◆ TrimRight() [3/3]

void CFX_ByteString::TrimRight | ( | FX_BSTR | lpszTargets | ) |

Trim continuous occurrences of specified characters from right side of the byte string.

Parameters

  [in] | lpszTargets | The specified characters.

Returns
  None.

## ◆ UTF8Decode()

CFX_WideString CFX_ByteString::UTF8Decode | ( |  | ) | const

Decode a UTF-8 unicode string (assume this byte string is UTF-8 encoded).

Returns
  A unicode string.