Foxit PDF Conversion SDK

Public Member Functions | List of all members
CFX_ByteStringC Class Reference
FXCRT

CONSTANT BYTE STRING CLASS. More...

Inherits CFX_Object.

Inherited by CFX_ByteStringL.

## Public Member Functions
| CFX_ByteStringC ()
| Constructs a null constant string.
| CFX_ByteStringC (FX_LPCBYTE ptr, FX_STRSIZE size)
| Constructs from a byte string. More...
| CFX_ByteStringC (FX_LPCSTR ptr)
| Construct from a character string. More...
| CFX_ByteStringC (const FX_CHAR &ch)
| Construct from a single character. More...
| CFX_ByteStringC (FX_LPCSTR ptr, FX_STRSIZE len)
| Construct from a character string. More...
| CFX_ByteStringC (const CFX_ByteStringC &src)
| Copy constructor. More...
| CFX_ByteStringC (const CFX_ByteString &src)
| Construct from a byte string. More...
FX_BYTE | GetAt (FX_STRSIZE index) const
| This method retrieves a single byte specified by an index number. More...
FX_LPCSTR | GetCStr () const
| Get a constant character string pointer to the byte string. More...
FX_DWORD | GetID (FX_STRSIZE start_pos=0) const
| Get a DWORD identifier of the string, from a particular position. More...
FX_STRSIZE | GetLength () const
| Get the length of the byte string. More...
FX_LPCBYTE | GetPtr () const
| Get a constant byte string pointer to the byte string. More...
bool | IsEmpty () const
| Check whether current string object is empty. More...
CFX_ByteStringC | Mid (FX_STRSIZE index, FX_STRSIZE count=-1) const
| This method extracts a substring of length count bytes from this CFX_ByteStringC object, starting at position index (zero-based). More...
bool | operator != (const CFX_ByteStringC &str) const
| Comparison(!=) operator overload. case-sensitive. More...
| operator FX_LPCBYTE () const
| This casting operator accesses the byte string referred in a CFX_ByteStringC object. More...
CFX_ByteStringC & | operator= (FX_LPCSTR src)
| Assignment(=) operator overload. From a character string. More...
CFX_ByteStringC & | operator= (const CFX_ByteStringC &src)
| Assignment(=) operator overload. From a CFX_ByteStringC object. More...
CFX_ByteStringC & | operator= (const CFX_ByteString &src)
| Assignment(=) operator overload. From a CFX_ByteString object. More...
bool | operator== (const CFX_ByteStringC &str) const
| Comparison(==) operator overload. case-sensitive. More...

## Detailed Description

CONSTANT BYTE STRING CLASS.

Constant byte string, it contains no buffer so its content cannot be changed directly.

## Constructor & Destructor Documentation

## ◆ CFX_ByteStringC() [1/5]

CFX_ByteStringC::CFX_ByteStringC | ( | FX_LPCBYTE | ptr,
|  | FX_STRSIZE | size
| ) |  |
| inline

Constructs from a byte string.

Parameters

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

## ◆ CFX_ByteStringC() [2/5]

CFX_ByteStringC::CFX_ByteStringC | ( | FX_LPCSTR | ptr | ) |
| inline

Construct from a character string.

Parameters

  [in] | ptr | Pointer to a constant character string, the string must be null-terminated.

## ◆ CFX_ByteStringC() [3/5]

CFX_ByteStringC::CFX_ByteStringC | ( | const FX_CHAR & | ch | ) |
| inline explicit

Construct from a single character.

Parameters

  [in] | ch | A single character.

## ◆ CFX_ByteStringC() [4/5]

CFX_ByteStringC::CFX_ByteStringC | ( | FX_LPCSTR | ptr,
|  | FX_STRSIZE | len
| ) |  |
| inline

Construct from a character string.

Parameters

  [in] | ptr | Pointer to a constant character string.
  [in] | len | The length of the character string. This can be -1 for null-terminated string.

## ◆ CFX_ByteStringC() [5/5]

CFX_ByteStringC::CFX_ByteStringC | ( | const CFX_ByteStringC & | src | ) |
| inline

Copy constructor.

Parameters

  [in] | src | constant ref to a CFX_ByteStringC object.

## Member Function Documentation

## ◆ GetAt()

FX_BYTE CFX_ByteStringC::GetAt | ( | FX_STRSIZE | index | ) | const
| inline

This method retrieves a single byte specified by an index number.

Parameters

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

Returns
  A single byte.

## ◆ GetCStr()

FX_LPCSTR CFX_ByteStringC::GetCStr | ( |  | ) | const
| inline

Get a constant character string pointer to the byte string.

Returns
  A constant character string pointer to the byte string.

## ◆ GetID()

FX_DWORD CFX_ByteStringC::GetID | ( | FX_STRSIZE | start_pos = `0` | ) | const

Get a DWORD identifier of the string, from a particular position.

This DWORD can be used for quick comparison. Using MSB-first scheme. If the string does not have enough bytes, then zero will be used missing bytes.

Parameters

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

Returns
  A DWORD identifier.

Note
  For example:
  CFX_ByteString str1("hello"), str2("hey");
  FX_BOOL bCheck1 = str1.GetID() == FXBSTR_ID('h', 'e', 'l', 'l'); // returns TRUE
  FX_BOOL bCheck2 = str2.GetID() == FXBSTR_ID('h', 'e', 'y', 0); // returns TRUE

## ◆ GetLength()

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

Get the length of the byte string.

Returns
  The length of the byte string.

## ◆ GetPtr()

FX_LPCBYTE CFX_ByteStringC::GetPtr | ( |  | ) | const
| inline

Get a constant byte string pointer to the byte string.

Returns
  A constant byte string pointer to the byte string.

## ◆ IsEmpty()

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

Check whether current string object is empty.

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

## ◆ Mid()

CFX_ByteStringC CFX_ByteStringC::Mid | ( | FX_STRSIZE | index,
|  | FX_STRSIZE | count = `-1`
| ) |  | const
| inline

This method extracts a substring of length count bytes from this CFX_ByteStringC object, starting at position index (zero-based).

Parameters

  [in] | index | Specifies the zero-based index in the CFX_ByteStringC object.
  [in] | count | Specifies the number of bytes to extract from this CFX_ByteStringC object.

Returns
  A CFX_ByteStringC object refer to the substring.

## ◆ operator !=()

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

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

Parameters

  [in] | str | constant ref to a CFX_ByteStringC object.

Returns
  true means not equal, while false means equal.

## ◆ operator FX_LPCBYTE()

CFX_ByteStringC::operator FX_LPCBYTE | ( |  | ) | const
| inline

This casting operator accesses the byte string referred in a CFX_ByteStringC object.

Returns
  A byte string pointer to the data in the string.

Note
  A CFX_ByteStringC cannot be implicitly converted to a FX_LPCSTR pointer, because very likely the CFX_ByteStringC buffer is not null-terminated.

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

CFX_ByteStringC& CFX_ByteStringC::operator= | ( | FX_LPCSTR | src | ) |
| inline

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

Parameters

  [in] | src | Pointer to a constant character string.

Returns
  A reference to current object itself.

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

CFX_ByteStringC& CFX_ByteStringC::operator= | ( | const CFX_ByteStringC & | src | ) |
| inline

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

Parameters

  [in] | src | constant ref to a CFX_ByteStringC object.

Returns
  A reference to current object itself.

## ◆ operator==()

bool CFX_ByteStringC::operator== | ( | const CFX_ByteStringC & | str | ) | const
| inline

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

Parameters

  [in] | str | constant ref to a CFX_ByteStringC object.

Returns
  true means equal, while false means not equal.