Yate: UChar Class Reference

Yate

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

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)
UChar & | operator= (uint32_t code)
UChar & | operator= (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

  code | Code of the Unicode character

UChar | ( | int32_t | code | ) |
| inlineexplicit

Constructor from signed numeric code

Parameters

  code | Code of the Unicode character

UChar | ( | signed char | code | ) |
| inlineexplicit

Constructor from signed character

Parameters

  code | Character to construct from

UChar | ( | unsigned char | code | ) |
| inlineexplicit

Constructor from unsigned character

Parameters

  code | Character 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

  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

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

  code | Character code to assign

Returns
  Reference to this object

References UChar::code().

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

Assignment operator from a character

Parameters

  code | Character to assign

Returns
  Reference to this object

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

- yateclass.h