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

Classes

struct  OrderTable
 rank of UTF-8 bytes in UTF-16 code unit order. More...
 
struct  SequenceTable
 UTF-8 well-formed multibyte sequences indexed by lead byte. More...
 

Functions

uint32_t sequenceLength (const uint8_t *cur, const uint8_t *end) noexcept
 get the length of a multibyte sequence.
 
int validateMixed (const uint8_t *cur, const uint8_t *end) noexcept
 validate UTF-8 input that may contain multibyte sequences.
 

Variables

constexpr SequenceTable sequenceLookup {}
 UTF-8 multibyte sequences lookup table.
 
constexpr OrderTable orderLookup {}
 UTF-16 code unit order lookup table.
 
constexpr uint64_t highBits = 0x8080808080808080ULL
 mask of the high bit of each byte of a 64 bits word.
 

Function Documentation

◆ sequenceLength()

uint32_t join::utf8::details::sequenceLength ( const uint8_t * cur,
const uint8_t * end )
inlinenoexcept

get the length of a multibyte sequence.

Parameters
curlead byte of the sequence.
endend of the input.
Returns
sequence length, 0 if the sequence is ill-formed.

◆ validateMixed()

int join::utf8::details::validateMixed ( const uint8_t * cur,
const uint8_t * end )
inlinenoexcept

validate UTF-8 input that may contain multibyte sequences.

Parameters
curfirst byte of the input.
endend of the input.
Returns
0 on success, -1 otherwise.

Variable Documentation

◆ highBits

uint64_t join::utf8::details::highBits = 0x8080808080808080ULL
constexpr

mask of the high bit of each byte of a 64 bits word.

◆ orderLookup

OrderTable join::utf8::details::orderLookup {}
constexpr

UTF-16 code unit order lookup table.

◆ sequenceLookup

SequenceTable join::utf8::details::sequenceLookup {}
constexpr

UTF-8 multibyte sequences lookup table.