range_input.hpp
Go to the documentation of this file.
1 // Copyright (C) 2020-2024 Jonathan Müller and lexy contributors
2 // SPDX-License-Identifier: BSL-1.0
3 
4 #ifndef LEXY_INPUT_RANGE_INPUT_HPP_INCLUDED
5 #define LEXY_INPUT_RANGE_INPUT_HPP_INCLUDED
6 
7 #include <lexy/error.hpp>
8 #include <lexy/input/base.hpp>
9 #include <lexy/lexeme.hpp>
10 
11 namespace lexy
12 {
13 template <typename Encoding, typename Iterator, typename Sentinel = Iterator>
15 {
16 public:
17  using encoding = Encoding;
18  using char_type = typename encoding::char_type;
19 
20  using iterator = Iterator;
21  using sentinel = Sentinel;
22 
23  //=== constructors ===//
24  constexpr range_input() noexcept : _begin(), _end() {}
25 
26  constexpr range_input(iterator begin, sentinel end) noexcept : _begin(begin), _end(end) {}
27 
28  //=== access ===//
29  constexpr iterator begin() const noexcept
30  {
31  return _begin;
32  }
33 
34  constexpr sentinel end() const noexcept
35  {
36  return _end;
37  }
38 
39  //=== reader ===//
40  constexpr auto reader() const& noexcept
41  {
42  return _range_reader<Encoding>(_begin, _end);
43  }
44 
45 private:
46  Iterator _begin;
48 };
49 
50 template <typename Iterator, typename Sentinel>
51 range_input(Iterator begin, Sentinel end)
52  -> range_input<deduce_encoding<LEXY_DECAY_DECLTYPE(*begin)>, Iterator, Sentinel>;
53 
54 template <typename Encoding, typename Iterator, typename Sentinel>
55 constexpr bool input_is_view<range_input<Encoding, Iterator, Sentinel>> = true;
56 } // namespace lexy
57 
58 #endif // LEXY_INPUT_RANGE_INPUT_HPP_INCLUDED
59 
magic_enum::char_type
string_view::value_type char_type
Definition: magic_enum.hpp:145
lexy::range_input::encoding
Encoding encoding
Definition: range_input.hpp:17
lexy::range_input
Definition: range_input.hpp:14
lexy
Definition: any_ref.hpp:12
cx::end
constexpr auto end(const C &c) -> decltype(c.end())
Definition: wildcards.hpp:686
lexy::range_input::sentinel
Sentinel sentinel
Definition: range_input.hpp:21
lexy::deduce_encoding
typename _deduce_encoding< CharT >::type deduce_encoding
Definition: encoding.hpp:209
lexy::range_input::end
constexpr sentinel end() const noexcept
Definition: range_input.hpp:34
lexeme.hpp
lexy::range_input::begin
constexpr iterator begin() const noexcept
Definition: range_input.hpp:29
lexy::range_input::iterator
Iterator iterator
Definition: range_input.hpp:20
lexy::range_input::range_input
constexpr range_input(iterator begin, sentinel end) noexcept
Definition: range_input.hpp:26
lexy::range_input::char_type
typename encoding::char_type char_type
Definition: range_input.hpp:18
lexy::range_input::_end
LEXY_EMPTY_MEMBER Sentinel _end
Definition: range_input.hpp:47
LEXY_DECAY_DECLTYPE
#define LEXY_DECAY_DECLTYPE(...)
Definition: config.hpp:34
lexy::range_input
range_input(Iterator begin, Sentinel end) -> range_input< deduce_encoding< LEXY_DECAY_DECLTYPE(*begin)>, Iterator, Sentinel >
cx::begin
constexpr auto begin(const C &c) -> decltype(c.begin())
Definition: wildcards.hpp:661
lexy::range_input::range_input
constexpr range_input() noexcept
Definition: range_input.hpp:24
base.hpp
LEXY_EMPTY_MEMBER
#define LEXY_EMPTY_MEMBER
Definition: config.hpp:193
lexy::range_input::_begin
Iterator _begin
Definition: range_input.hpp:46
lexy::range_input::reader
constexpr auto reader() const &noexcept
Definition: range_input.hpp:40
error.hpp


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Dec 13 2024 03:19:17