join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::utf8 Namespace Reference

Namespaces

namespace  details
 

Functions

int decode (const char *&cur, const char *end, uint32_t &codepoint) noexcept
 decode one codepoint from UTF-8.
 
size_t encode (uint32_t codepoint, char *out) noexcept
 encode one codepoint to UTF-8.
 
int validate (const char *first, const char *last) noexcept
 validate UTF-8 input.
 
int compareUtf16Order (const char *first1, const char *last1, const char *first2, const char *last2) noexcept
 compare two UTF-8 inputs in UTF-16 code unit order.
 

Function Documentation

◆ compareUtf16Order()

int join::utf8::compareUtf16Order ( const char * first1,
const char * last1,
const char * first2,
const char * last2 )
inlinenoexcept

compare two UTF-8 inputs in UTF-16 code unit order.

Parameters
first1first byte of the first input.
last1end of the first input.
first2first byte of the second input.
last2end of the second input.
Returns
negative value if the first input is ordered before the second, 0 if equal, positive value otherwise.

◆ decode()

int join::utf8::decode ( const char *& cur,
const char * end,
uint32_t & codepoint )
inlinenoexcept

decode one codepoint from UTF-8.

Parameters
curcurrent byte, must be lower than end, advanced past the sequence on success.
endend of the input.
codepointdecoded codepoint.
Returns
0 on success, -1 otherwise.

◆ encode()

size_t join::utf8::encode ( uint32_t codepoint,
char * out )
inlinenoexcept

encode one codepoint to UTF-8.

Parameters
codepointunicode scalar value to encode.
outoutput buffer of at least 4 bytes.
Returns
number of bytes written.

◆ validate()

int join::utf8::validate ( const char * first,
const char * last )
inlinenoexcept

validate UTF-8 input.

Parameters
firstfirst byte of the input.
lastend of the input.
Returns
0 on success, -1 otherwise.