buffer.hpp
Go to the documentation of this file.
1 // Copyright (C) 2020-2023 Jonathan Müller and lexy contributors
2 // SPDX-License-Identifier: BSL-1.0
3 
4 #ifndef LEXY_INPUT_BUFFER_HPP_INCLUDED
5 #define LEXY_INPUT_BUFFER_HPP_INCLUDED
6 
7 #include <cstring>
9 #include <lexy/_detail/swar.hpp>
10 #include <lexy/error.hpp>
11 #include <lexy/input/base.hpp>
12 #include <lexy/lexeme.hpp>
13 
14 namespace lexy
15 {
16 // The reader used by the buffer if it can use a sentinel.
17 template <typename Encoding>
18 class _br : public _detail::swar_reader_base<_br<Encoding>>
19 {
20 public:
21  using encoding = Encoding;
22  using iterator = const typename Encoding::char_type*;
23 
24  explicit _br(iterator begin) noexcept : _cur(begin) {}
25 
26  auto peek() const noexcept
27  {
28  // The last one will be EOF.
29  return *_cur;
30  }
31 
32  void bump() noexcept
33  {
34  ++_cur;
35  }
36 
37  iterator position() const noexcept
38  {
39  return _cur;
40  }
41 
42  void set_position(iterator new_pos) noexcept
43  {
44  _cur = new_pos;
45  }
46 
47 private:
49 };
50 
51 // We use aliases for the three encodings that can actually use it.
52 // (i.e. where char_type == int_type).
57 
58 // Create the appropriate buffer reader.
59 template <typename Encoding>
60 constexpr auto _buffer_reader(const typename Encoding::char_type* data)
61 {
62  if constexpr (std::is_same_v<Encoding, lexy::ascii_encoding>)
63  return _bra(data);
64  else if constexpr (std::is_same_v<Encoding, lexy::utf8_encoding>)
65  return _br8(data);
66  else if constexpr (std::is_same_v<Encoding, lexy::utf8_char_encoding>)
67  return _brc(data);
68  else if constexpr (std::is_same_v<Encoding, lexy::utf32_encoding>)
69  return _br32(data);
70  else
71  return _br<Encoding>(data);
72 }
73 } // namespace lexy
74 
75 namespace lexy
76 {
80 template <typename Encoding = default_encoding, typename MemoryResource = void>
81 class buffer
82 {
83  static constexpr auto _has_sentinel
84  = std::is_same_v<typename Encoding::char_type, typename Encoding::int_type>;
85 
86 public:
87  using encoding = Encoding;
88  using char_type = typename encoding::char_type;
89  static_assert(std::is_trivial_v<char_type>);
90 
91  //=== constructors ===//
93  class builder
94  {
95  public:
96  explicit builder(std::size_t size,
97  MemoryResource* resource = _detail::get_memory_resource<MemoryResource>())
98  : _buffer(resource)
99  {
101  _buffer._size = size;
102  }
103 
104  char_type* data() const noexcept
105  {
106  return _buffer._data;
107  }
108  std::size_t size() const noexcept
109  {
110  return _buffer._size;
111  }
112 
113  buffer finish() && noexcept
114  {
115  return LEXY_MOV(_buffer);
116  }
117 
118  private:
120  };
121 
122  constexpr buffer() noexcept : buffer(_detail::get_memory_resource<MemoryResource>()) {}
123 
124  constexpr explicit buffer(MemoryResource* resource) noexcept
125  : _resource(resource), _data(nullptr), _size(0)
126  {}
127 
128  explicit buffer(const char_type* data, std::size_t size,
129  MemoryResource* resource = _detail::get_memory_resource<MemoryResource>())
130  : _resource(resource), _size(size)
131  {
132  _data = allocate(size);
133  if (size > 0)
134  std::memcpy(_data, data, size * sizeof(char_type));
135  }
136  explicit buffer(const char_type* begin, const char_type* end,
137  MemoryResource* resource = _detail::get_memory_resource<MemoryResource>())
138  : buffer(begin, std::size_t(end - begin), resource)
139  {}
140 
141  template <typename CharT, typename = _detail::require_secondary_char_type<encoding, CharT>>
142  explicit buffer(const CharT* data, std::size_t size,
143  MemoryResource* resource = _detail::get_memory_resource<MemoryResource>())
144  : buffer(reinterpret_cast<const char_type*>(data), size, resource)
145  {
146  static_assert(sizeof(CharT) == sizeof(char_type));
147  }
148  template <typename CharT, typename = _detail::require_secondary_char_type<encoding, CharT>>
149  explicit buffer(const CharT* begin, const CharT* end,
150  MemoryResource* resource = _detail::get_memory_resource<MemoryResource>())
151  : buffer(reinterpret_cast<const char_type*>(begin), reinterpret_cast<const char_type*>(end),
152  resource)
153  {
154  static_assert(sizeof(CharT) == sizeof(char_type));
155  }
156 
157  template <typename View, typename = decltype(LEXY_DECLVAL(View).data())>
158  explicit buffer(const View& view,
159  MemoryResource* resource = _detail::get_memory_resource<MemoryResource>())
160  : buffer(view.data(), view.size(), resource)
161  {}
162 
163  buffer(const buffer& other) : buffer(other.data(), other.size(), other._resource.get()) {}
164  buffer(const buffer& other, MemoryResource* resource)
165  : buffer(other.data(), other.size(), resource)
166  {}
167 
168  buffer(buffer&& other) noexcept
169  : _resource(other._resource), _data(other._data), _size(other._size)
170  {
171  other._data = nullptr;
172  other._size = 0;
173  }
174 
175  ~buffer() noexcept
176  {
177  if (!_data)
178  return;
179 
180  if constexpr (_has_sentinel)
181  _resource->deallocate(_data,
183  alignof(char_type));
184  else
185  _resource->deallocate(_data, _size * sizeof(char_type), alignof(char_type));
186  }
187 
188  buffer& operator=(const buffer& other) // NOLINT: we do guard against self-assignment
189  {
190  // Create a temporary buffer that owns the same memory as other but with our resource.
191  // We then move assign it to *this.
192  *this = buffer(other, _resource.get());
193  return *this;
194  }
195 
196  // NOLINTNEXTLINE: Unfortunately, sometimes move is not noexcept.
197  buffer& operator=(buffer&& other) noexcept(std::is_empty_v<MemoryResource>)
198  {
199  if (*_resource == *other._resource)
200  {
201  // We have the same resource; we can just steal other's memory.
202  // We do that by swapping - when other is destroyed it will free our memory.
203  _detail::swap(_data, other._data);
204  _detail::swap(_size, other._size);
205  return *this;
206  }
207  else
208  {
209  LEXY_PRECONDITION(!std::is_empty_v<MemoryResource>);
210 
211  // We create a copy using the right resource and swap the ownership.
212  buffer copy(other, _resource.get());
213  _detail::swap(_data, copy._data);
214  _detail::swap(_size, copy._size);
215  return *this;
216  }
217  }
218 
219  //=== access ===//
220  const char_type* data() const noexcept
221  {
222  return _data;
223  }
224 
225  std::size_t size() const noexcept
226  {
227  return _size;
228  }
229 
230  //=== input ===//
231  auto reader() const& noexcept
232  {
233  if constexpr (_has_sentinel)
234  return _buffer_reader<encoding>(_data);
235  else
236  return _range_reader<encoding>(_data, _data + _size);
237  }
238 
239 private:
240  char_type* allocate(std::size_t size) const
241  {
242  if constexpr (_has_sentinel)
243  {
244  auto mem_size = _detail::round_size_for_swar(size + 1);
245  auto memory = static_cast<char_type*>(
246  _resource->allocate(mem_size * sizeof(char_type), alignof(char_type)));
247 
248  for (auto ptr = memory + size; ptr != memory + mem_size; ++ptr)
249  *ptr = encoding::eof();
250 
251  return memory;
252  }
253  else
254  {
255  return static_cast<char_type*>(
256  _resource->allocate(size * sizeof(char_type), alignof(char_type)));
257  }
258  }
259 
262  std::size_t _size;
263 };
264 
265 template <typename CharT>
266 buffer(const CharT*, const CharT*) -> buffer<deduce_encoding<CharT>>;
267 template <typename CharT>
268 buffer(const CharT*, std::size_t) -> buffer<deduce_encoding<CharT>>;
269 template <typename View>
270 buffer(const View&) -> buffer<deduce_encoding<LEXY_DECAY_DECLTYPE(*LEXY_DECLVAL(View).data())>>;
271 
272 template <typename CharT, typename MemoryResource>
273 buffer(const CharT*, const CharT*, MemoryResource*)
274  -> buffer<deduce_encoding<CharT>, MemoryResource>;
275 template <typename CharT, typename MemoryResource>
276 buffer(const CharT*, std::size_t, MemoryResource*)
277  -> buffer<deduce_encoding<CharT>, MemoryResource>;
278 template <typename View, typename MemoryResource>
279 buffer(const View&, MemoryResource*)
280  -> buffer<deduce_encoding<LEXY_DECAY_DECLTYPE(*LEXY_DECLVAL(View).data())>, MemoryResource>;
281 
282 //=== make_buffer ===//
283 template <typename Encoding, encoding_endianness Endian>
285 {
286  template <typename MemoryResource = void>
287  auto operator()(const void* _memory, std::size_t size,
288  MemoryResource* resource = _detail::get_memory_resource<MemoryResource>()) const
289  {
290  constexpr auto native_endianness
291  = LEXY_IS_LITTLE_ENDIAN ? encoding_endianness::little : encoding_endianness::big;
292 
293  using char_type = typename Encoding::char_type;
294  LEXY_PRECONDITION(size % sizeof(char_type) == 0);
295  auto memory = static_cast<const unsigned char*>(_memory);
296 
297  if constexpr (sizeof(char_type) == 1 || Endian == native_endianness)
298  {
299  // No need to deal with endianness at all.
300  // The reinterpret_cast is technically UB, as we didn't create objects in memory,
301  // but until std::start_lifetime_as is added, there is nothing we can do.
302  return buffer<Encoding, MemoryResource>(reinterpret_cast<const char_type*>(memory),
303  size / sizeof(char_type), resource);
304  }
305  else
306  {
307  typename buffer<Encoding, MemoryResource>::builder builder(size / sizeof(char_type),
308  resource);
309 
310  const auto end = memory + size;
311  for (auto dest = builder.data(); memory != end; memory += sizeof(char_type))
312  {
313  constexpr auto is_char16 = std::is_same_v<char_type, char16_t>;
314  constexpr auto is_char32 = std::is_same_v<char_type, char32_t>;
315 
316  // We convert each group of bytes to the appropriate value.
317  if constexpr (is_char16 && Endian == encoding_endianness::little)
318  *dest++ = static_cast<char_type>((memory[0] << 0) | (memory[1] << 8));
319  else if constexpr (is_char32 && Endian == encoding_endianness::little)
320  *dest++ = static_cast<char_type>((memory[0] << 0) | (memory[1] << 8)
321  | (memory[2] << 16) | (memory[3] << 24));
322  else if constexpr (is_char16 && Endian == encoding_endianness::big)
323  *dest++ = static_cast<char_type>((memory[0] << 8) | (memory[1] << 0));
324  else if constexpr (is_char32 && Endian == encoding_endianness::big)
325  *dest++ = static_cast<char_type>((memory[0] << 24) | (memory[1] << 16)
326  | (memory[2] << 8) | (memory[3] << 0));
327  else
328  static_assert(_detail::error<Encoding>, "unhandled encoding/endianness");
329  }
330 
331  return LEXY_MOV(builder).finish();
332  }
333  }
334 };
335 template <>
337 {
338  template <typename MemoryResource = void>
339  auto operator()(const void* _memory, std::size_t size,
340  MemoryResource* resource = _detail::get_memory_resource<MemoryResource>()) const
341  {
342  auto memory = static_cast<const unsigned char*>(_memory);
343 
344  // We just skip over the BOM if there is one, it doesn't matter.
345  if (size >= 3 && memory[0] == 0xEF && memory[1] == 0xBB && memory[2] == 0xBF)
346  {
347  memory += 3;
348  size -= 3;
349  }
350 
352  }
353 };
354 template <>
356 {
357  template <typename MemoryResource = void>
358  auto operator()(const void* _memory, std::size_t size,
359  MemoryResource* resource = _detail::get_memory_resource<MemoryResource>()) const
360  {
361  auto memory = static_cast<const unsigned char*>(_memory);
362 
363  // We just skip over the BOM if there is one, it doesn't matter.
364  if (size >= 3 && memory[0] == 0xEF && memory[1] == 0xBB && memory[2] == 0xBF)
365  {
366  memory += 3;
367  size -= 3;
368  }
369 
371  }
372 };
373 template <>
375 {
376  template <typename MemoryResource = void>
377  auto operator()(const void* _memory, std::size_t size,
378  MemoryResource* resource = _detail::get_memory_resource<MemoryResource>()) const
379  {
380  constexpr auto utf16_big = _make_buffer<utf16_encoding, encoding_endianness::big>{};
381  constexpr auto utf16_little = _make_buffer<utf16_encoding, encoding_endianness::little>{};
382  auto memory = static_cast<const unsigned char*>(_memory);
383 
384  if (size < 2)
385  return utf16_big(memory, size, resource);
386  if (memory[0] == 0xFF && memory[1] == 0xFE)
387  return utf16_little(memory + 2, size - 2, resource);
388  else if (memory[0] == 0xFE && memory[1] == 0xFF)
389  return utf16_big(memory + 2, size - 2, resource);
390  else
391  return utf16_big(memory, size, resource);
392  }
393 };
394 template <>
396 {
397  template <typename MemoryResource = void>
398  auto operator()(const void* _memory, std::size_t size,
399  MemoryResource* resource = _detail::get_memory_resource<MemoryResource>()) const
400  {
401  constexpr auto utf32_big = _make_buffer<utf32_encoding, encoding_endianness::big>{};
402  constexpr auto utf32_little = _make_buffer<utf32_encoding, encoding_endianness::little>{};
403  auto memory = static_cast<const unsigned char*>(_memory);
404 
405  if (size >= 4)
406  {
407  if (memory[0] == 0xFF && memory[1] == 0xFE && memory[2] == 0x00 && memory[3] == 0x00)
408  return utf32_little(memory + 4, size - 4, resource);
409  else if (memory[0] == 0x00 && memory[1] == 0x00 && memory[2] == 0xFE && memory[3])
410  return utf32_big(memory + 4, size - 4, resource);
411  }
412 
413  return utf32_big(memory, size, resource);
414  }
415 };
416 
418 template <typename Encoding, encoding_endianness Endianness>
420 
421 //=== make_buffer_from_input ===//
422 template <typename Input>
423 using _detect_input_data = decltype(LEXY_DECLVAL(Input&).data());
424 
425 template <typename Input, typename MemoryResource = void>
426 constexpr auto make_buffer_from_input(const Input& input,
427  MemoryResource* resource
428  = _detail::get_memory_resource<MemoryResource>())
430 {
431  using type = buffer<typename input_reader<Input>::encoding, MemoryResource>;
432  if constexpr (_detail::is_detected<_detect_input_data, Input>)
433  {
434  return type(input.data(), input.size(), resource);
435  }
436  else
437  {
438  auto reader = input.reader();
439  auto begin = reader.position();
440  while (reader.peek() != input_reader<Input>::encoding::eof())
441  reader.bump();
442  auto end = reader.position();
443 
444  if constexpr (std::is_pointer_v<decltype(begin)>)
445  {
446  return type(begin, end, resource);
447  }
448  else
449  {
451  typename type::builder builder(size, resource);
452  auto dest = builder.data();
453  for (auto cur = begin; cur != end; ++cur)
454  *dest++ = *cur; // NOLINT: clang-analyzer thinks this might access zero memory for
455  // some reason?!
456  return LEXY_MOV(builder).finish();
457  }
458  }
459 }
460 
461 //=== convenience typedefs ===//
462 template <typename Encoding = default_encoding, typename MemoryResource = void>
464 
465 template <typename Tag, typename Encoding = default_encoding, typename MemoryResource = void>
467 
468 template <typename Encoding = default_encoding, typename MemoryResource = void>
470 } // namespace lexy
471 
472 #endif // LEXY_INPUT_BUFFER_HPP_INCLUDED
473 
cx::size
constexpr auto size(const C &c) -> decltype(c.size())
Definition: wildcards.hpp:636
LEXY_MOV
#define LEXY_MOV(...)
Definition: config.hpp:21
lexy::encoding_endianness
encoding_endianness
The endianness used by an encoding.
Definition: encoding.hpp:15
lexy::_make_buffer
Definition: buffer.hpp:284
lexy::encoding_endianness::little
@ little
Little endian.
lexy::buffer::_resource
LEXY_EMPTY_MEMBER _detail::memory_resource_ptr< MemoryResource > _resource
Definition: buffer.hpp:260
lexy::LEXY_INSTANTIATION_NEWTYPE
LEXY_INSTANTIATION_NEWTYPE(_pr, _rr, Encoding, const typename Encoding::char_type *)
lexy::_detail::memory_resource_ptr
std::conditional_t< std::is_void_v< MemoryResource >, _memory_resource_ptr_empty< default_memory_resource >, std::conditional_t< std::is_empty_v< MemoryResource >, _memory_resource_ptr_empty< MemoryResource >, _memory_resource_ptr< MemoryResource > >> memory_resource_ptr
Definition: memory_resource.hpp:140
magic_enum::char_type
string_view::value_type char_type
Definition: magic_enum.hpp:145
lexy::buffer::~buffer
~buffer() noexcept
Definition: buffer.hpp:175
lexy::buffer::builder::_buffer
buffer _buffer
Definition: buffer.hpp:119
lexy::_detect_input_data
decltype(LEXY_DECLVAL(Input &).data()) _detect_input_data
Definition: buffer.hpp:423
lexy::_detail::get_memory_resource
constexpr MemoryResource * get_memory_resource()
Definition: memory_resource.hpp:146
lexy::_br::position
iterator position() const noexcept
Definition: buffer.hpp:37
lexy::make_buffer_from_input
constexpr auto make_buffer_from_input(const Input &input, MemoryResource *resource=_detail::get_memory_resource< MemoryResource >()) -> buffer< typename input_reader< Input >::encoding, MemoryResource >
Definition: buffer.hpp:426
lexy::buffer::allocate
char_type * allocate(std::size_t size) const
Definition: buffer.hpp:240
lexy::_br::bump
void bump() noexcept
Definition: buffer.hpp:32
lexy::buffer::buffer
buffer(const char_type *begin, const char_type *end, MemoryResource *resource=_detail::get_memory_resource< MemoryResource >())
Definition: buffer.hpp:136
lexy::_detail::round_size_for_swar
constexpr std::size_t round_size_for_swar(std::size_t size_in_bytes)
Definition: swar.hpp:235
lexy::_make_buffer< utf16_encoding, encoding_endianness::bom >::operator()
auto operator()(const void *_memory, std::size_t size, MemoryResource *resource=_detail::get_memory_resource< MemoryResource >()) const
Definition: buffer.hpp:377
lexy::error_context
Contains information about the context of an error, production is type-erased.
Definition: error.hpp:198
lexy::buffer::buffer
buffer(buffer &&other) noexcept
Definition: buffer.hpp:168
lexy
Definition: any_ref.hpp:12
LEXY_PRECONDITION
#define LEXY_PRECONDITION(Expr)
Definition: assert.hpp:36
lexy::buffer::buffer
buffer(const char_type *data, std::size_t size, MemoryResource *resource=_detail::get_memory_resource< MemoryResource >())
Definition: buffer.hpp:128
lexy::utf32_encoding
An encoding where the input is assumed to be valid UTF-32.
Definition: encoding.hpp:156
lexy::buffer::_data
char_type * _data
Definition: buffer.hpp:261
cx::end
constexpr auto end(const C &c) -> decltype(c.end())
Definition: wildcards.hpp:686
lexy::_make_buffer< utf32_encoding, encoding_endianness::bom >::operator()
auto operator()(const void *_memory, std::size_t size, MemoryResource *resource=_detail::get_memory_resource< MemoryResource >()) const
Definition: buffer.hpp:398
lexy::_br::set_position
void set_position(iterator new_pos) noexcept
Definition: buffer.hpp:42
lexy::error
Generic failure.
Definition: error.hpp:14
lexy::deduce_encoding
typename _deduce_encoding< CharT >::type deduce_encoding
Definition: encoding.hpp:209
lexy::buffer::buffer
buffer(const buffer &other)
Definition: buffer.hpp:163
lexy::_make_buffer::operator()
auto operator()(const void *_memory, std::size_t size, MemoryResource *resource=_detail::get_memory_resource< MemoryResource >()) const
Definition: buffer.hpp:287
lexy::_br::iterator
const typename Encoding::char_type * iterator
Definition: buffer.hpp:22
swar.hpp
lexy::_make_buffer< utf8_encoding, encoding_endianness::bom >::operator()
auto operator()(const void *_memory, std::size_t size, MemoryResource *resource=_detail::get_memory_resource< MemoryResource >()) const
Definition: buffer.hpp:339
lexy::buffer::buffer
buffer(const CharT *data, std::size_t size, MemoryResource *resource=_detail::get_memory_resource< MemoryResource >())
Definition: buffer.hpp:142
lexy::_br::_br
_br(iterator begin) noexcept
Definition: buffer.hpp:24
lexeme.hpp
lexy::buffer
buffer(const CharT *, const CharT *) -> buffer< deduce_encoding< CharT >>
lexy::_detail::swap
constexpr void swap(T &lhs, T &rhs)
Definition: config.hpp:45
lexy::buffer::_size
std::size_t _size
Definition: buffer.hpp:262
lexy::buffer::reader
auto reader() const &noexcept
Definition: buffer.hpp:231
lexy::encoding_endianness::big
@ big
Big endian.
lexy::buffer::buffer
constexpr buffer(MemoryResource *resource) noexcept
Definition: buffer.hpp:124
lexy::_br::_cur
iterator _cur
Definition: buffer.hpp:48
lexy::buffer::operator=
buffer & operator=(const buffer &other)
Definition: buffer.hpp:188
lexyd::bom
constexpr auto bom
The BOM for that particular encoding.
Definition: bom.hpp:43
lexy::buffer::builder::data
char_type * data() const noexcept
Definition: buffer.hpp:104
lexy::buffer::buffer
constexpr buffer() noexcept
Definition: buffer.hpp:122
LEXY_DECAY_DECLTYPE
#define LEXY_DECAY_DECLTYPE(...)
Definition: config.hpp:26
lexy::utf8_encoding
An encoding where the input is assumed to be valid UTF-8.
Definition: encoding.hpp:84
lexy::buffer::data
const char_type * data() const noexcept
Definition: buffer.hpp:220
lexy::ascii_encoding
Definition: encoding.hpp:58
lexy::buffer< default_encoding, void >::char_type
typename encoding::char_type char_type
Definition: buffer.hpp:88
lexy::_detail::range_size
constexpr std::size_t range_size(Iterator begin, Sentinel end)
Definition: iterator.hpp:22
lexy::buffer::builder::finish
buffer finish() &&noexcept
Definition: buffer.hpp:113
lexy::default_encoding
An encoding where the input is some 8bit encoding (ASCII, UTF-8, extended ASCII etc....
Definition: encoding.hpp:27
lexy::_br::encoding
Encoding encoding
Definition: buffer.hpp:21
lexy::_br
Definition: buffer.hpp:18
lexy::utf8_char_encoding
An encoding where the input is assumed to be valid UTF-8, but the char type is char.
Definition: encoding.hpp:108
detail::get
auto get(const nlohmann::detail::iteration_proxy_value< IteratorType > &i) -> decltype(i.key())
Definition: json.hpp:5342
lexy::buffer::_has_sentinel
static constexpr auto _has_sentinel
Definition: buffer.hpp:84
cx::begin
constexpr auto begin(const C &c) -> decltype(c.begin())
Definition: wildcards.hpp:661
lexy::utf16_encoding
An encoding where the input is assumed to be valid UTF-16.
Definition: encoding.hpp:132
lexy::buffer::buffer
buffer(const View &view, MemoryResource *resource=_detail::get_memory_resource< MemoryResource >())
Definition: buffer.hpp:158
lexy::_buffer_reader
constexpr auto _buffer_reader(const typename Encoding::char_type *data)
Definition: buffer.hpp:60
lexy::make_buffer_from_raw
constexpr auto make_buffer_from_raw
Creates a buffer with the specified encoding/endianness from raw memory.
Definition: buffer.hpp:419
lexy::buffer::buffer
buffer(const CharT *begin, const CharT *end, MemoryResource *resource=_detail::get_memory_resource< MemoryResource >())
Definition: buffer.hpp:149
lexy::buffer
Definition: buffer.hpp:81
lexy::_br::peek
auto peek() const noexcept
Definition: buffer.hpp:26
std
Definition: std.hpp:30
lexy::lexeme
Definition: lexeme.hpp:16
lexy::buffer::size
std::size_t size() const noexcept
Definition: buffer.hpp:225
lexy::buffer::buffer
buffer(const buffer &other, MemoryResource *resource)
Definition: buffer.hpp:164
lexy::buffer::builder::builder
builder(std::size_t size, MemoryResource *resource=_detail::get_memory_resource< MemoryResource >())
Definition: buffer.hpp:96
lexy::buffer::builder
Allows the creation of an uninitialized buffer that is then filled by the user.
Definition: buffer.hpp:93
lexy::buffer::builder::size
std::size_t size() const noexcept
Definition: buffer.hpp:108
lexy::_detail::swar_reader_base
Definition: swar.hpp:199
base.hpp
lexy::buffer::operator=
buffer & operator=(buffer &&other) noexcept(std::is_empty_v< MemoryResource >)
Definition: buffer.hpp:197
LEXY_EMPTY_MEMBER
#define LEXY_EMPTY_MEMBER
Definition: config.hpp:170
LEXY_DECLVAL
#define LEXY_DECLVAL(...)
Definition: config.hpp:24
lexyd::eof
constexpr auto eof
Matches EOF.
Definition: eof.hpp:72
lexy::_make_buffer< utf8_char_encoding, encoding_endianness::bom >::operator()
auto operator()(const void *_memory, std::size_t size, MemoryResource *resource=_detail::get_memory_resource< MemoryResource >()) const
Definition: buffer.hpp:358
lexy::input_reader
decltype(LEXY_DECLVAL(Input).reader()) input_reader
Definition: input/base.hpp:92
memory_resource.hpp
error.hpp


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Jun 28 2024 02:20:07