CHAI SDK  Version 1.3
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
CPNS::UTF8String Class Reference

String handling class. More...

+ Collaboration diagram for CPNS::UTF8String:

Public Member Functions

 UTF8String ()
 Constructor. More...
 
 UTF8String (char8 const *const utf8String)
 Constructor with UTF8 string preload. More...
 
 UTF8String (char16 const *const unicodeString)
 Constructor with unicode string preload. More...
 
 UTF8String (UTF8String const &string)
 Copy constructor. More...
 
 UTF8String (uint16 const wStringRawLengthWithoutEndingZero)
 Constructor with pre-allocation. More...
 
 ~UTF8String ()
 Destructor. More...
 
void Clear ()
 Clear the string. More...
 
uint16 Length () const
 Get the number of characters, without ending zero. More...
 
uint16 GetRawLength () const
 Get the size of the string in bytes, without ending zero. More...
 
boolean IsEmpty () const
 Check if the string is empty. More...
 
boolean MakeValidName () const
 Transform the string in a valid name (change "\" or "/" to "-") More...
 
char8 const * Get () const
 Get a pointer to the UTF8 string. More...
 
char8 const * GetAt (int offset) const
 Get a pointer to the UTF8 string starting at the character offset. More...
 
void Set (UTF8String const &string)
 Copy from another UTF8String. More...
 
void Set (char8 const *const utf8sString)
 Copy from null terminated UTF8 string. More...
 
void Set (char8 const *const utf8String, uint16 const wNumCharsToCopy)
 Copy a maximum number of characters from null terminated utf8 string. More...
 
void Set (char16 const *const unicodeString)
 Copy from null terminated unicode string. More...
 
void Set (char16 const *const unicodeString, uint16 const wNumCharsToCopy)
 Copy a maximum number of characters from null terminated unicode string. More...
 
void SetUInt32 (CPNS::uint32 const dwValue)
 Set with a string representing an unsigned int 32 value. More...
 
void SetInt32 (CPNS::int32 const lValue)
 Set with a string representing an signed int 32 value. More...
 
void SetFloat32 (CPNS::float32 const fValue, uint8 const numOfDecimals)
 Set with a string representing a float 32 value. More...
 
void SetFloat64 (CPNS::float64 const dValue, uint8 const numOfDecimals)
 Set with a string representing a float 64 value. More...
 
UTF8StringConcat (UTF8String const &string)
 Add an UTF8String to the string. More...
 
UTF8StringConcat (char8 const *const szString)
 Add a null terminated utf8 string. More...
 
UTF8StringConcat (char16 const *const unicodeString)
 Add a null terminated unicode string. More...
 
UTF8StringConcatInt (int32 const nValue)
 Add a signed integer value, base10 formated. More...
 
UTF8StringConcatHex_n (uint8 const *const pbValue, uint8 const nbytes)
 Add an hexadecimal value, ** ** ** formated. More...
 
UTF8StringConcatHex_0x02 (uint8 const bValue)
 Add an hexadecimal value, 0x** formated. More...
 
UTF8StringConcatHex_0x04 (uint16 const wValue)
 Add an hexadecimal value, 0x**** formated. More...
 
UTF8StringConcatHex_0x08 (uint32 const dwValue)
 Add an hexadecimal value, 0x******** formated. More...
 
UTF8StringConcatHex (uint32 const dwValue)
 Add an hexadecimal value. More...
 
UTF8StringConcatFloat32 (float32 const fValue, uint8 const numOfDecimals)
 Add a float 32 value. More...
 
uint16 ToUnicode (char16 *wszUnicodeString, uint16 const wInputLength) const
 Convert the string to UNICODE. More...
 
int16 Compare (UTF8String const &string) const
 Compare method. More...
 
int16 Compare (char8 const *const utf8String) const
 Compare method. More...
 
CPNS::boolean ContainsIgnoreCase (CPNS::char8 const *const utf8SearchedString)
 Check if the string contains a substring, don't car about the case. More...
 
UTF8String ToFirstOccurrenceOf (CPNS::char8 const *const utf8SearchedString, CPNS::boolean const fIncludeSubStringInResult, CPNS::boolean fIgnoreCase) const
 Extract a substring to the first occurrence of the specified searched string. More...
 
UTF8String FromFirstOccurrenceOf (CPNS::char8 const *const utf8SearchedString, CPNS::boolean const fIncludeSubStringInResult, CPNS::boolean fIgnoreCase) const
 Extract a substring from the first occurrence of the specified searched string. More...
 
UTF8String FromLastOccurrenceOf (CPNS::char8 const *const utf8SearchedString, CPNS::boolean const fIncludeSubStringInResult, CPNS::boolean fIgnoreCase) const
 Extract a substring from the last occurrence of the specified searched string. More...
 
UTF8Stringoperator= (UTF8String const &utf8String)
 Equality check operator. More...
 
UTF8String operator+ (UTF8String const &utf8String) const
 Concat operator. More...
 
UTF8String operator+= (UTF8String const &utf8String)
 Concat operator. More...
 
 operator char8 const * () const
 Implicit utf8 string getter operator. More...
 

Static Public Member Functions

static UTF8String FromUInt32 (CPNS::uint32 const dwValue)
 Create a string representing an unsigned int 32 value. More...
 
static UTF8String FromInt32 (CPNS::int32 const lValue)
 Create a string representing an signed int 32 value. More...
 
static UTF8String FromFloat32 (CPNS::float32 const fValue, uint8 const numOfDecimals)
 Create a string representing a float 32 value. More...
 
static UTF8String FromFloat64 (CPNS::float64 const dValue, uint8 const numOfDecimals)
 Create a string representing a float 64 value. More...
 

Static Public Attributes

static UTF8String NullString
 Empty string value. More...
 

Detailed Description

String handling class.

Constructor & Destructor Documentation

CPNS::UTF8String::UTF8String ( )

Constructor.

CPNS::UTF8String::UTF8String ( char8 const *const  utf8String)

Constructor with UTF8 string preload.

Parameters
[in]utf8Stringnull terminated UTF8 string to be copied in the object
Warning
in case of using ASCII string, take care to not use extended ASCII characters. Use ONLY 0-127 character values.
CPNS::UTF8String::UTF8String ( char16 const *const  unicodeString)

Constructor with unicode string preload.

Parameters
[in]unicodeStringnull terminated unicode string to be copied in the object
CPNS::UTF8String::UTF8String ( UTF8String const &  string)

Copy constructor.

CPNS::UTF8String::UTF8String ( uint16 const  wStringRawLengthWithoutEndingZero)

Constructor with pre-allocation.

Creates an empty string with internal buffer pre-allocated to the specified size.

Parameters
[in]wStringRawLengthWithoutEndingZeronumber of bytes reserved for the string
CPNS::UTF8String::~UTF8String ( )

Destructor.

Member Function Documentation

void CPNS::UTF8String::Clear ( )

Clear the string.

int16 CPNS::UTF8String::Compare ( UTF8String const &  string) const

Compare method.

Returns
-1 if less than, +1 if greater than, 0 if equal
int16 CPNS::UTF8String::Compare ( char8 const *const  utf8String) const

Compare method.

Warning
in case of using ASCII string, take care to not use extended ASCII characters. Use ONLY 0-127 character values.
Returns
-1 if less than, +1 if greater than, 0 if equal
UTF8String& CPNS::UTF8String::Concat ( UTF8String const &  string)

Add an UTF8String to the string.

UTF8String& CPNS::UTF8String::Concat ( char8 const *const  szString)

Add a null terminated utf8 string.

Warning
in case of using ASCII string, take care to not use extended ASCII characters. Use ONLY 0-127 character values.
UTF8String& CPNS::UTF8String::Concat ( char16 const *const  unicodeString)

Add a null terminated unicode string.

UTF8String& CPNS::UTF8String::ConcatFloat32 ( float32 const  fValue,
uint8 const  numOfDecimals 
)

Add a float 32 value.

UTF8String& CPNS::UTF8String::ConcatHex ( uint32 const  dwValue)

Add an hexadecimal value.

UTF8String& CPNS::UTF8String::ConcatHex_0x02 ( uint8 const  bValue)

Add an hexadecimal value, 0x** formated.

UTF8String& CPNS::UTF8String::ConcatHex_0x04 ( uint16 const  wValue)

Add an hexadecimal value, 0x**** formated.

UTF8String& CPNS::UTF8String::ConcatHex_0x08 ( uint32 const  dwValue)

Add an hexadecimal value, 0x******** formated.

UTF8String& CPNS::UTF8String::ConcatHex_n ( uint8 const *const  pbValue,
uint8 const  nbytes 
)

Add an hexadecimal value, ** ** ** formated.

UTF8String& CPNS::UTF8String::ConcatInt ( int32 const  nValue)

Add a signed integer value, base10 formated.

CPNS::boolean CPNS::UTF8String::ContainsIgnoreCase ( CPNS::char8 const *const  utf8SearchedString)

Check if the string contains a substring, don't car about the case.

Returns
TRUE if the utf8SearchedString is contained in the string
UTF8String CPNS::UTF8String::FromFirstOccurrenceOf ( CPNS::char8 const *const  utf8SearchedString,
CPNS::boolean const  fIncludeSubStringInResult,
CPNS::boolean  fIgnoreCase 
) const

Extract a substring from the first occurrence of the specified searched string.

static UTF8String CPNS::UTF8String::FromFloat32 ( CPNS::float32 const  fValue,
uint8 const  numOfDecimals 
)
static

Create a string representing a float 32 value.

static UTF8String CPNS::UTF8String::FromFloat64 ( CPNS::float64 const  dValue,
uint8 const  numOfDecimals 
)
static

Create a string representing a float 64 value.

static UTF8String CPNS::UTF8String::FromInt32 ( CPNS::int32 const  lValue)
static

Create a string representing an signed int 32 value.

UTF8String CPNS::UTF8String::FromLastOccurrenceOf ( CPNS::char8 const *const  utf8SearchedString,
CPNS::boolean const  fIncludeSubStringInResult,
CPNS::boolean  fIgnoreCase 
) const

Extract a substring from the last occurrence of the specified searched string.

static UTF8String CPNS::UTF8String::FromUInt32 ( CPNS::uint32 const  dwValue)
static

Create a string representing an unsigned int 32 value.

char8 const* CPNS::UTF8String::Get ( ) const

Get a pointer to the UTF8 string.

char8 const* CPNS::UTF8String::GetAt ( int  offset) const

Get a pointer to the UTF8 string starting at the character offset.

uint16 CPNS::UTF8String::GetRawLength ( ) const

Get the size of the string in bytes, without ending zero.

boolean CPNS::UTF8String::IsEmpty ( ) const

Check if the string is empty.

uint16 CPNS::UTF8String::Length ( ) const

Get the number of characters, without ending zero.

boolean CPNS::UTF8String::MakeValidName ( ) const

Transform the string in a valid name (change "\" or "/" to "-")

CPNS::UTF8String::operator char8 const * ( ) const

Implicit utf8 string getter operator.

UTF8String CPNS::UTF8String::operator+ ( UTF8String const &  utf8String) const

Concat operator.

UTF8String CPNS::UTF8String::operator+= ( UTF8String const &  utf8String)

Concat operator.

UTF8String& CPNS::UTF8String::operator= ( UTF8String const &  utf8String)

Equality check operator.

void CPNS::UTF8String::Set ( UTF8String const &  string)

Copy from another UTF8String.

void CPNS::UTF8String::Set ( char8 const *const  utf8sString)

Copy from null terminated UTF8 string.

Warning
in case of using ASCII string, take care to not use extended ASCII characters. Use ONLY 0-127 character values.
void CPNS::UTF8String::Set ( char8 const *const  utf8String,
uint16 const  wNumCharsToCopy 
)

Copy a maximum number of characters from null terminated utf8 string.

Warning
in case of using ASCII string, take care to not use extended ASCII characters. Use ONLY 0-127 character values.
void CPNS::UTF8String::Set ( char16 const *const  unicodeString)

Copy from null terminated unicode string.

void CPNS::UTF8String::Set ( char16 const *const  unicodeString,
uint16 const  wNumCharsToCopy 
)

Copy a maximum number of characters from null terminated unicode string.

void CPNS::UTF8String::SetFloat32 ( CPNS::float32 const  fValue,
uint8 const  numOfDecimals 
)

Set with a string representing a float 32 value.

void CPNS::UTF8String::SetFloat64 ( CPNS::float64 const  dValue,
uint8 const  numOfDecimals 
)

Set with a string representing a float 64 value.

void CPNS::UTF8String::SetInt32 ( CPNS::int32 const  lValue)

Set with a string representing an signed int 32 value.

void CPNS::UTF8String::SetUInt32 ( CPNS::uint32 const  dwValue)

Set with a string representing an unsigned int 32 value.

UTF8String CPNS::UTF8String::ToFirstOccurrenceOf ( CPNS::char8 const *const  utf8SearchedString,
CPNS::boolean const  fIncludeSubStringInResult,
CPNS::boolean  fIgnoreCase 
) const

Extract a substring to the first occurrence of the specified searched string.

uint16 CPNS::UTF8String::ToUnicode ( char16 *  wszUnicodeString,
uint16 const  wInputLength 
) const

Convert the string to UNICODE.

Member Data Documentation

UTF8String CPNS::UTF8String::NullString
static

Empty string value.