CFX_ByteStringC Class Reference

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...
 
 operator FX_LPCBYTE () const
 This casting operator accesses the byte string referred in a CFX_ByteStringC object. More...
 
bool operator!= (const CFX_ByteStringC &str) const
 Comparison(!=) operator overload. case-sensitive. More...
 
CFX_ByteStringCoperator= (FX_LPCSTR src)
 Assignment(=) operator overload. From a character string. More...
 
CFX_ByteStringCoperator= (const CFX_ByteStringC &src)
 Assignment(=) operator overload. From a CFX_ByteStringC object. More...
 
CFX_ByteStringCoperator= (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]ptrPointer to a constant byte string.
[in]sizeThe length of the byte string.

◆ CFX_ByteStringC() [2/5]

CFX_ByteStringC::CFX_ByteStringC ( FX_LPCSTR  ptr)
inline

Construct from a character string.

Parameters
[in]ptrPointer to a constant character string, the string must be null-terminated.

◆ CFX_ByteStringC() [3/5]

CFX_ByteStringC::CFX_ByteStringC ( const FX_CHAR ch)
inlineexplicit

Construct from a single character.

Parameters
[in]chA single character.

◆ CFX_ByteStringC() [4/5]

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

Construct from a character string.

Parameters
[in]ptrPointer to a constant character string.
[in]lenThe 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]srcconstant 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]indexSpecifies 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_posStart 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]indexSpecifies the zero-based index in the CFX_ByteStringC object.
[in]countSpecifies the number of bytes to extract from this CFX_ByteStringC object.
Returns
A CFX_ByteStringC object refer to the substring.

◆ 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!=()

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

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

Parameters
[in]strconstant ref to a CFX_ByteStringC object.
Returns
true means not equal, while false means equal.

◆ operator=() [1/2]

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

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

Parameters
[in]srcPointer 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]srcconstant 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]strconstant ref to a CFX_ByteStringC object.
Returns
true means equal, while false means not equal.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.