ArkScript
A small, fast, functional and scripting language for video games
utf8 Namespace Reference

Namespaces

namespace  details
 

Enumerations

enum class  Utf8Type {
  Ascii = 0 , LatinExtra = 1 , BasicMultiLingual = 2 , OthersPlanesUnicode = 3 ,
  OutRange = 4
}
 

Functions

Utf8Type utf8type (const char *input, int32_t *out=nullptr)
 
void decode (const char *input, char *dest)
 Convert hex string to utf8 string.
 
bool isValid (const char *str)
 Check the validity of a given string in UTF8.
 
int32_t codepoint (const char *str)
 Compute the UTF8 codepoint for a given UTF8 char.
 
void codepointToUtf8 (const int32_t codepoint, char *dest)
 Generate an UTF8 character from a given codepoint.
 

Enumeration Type Documentation

◆ Utf8Type

enum class utf8::Utf8Type
strong
Enumerator
Ascii 
LatinExtra 
BasicMultiLingual 
OthersPlanesUnicode 
OutRange 

Definition at line 9 of file utf8.hpp.

Function Documentation

◆ codepoint()

int32_t utf8::codepoint ( const char * str)
inline

Compute the UTF8 codepoint for a given UTF8 char.

Parameters
str
Returns
UTF8 codepoint if valid, -1 otherwise

Definition at line 191 of file utf8.hpp.

References codepoint(), and isValid().

Referenced by codepoint(), and codepointToUtf8().

◆ codepointToUtf8()

void utf8::codepointToUtf8 ( const int32_t codepoint,
char * dest )
inline

Generate an UTF8 character from a given codepoint.

Parameters
codepoint
destOutput utf8 string (size [2,5]). Empty (\0) if input is invalid or out of range

Definition at line 233 of file utf8.hpp.

References codepoint().

◆ decode()

void utf8::decode ( const char * input,
char * dest )
inline

Convert hex string to utf8 string.

Parameters
input
destOutput utf8 string (size [2,5]). Empty (\0) if input is invalid or out of range

Definition at line 67 of file utf8.hpp.

References Ascii, utf8::details::ASCIIHexToInt, BasicMultiLingual, LatinExtra, OthersPlanesUnicode, OutRange, and utf8type().

Referenced by Ark::internal::Parser::string().

◆ isValid()

bool utf8::isValid ( const char * str)
inline

Check the validity of a given string in UTF8.

Parameters
str
Returns
true if the given string is a valid UTF88 string

Definition at line 138 of file utf8.hpp.

Referenced by codepoint().

◆ utf8type()

Utf8Type utf8::utf8type ( const char * input,
int32_t * out = nullptr )
inline

Definition at line 36 of file utf8.hpp.

References Ascii, BasicMultiLingual, LatinExtra, OthersPlanesUnicode, and OutRange.

Referenced by decode().