diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-01-22 14:32:30 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-01-22 14:32:30 +0100 |
commit | 70b49d7abd466a8ab474643ed8d18e30bf17f25a (patch) | |
tree | 9f875d4e24b66ac644b5491454f0ccd60c0357e2 /serialize/binary-reader.inl | |
parent | 282cbae99ad55ed066595ee05736a89f93cc7381 (diff) |
w
Diffstat (limited to 'serialize/binary-reader.inl')
-rw-r--r-- | serialize/binary-reader.inl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/serialize/binary-reader.inl b/serialize/binary-reader.inl index 432b2fa0..b8bf6484 100644 --- a/serialize/binary-reader.inl +++ b/serialize/binary-reader.inl @@ -88,6 +88,19 @@ constexpr auto binary_reader<It>::read_asciiz_string() noexcept(false) } template<string_input_iterator It> +constexpr StringView binary_reader<It>::read_asciiz_string_() noexcept(false) +{ + It start = it; + while (it != end) + { + num_bytes_read++; + if (*it++ == '\0') + return StringView{&*start, (size_t)std::distance(start, it) - 1, StringViewFlag::NullTerminated}; + } + fm_throw("can't find string terminator"_cf); +} + +template<string_input_iterator It> constexpr char binary_reader<It>::peek() const { fm_soft_assert(it != end); |