wren
Vulkan-based game engine
Loading...
Searching...
No Matches
string_reader.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string_view>
4
5namespace wren::utils {
6
8 public:
9 StringReader(const std::string_view& input) : input_(input) {}
10
11 void skip_to_text_end(const std::string_view& text);
12
13 auto read_to_end_line() -> std::string_view;
14
15 auto read_to_text_start(const std::string_view& text) -> std::string_view;
16
17 [[nodiscard]] auto at_end() const {
18 //
19 return position_ > input_.size(); }
20
21 private:
22 auto substr(std::string_view::size_type start,
23 std::string_view::size_type end) -> std::string_view;
24
25 std::string_view input_;
26 std::string_view::size_type position_{};
27};
28
29} // namespace wren::utils
Definition string_reader.hpp:7
std::string_view::size_type position_
Definition string_reader.hpp:26
void skip_to_text_end(const std::string_view &text)
Definition string_reader.cpp:5
auto read_to_end_line() -> std::string_view
Definition string_reader.cpp:10
StringReader(const std::string_view &input)
Definition string_reader.hpp:9
auto at_end() const
Definition string_reader.hpp:17
auto read_to_text_start(const std::string_view &text) -> std::string_view
Definition string_reader.cpp:18
std::string_view input_
Definition string_reader.hpp:25
auto substr(std::string_view::size_type start, std::string_view::size_type end) -> std::string_view
Definition string_reader.cpp:28
Definition binray_reader.hpp:6