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

Functions

constexpr bool isSurrogate (uint32_t unit) noexcept
 check if code unit is a surrogate.
 
constexpr bool isHighSurrogate (uint32_t unit) noexcept
 check if code unit is a high surrogate.
 
constexpr bool isLowSurrogate (uint32_t unit) noexcept
 check if code unit is a low surrogate.
 
constexpr uint32_t highSurrogate (uint32_t codepoint) noexcept
 get the high surrogate of a supplementary codepoint.
 
constexpr uint32_t lowSurrogate (uint32_t codepoint) noexcept
 get the low surrogate of a supplementary codepoint.
 
constexpr uint32_t combine (uint32_t high, uint32_t low) noexcept
 combine a surrogate pair into a codepoint.
 
int decode (const char16_t *&cur, const char16_t *end, uint32_t &codepoint) noexcept
 decode one codepoint from UTF-16.
 
size_t encode (uint32_t codepoint, char16_t *out) noexcept
 encode one codepoint to UTF-16.
 

Function Documentation

◆ combine()

uint32_t join::utf16::combine ( uint32_t high,
uint32_t low )
constexprnoexcept

combine a surrogate pair into a codepoint.

Parameters
highhigh surrogate.
lowlow surrogate.
Returns
codepoint.

◆ decode()

int join::utf16::decode ( const char16_t *& cur,
const char16_t * end,
uint32_t & codepoint )
inlinenoexcept

decode one codepoint from UTF-16.

Parameters
curcurrent code unit, 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::utf16::encode ( uint32_t codepoint,
char16_t * out )
inlinenoexcept

encode one codepoint to UTF-16.

Parameters
codepointunicode scalar value to encode.
outoutput buffer of at least 2 code units.
Returns
number of code units written.

◆ highSurrogate()

uint32_t join::utf16::highSurrogate ( uint32_t codepoint)
constexprnoexcept

get the high surrogate of a supplementary codepoint.

Parameters
codepointcodepoint above U+FFFF.
Returns
high surrogate.

◆ isHighSurrogate()

bool join::utf16::isHighSurrogate ( uint32_t unit)
constexprnoexcept

check if code unit is a high surrogate.

Parameters
unitcode unit to check.
Returns
true if high surrogate, false otherwise.

◆ isLowSurrogate()

bool join::utf16::isLowSurrogate ( uint32_t unit)
constexprnoexcept

check if code unit is a low surrogate.

Parameters
unitcode unit to check.
Returns
true if low surrogate, false otherwise.

◆ isSurrogate()

bool join::utf16::isSurrogate ( uint32_t unit)
constexprnoexcept

check if code unit is a surrogate.

Parameters
unitcode unit to check.
Returns
true if surrogate, false otherwise.

◆ lowSurrogate()

uint32_t join::utf16::lowSurrogate ( uint32_t codepoint)
constexprnoexcept

get the low surrogate of a supplementary codepoint.

Parameters
codepointcodepoint above U+FFFF.
Returns
low surrogate.