parsi/base.hpp
-
namespace parsi
Variables
- template<typename T> concept is_parser = requires(T instance) {{std::forward<T>(instance)(std::declval<Stream>())} -> std::convertible_to<Result>;}
-
class Stream
- #include <base.hpp>
A wrapper for non-owning byte stream buffer.
Public Types
-
using buffer_type = std::span<const char>
Public Functions
-
inline constexpr Stream(const char *str) noexcept
-
inline constexpr Stream(const char *str, const std::size_t size) noexcept
-
inline constexpr Stream(std::string_view str) noexcept
-
inline constexpr Stream(buffer_type buffer) noexcept
-
inline constexpr void advance(std::size_t count) noexcept
advance the cursor forward by given
count
.
-
inline constexpr auto advanced(std::size_t count) const noexcept -> Stream
returns a copy of this stream that is advanced forward by
count
bytes.
-
inline constexpr auto starts_with(const char character) const noexcept -> bool
-
inline constexpr auto starts_with(std::span<const char> span) const noexcept -> bool
-
inline constexpr auto size() const noexcept -> std::size_t
size of the available buffer in stream.
-
inline constexpr auto buffer_size() const noexcept -> std::size_t
size of the underlying buffer.
-
inline constexpr auto cursor() const noexcept -> std::size_t
an index to current position into the buffer.
-
inline constexpr auto buffer() const noexcept -> buffer_type
underlying buffer.
-
inline constexpr auto remaining_buffer() const noexcept -> buffer_type
returns the remaining buffer span.
-
inline constexpr auto at(const std::size_t index) const noexcept -> const char
-
inline constexpr auto front() const noexcept -> const char
first byte in the remainder of buffer.
-
using buffer_type = std::span<const char>