|
A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
|
Functions | |
| bool | IsContinuation (char byte) |
Whether byte is a continuation byte – the middle of a character. | |
| size_t | SequenceWidth (char lead) |
Bytes in the sequence lead starts, from the lead byte alone. | |
| size_t | Utf16Units (char lead) |
UTF-16 code units the character at lead occupies: 2 above the BMP, else. | |
| bool | IsValid (std::string_view text) |
Whether text is well-formed UTF-8. | |
|
inline |
Whether byte is a continuation byte – the middle of a character.
|
inline |
Whether text is well-formed UTF-8.
Strict: overlong encodings, surrogate halves and anything above U+10FFFF are rejected, which is the definition Python's bytes.decode("utf-8"), Kotlin's String(bytes) and JavaScript's TextDecoder with fatal all enforce. See a11::IsValidUtf8 in a11/json_codec.h for why A11 refuses such bytes on the way out rather than letting a peer fail on them.
|
inline |
Bytes in the sequence lead starts, from the lead byte alone.
1 for ASCII and for a malformed lead, so that walking a document that is not quite UTF-8 advances rather than stalling or running off the end. A caller that must reject malformed input wants IsValid instead.
|
inline |
UTF-16 code units the character at lead occupies: 2 above the BMP, else.