Yate
Public Member Functions | List of all members
UChar Class Reference

A single Unicode character. More...

#include <yateclass.h>

Public Member Functions

 UChar (uint32_t code=0)
 
 UChar (int32_t code)
 
 UChar (signed char code)
 
 UChar (unsigned char code)
 
UCharoperator= (uint32_t code)
 
UCharoperator= (char code)
 
uint32_t code () const
 
const char * c_str () const
 
 operator const char * () const
 
bool decode (const char *&str, uint32_t maxChar=0x10ffff, bool overlong=false)
 

Detailed Description

A single Unicode character.

A simple class to hold a single Unicode character and convert it to / from UTF-8

Constructor & Destructor Documentation

UChar ( uint32_t  code = 0)
inlineexplicit

Constructor from unsigned numeric code

Parameters
codeCode of the Unicode character
UChar ( int32_t  code)
inlineexplicit

Constructor from signed numeric code

Parameters
codeCode of the Unicode character
UChar ( signed char  code)
inlineexplicit

Constructor from signed character

Parameters
codeCharacter to construct from
UChar ( unsigned char  code)
inlineexplicit

Constructor from unsigned character

Parameters
codeCharacter to construct from

Member Function Documentation

const char* c_str ( ) const
inline

Get the value of the character as UTF-8 string.

Returns
The character as UTF-8 C string
uint32_t code ( ) const
inline

Get the Unicode value of the character

Returns
Code of the character as defined by Unicode

Referenced by UChar::operator=().

bool decode ( const char *&  str,
uint32_t  maxChar = 0x10ffff,
bool  overlong = false 
)

Decode the first Unicode character from an UTF-8 C string

Parameters
strString to extract from, will be advanced past the character
maxCharMaximum accepted Unicode character code
overlongAccept overlong UTF-8 sequences (dangerous!)
Returns
True if an Unicode character was decoded from string
operator const char * ( ) const
inline

Conversion to "const char *" operator.

Returns
Pointer to the internally stored UTF-8 string
UChar& operator= ( uint32_t  code)
inline

Assignment operator from a character code

Parameters
codeCharacter code to assign
Returns
Reference to this object

References UChar::code().

UChar& operator= ( char  code)
inline

Assignment operator from a character

Parameters
codeCharacter to assign
Returns
Reference to this object

The documentation for this class was generated from the following file: