Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
utf8.cpp File Reference
#include "precompiled.h"
#include "lib/utf8.h"
Include dependency graph for utf8.cpp:

Classes

class  UTF8Codec
 

Typedefs

typedef u8 UTF8
 
typedef u32 UTF32
 

Functions

 STATUS_ADD_DEFINITIONS (utf8StatusDefinitions)
 
static UTF32 RaiseError (Status err, Status *perr)
 
static UTF32 ReplaceIfInvalid (UTF32 u, Status *err)
 
std::string utf8_from_wstring (const std::wstring &src, Status *err)
 opposite of wstring_from_utf8 More...
 
std::wstring wstring_from_utf8 (const std::string &src, Status *err)
 convert UTF-8 to a wide string (UTF-16 or UCS-4, depending on the platform's wchar_t). More...
 

Variables

static const StatusDefinition utf8StatusDefinitions []
 

Typedef Documentation

◆ UTF32

typedef u32 UTF32

◆ UTF8

typedef u8 UTF8

Function Documentation

◆ RaiseError()

static UTF32 RaiseError ( Status  err,
Status perr 
)
static

◆ ReplaceIfInvalid()

static UTF32 ReplaceIfInvalid ( UTF32  u,
Status err 
)
static

◆ STATUS_ADD_DEFINITIONS()

STATUS_ADD_DEFINITIONS ( utf8StatusDefinitions  )

◆ utf8_from_wstring()

std::string utf8_from_wstring ( const std::wstring &  src,
Status err 
)

opposite of wstring_from_utf8

◆ wstring_from_utf8()

std::wstring wstring_from_utf8 ( const std::string &  s,
Status err = 0 
)

convert UTF-8 to a wide string (UTF-16 or UCS-4, depending on the platform's wchar_t).

Parameters
sinput string (UTF-8)
errif nonzero, this receives the first error encountered (the rest may be subsequent faults) or INFO::OK if all went well. otherwise, the function raises a warning dialog for every error/warning.

Variable Documentation

◆ utf8StatusDefinitions

const StatusDefinition utf8StatusDefinitions[]
static
Initial value:
= {
{ ERR::UTF8_SURROGATE, L"UTF-16 surrogate pairs aren't supported" },
{ ERR::UTF8_OUTSIDE_BMP, L"Code point outside BMP (> 0x10000)" },
{ ERR::UTF8_NONCHARACTER, L"Noncharacter (e.g. WEOF)" },
{ ERR::UTF8_INVALID_UTF8, L"Invalid UTF-8 sequence" }
}
const Status UTF8_SURROGATE
Definition: utf8.h:31
const Status UTF8_OUTSIDE_BMP
Definition: utf8.h:32
const Status UTF8_NONCHARACTER
Definition: utf8.h:33
const Status UTF8_INVALID_UTF8
Definition: utf8.h:34