#ifndef UTF_UTF16_HH #define UTF_UTF16_HH #include "macros.hh" #include #include namespace utf { /** * Read one unicode codepoint from UTF-16 BigEndian encoded data if possible. * If successfull offset is incremented to point to next codepoint. * Will fail: * - not enough data is left in data given offset, returns NEED_MORE. * - data is not valid UTF-16, ie. invalid or incomplete surrogate pairs, * returns INVALID. */ uint32_t HIDDEN read16be(std::span data, std::size_t& offset); /** * Read one unicode codepoint from UTF-16 LittleEndian encoded data if possible. * If successfull offset is incremented to point to next codepoint. * Will fail: * - not enough data is left in data given offset, returns NEED_MORE. * - data is not valid UTF-16, ie. invalid or incomplete surrogate pairs, * returns INVALID. */ uint32_t HIDDEN read16le(std::span data, std::size_t& offset); } // namespace utf #endif // UTF_UTF16_HH