diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-09-18 23:57:56 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-09-18 23:57:56 +0200 |
| commit | 50348284f5d82ccfd65b0c803ba0ba895912ceff (patch) | |
| tree | 61a7b6a32efdbc36c89d23c688d95b9f6b9a621b /src/u8.hh | |
| parent | 8e58293ef954d307875019c9a20eaee7dc7a3ed2 (diff) | |
java::uescape: Unicode reader that knows about Java's \uXXXX escapes
Diffstat (limited to 'src/u8.hh')
| -rw-r--r-- | src/u8.hh | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -13,7 +13,7 @@ namespace u8 { template <std::forward_iterator T> requires std::is_same_v<std::iter_value_t<T>, uint8_t> -std::expected<uint32_t, u::ReadError> read(T& start, const T& end) { +std::expected<uint32_t, u::ReadError> read(T& start, T const& end) { if (start == end) return std::unexpected(u::ReadError::End); uint32_t u; @@ -106,7 +106,7 @@ std::expected<uint32_t, u::ReadError> read(T& start, const T& end) { template <std::forward_iterator T> requires std::is_same_v<std::iter_value_t<T>, uint8_t> std::expected<uint32_t, u::ReadErrorReplace> read_replace(T& start, - const T& end, + T const& end, bool eof) { auto const tmp = start; auto ret = read(start, end); @@ -128,7 +128,7 @@ std::expected<uint32_t, u::ReadErrorReplace> read_replace(T& start, template <std::forward_iterator T> requires std::is_same_v<std::iter_value_t<T>, uint8_t> -bool write(T& start, const T& end, uint32_t code) { +bool write(T& start, T const& end, uint32_t code) { if (code < 0x80) { if (start == end) return false; @@ -164,7 +164,7 @@ bool write(T& start, const T& end, uint32_t code) { template <std::forward_iterator T> requires std::is_same_v<std::iter_value_t<T>, uint8_t> -bool skip(T& start, const T& end) { +bool skip(T& start, T const& end) { if (start == end) return false; switch (*start >> 4) { |
