VR-Link API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes
DtUnicodeChar Class Reference

A single unicode character. More...

+ Collaboration diagram for DtUnicodeChar:

Public Types

typedef unsigned int CodePoint
typedef unsigned short Surrogate
typedef unsigned char Octet
 A Unicode Octet is 8bit byte used in UTF-8 encoding.

Public Member Functions

 DtUnicodeChar ()
 DtUnicodeChar (const char c)
 Construct a unicode character for a character c.
 DtUnicodeChar (const wchar_t c)
 Construct a unicode character for a character c.
 DtUnicodeChar (const unsigned short s, const unsigned short c)
 Construct a pair of UTF-16 code units, where the first character must be a surrogate pair.
 DtUnicodeChar (const DtUnicodeChar &other)
DtUnicodeCharoperator= (const DtUnicodeChar &other)
bool operator== (const DtUnicodeChar &other) const
bool operator!= (const DtUnicodeChar &other) const
unsigned int utf8Length () const
 Calculate the utf-8 length of a code point.
template<int sizeofWChar_t>
unsigned int wchartLength () const
unsigned int wideStringLength () const
unsigned int utf16Length () const
unsigned int utf32Length () const
unsigned int utf16CodeUnits () const
unsigned int readUtf16 (const Surrogate *memory)
 Read from UTF-16 encoded memory, Returns number of code units read, NOT number of bytes.
void writeUtf16 (Surrogate *memory) const
void readUtf32 (const unsigned int *memory)
void writeUtf32 (unsigned int *memory) const
unsigned int readUtf8 (const unsigned char *memory)
void writeUtf8 (char *memory) const
template<int sizeofWchart>
void writeWCharT (wchar_t *memory) const
void writeWChar (wchar_t *memory) const
CodePoint codePoint () const

Static Public Member Functions

template<int sizeof_wchar_t>
static CodePoint widechar (const wchar_t c)
static bool isCodePointValid (CodePoint codePoint)
static bool isSurrogateSubstringValid (const Surrogate *start, const Surrogate *end, const Surrogate *substringStart, const Surrogate *substringEnd)
static bool isSurrogate (Surrogate cp)
static DtUnicodeChar fromUtf32 (unsigned int character)
static CodePoint decodeSurrogatePair (Surrogate hi, Surrogate lo)
static void encodeSurrogatePair (CodePoint cp, Surrogate &hi, Surrogate &lo)
static unsigned int utf8Length (const unsigned char c)
 Get the length based upon the first character.

Static Public Attributes

static const CodePoint CodePointMax = 0x0010ffff
static const Surrogate LeadSurrogateMin = 0xd800
static const Surrogate LeadSurrogateMax = 0xdbff
static const Surrogate TrailSurrogateMin = 0xdc00
static const Surrogate TrailSurrogateMax = 0xdfff

Protected Member Functions

 DtUnicodeChar (unsigned int utf32c)

Private Attributes

CodePoint myCodePoint

Detailed Description

A single unicode character.

Member Typedef Documentation

typedef unsigned int DtUnicodeChar::CodePoint
typedef unsigned char DtUnicodeChar::Octet

A Unicode Octet is 8bit byte used in UTF-8 encoding.

typedef unsigned short DtUnicodeChar::Surrogate

Constructor & Destructor Documentation

DtUnicodeChar::DtUnicodeChar ( )
inline

Referenced by fromUtf32().

DtUnicodeChar::DtUnicodeChar ( const char  c)
inlineexplicit

Construct a unicode character for a character c.

C is assumed to be either ASCII or Latin-1

DtUnicodeChar::DtUnicodeChar ( const wchar_t  c)
inlineexplicit

Construct a unicode character for a character c.

C is assumed to be either UTF-16 or UTF-32 depending on encoding. If an invalid UTF-16 character is supplied an exception will be thrown.

DtUnicodeChar::DtUnicodeChar ( const unsigned short  s,
const unsigned short  c 
)
inlineexplicit

Construct a pair of UTF-16 code units, where the first character must be a surrogate pair.

References isSurrogate().

DtUnicodeChar::DtUnicodeChar ( const DtUnicodeChar other)
inline
DtUnicodeChar::DtUnicodeChar ( unsigned int  utf32c)
inlineprotected

Member Function Documentation

CodePoint DtUnicodeChar::codePoint ( ) const
inline

References myCodePoint.

static CodePoint DtUnicodeChar::decodeSurrogatePair ( Surrogate  hi,
Surrogate  lo 
)
inlinestatic

Referenced by readUtf16().

static void DtUnicodeChar::encodeSurrogatePair ( CodePoint  cp,
Surrogate hi,
Surrogate lo 
)
inlinestatic

References LeadSurrogateMin, and TrailSurrogateMin.

Referenced by writeUtf16().

static DtUnicodeChar DtUnicodeChar::fromUtf32 ( unsigned int  character)
inlinestatic
Exceptions
DtInvalidInputif the character is not valid.

References DtUnicodeChar(), and isCodePointValid().

static bool DtUnicodeChar::isCodePointValid ( CodePoint  codePoint)
inlinestatic

References CodePointMax, and isSurrogate().

Referenced by fromUtf32().

static bool DtUnicodeChar::isSurrogate ( Surrogate  cp)
inlinestatic
static bool DtUnicodeChar::isSurrogateSubstringValid ( const Surrogate start,
const Surrogate end,
const Surrogate substringStart,
const Surrogate substringEnd 
)
inlinestatic
bool DtUnicodeChar::operator!= ( const DtUnicodeChar other) const
inline

References myCodePoint.

DtUnicodeChar& DtUnicodeChar::operator= ( const DtUnicodeChar other)
inline

References myCodePoint.

bool DtUnicodeChar::operator== ( const DtUnicodeChar other) const
inline

References myCodePoint.

unsigned int DtUnicodeChar::readUtf16 ( const Surrogate memory)
inline

Read from UTF-16 encoded memory, Returns number of code units read, NOT number of bytes.

References decodeSurrogatePair(), isSurrogate(), and myCodePoint.

void DtUnicodeChar::readUtf32 ( const unsigned int *  memory)
inline

References myCodePoint.

unsigned int DtUnicodeChar::readUtf8 ( const unsigned char *  memory)
inline

References myCodePoint.

unsigned int DtUnicodeChar::utf16CodeUnits ( ) const
inline

References myCodePoint.

unsigned int DtUnicodeChar::utf16Length ( ) const
inline

References myCodePoint.

unsigned int DtUnicodeChar::utf32Length ( ) const
inline
unsigned int DtUnicodeChar::utf8Length ( ) const
inline

Calculate the utf-8 length of a code point.

References myCodePoint.

static unsigned int DtUnicodeChar::utf8Length ( const unsigned char  c)
inlinestatic

Get the length based upon the first character.

unsigned int DtUnicodeChar::wchartLength< 4 > ( ) const
inline
DtUnicodeChar::CodePoint DtUnicodeChar::widechar< 2 > ( const wchar_t  c)
inlinestatic
unsigned int DtUnicodeChar::wideStringLength ( ) const
inline
void DtUnicodeChar::writeUtf16 ( Surrogate memory) const
inline
void DtUnicodeChar::writeUtf32 ( unsigned int *  memory) const
inline

References myCodePoint.

void DtUnicodeChar::writeUtf8 ( char *  memory) const
inline

References myCodePoint.

void DtUnicodeChar::writeWChar ( wchar_t *  memory) const
inline
void DtUnicodeChar::writeWCharT< 4 > ( wchar_t *  memory) const
inline

Member Data Documentation

const CodePoint DtUnicodeChar::CodePointMax = 0x0010ffff
static

Referenced by isCodePointValid().

const Surrogate DtUnicodeChar::LeadSurrogateMax = 0xdbff
static
const Surrogate DtUnicodeChar::LeadSurrogateMin = 0xd800
static
CodePoint DtUnicodeChar::myCodePoint
private
const Surrogate DtUnicodeChar::TrailSurrogateMax = 0xdfff
static

Referenced by isSurrogate().

const Surrogate DtUnicodeChar::TrailSurrogateMin = 0xdc00
static

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

Document ID: Generated on Fri Dec 2 02:42:08 EST 2016 from SVN revision 171416
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)