HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
hi::v1::char_map< Encoding > Struct Template Reference

Detailed Description

template<fixed_string Encoding>
struct hi::v1::char_map< Encoding >

Character encoder/decoder template.

Template Parameters
Encodinga string-tag representing the encoding.

Implementations have to define the following members:

Character type.

char_type

Read a single code-point

constexpr std::pair<char32_t, bool> read(char_type const *& ptr, char_type const *last) const noexcept
@ read
Allow read access to a file.
Definition access_mode.hpp:18
  • [in,out]ptr Pointer to the first code-unit of the code-point to read. on return the pointer will point beyond the last code-unit of the code-point that was read.
  • last A pointer pointing one beyond the string.
  • return (code-point, valid) The function will always return a code-point, even if there was a parse error, in this case valid is false.

Determine number of code-units for a code-point.

constexpr std::pair<uint8_t, bool> size(char32_t code_point) const noexcept
  • code_point The code-point to encode.
  • return (count, valid) If the code-point can not be encoded valid will be false, end count will contain the number of code-unit needed to encode a replacement character.

Encode a single code-point.

constexpr void write(char32_t code_point, char_type *&ptr) const noexcept
@ write
Allow write access to a file.
Definition access_mode.hpp:19
  • code_point The code-point to encode.
  • [in,out]ptr The pointer where the code-units will be written. On return will contain the pointer beyond where the code-units where written. It is undefined behavior if the ptr does not point to a valid buffer where all the code-units can be written to.

Read a chunk of ASCII characters.

__m128i read_ascii_chunk16(char_type const *ptr) const noexcept

read_ascii_chunk16() returns a 16 byte register. The implementation of this function must set the high-bit of each non-ASCII character.

  • ptr A pointer to the first character of a chunk of 16 characters.
  • return 16 bytes in a register, bit 7 must be '1' if the character is not ASCII.

Write a chunk of ASCII characters.

void write_ascii_chunk16(__m128i chunk, char_type *ptr) const noexcept
  • chunk A chunk of 16 ascii characters. bit 7 is always '0'.
  • ptr The pointer to the first code-unit where the ASCII characters must be written to.

The documentation for this struct was generated from the following file: