class UChar

# class UChar | A single Unicode character. More...
Full name | `TelEngine::UChar`
Definition | `#include <yateclass.h>`
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

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

## Detailed Description

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

inline explicit UChar (uint32_t code = 0) | ### UChar

Constructor from unsigned numeric code

Parameters:

code | Code of the Unicode character

inline explicit UChar (int32_t code) | ### UChar

Constructor from signed numeric code

Parameters:

code | Code of the Unicode character

inline explicit UChar (signed char code) | ### UChar

Constructor from signed character

Parameters:

code | Character to construct from

inline explicit UChar (unsigned char code) | ### UChar

Constructor from unsigned character

Parameters:

code | Character to construct from

inline UChar& operator= (uint32_t code) | ### operator=

Assignment operator from a character code

Parameters:

code | Character code to assign

Returns: Reference to this object

inline UChar& operator= (char code) | ### operator=

Assignment operator from a character

Parameters:

code | Character to assign

Returns: Reference to this object

inline uint32_t code () | ### code

[const]

Get the Unicode value of the character

Returns: Code of the character as defined by Unicode

inline const char* c_str () | ### c_str

[const]

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

Returns: The character as UTF-8 C string

inline operator const char* () | ### operator const char*

[const]

Conversion to "const char *" operator.

Returns: Pointer to the internally stored UTF-8 string

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

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

Parameters:

str | String to extract from, will be advanced past the character
maxChar | Maximum accepted Unicode character code
overlong | Accept overlong UTF-8 sequences (dangerous!)

Returns: True if an Unicode character was decoded from string

Generated by: paulc on bussard on Fri May 8 12:37:22 2015, using kdoc 2.0a54.