20#include <initializer_list>
36class reader_lookahead;
138 explicit reader(std::string_view source);
194 void validate() const;
203 bool owns_source() const noexcept;
241 template <typename TAstNode>
248 if (
auto matched = expect(TAstNode::type()); !matched)
249 return std::unexpected(matched.error());
251 return current().as<TAstNode>();
293 const
path& current_path() const;
317 bool next_token() noexcept;
389 bool next_structure() noexcept;
420 bool next_value() noexcept;
449 class impl_parse_index;
450 class impl_parse_index_owning;
452 class impl_value_owning;
454 template <typename TImpl, typename... TArgs>
455 explicit
reader(
std::in_place_type_t<TImpl>, TArgs&&...);
457 explicit
reader(
std::unique_ptr<impl> impl) noexcept;
463 friend class detail::reader_lookahead;
466 std::unique_ptr<impl> _impl;
Utilities for directly dealing with a JSON AST.
Represents an entry in a JSON AST.
Represents the index of a parsed AST.
Configuration for various parsing options.
Represents an exact path in some JSON structure.
A reader instance reads from some form of JSON source (probably a string) and converts it into a JSON...
static reader from_value(const value &value)
Create a reader which reads from an in-memory value.
reader(std::string_view source, const parse_options &parse_options)
Create a reader which reads from JSON source.
reader(std::string &&source, const parse_options &parse_options)
Create a reader which reads from JSON source.
reader(std::istream &source)
Create a reader which reads JSON from what is left of the source stream, as parse(std::istream&) does...
reader(const char *source, const parse_options &parse_options)
Create a reader which reads from JSON source.
reader(parse_index index)
Create a reader which reads from the given index.
reader(std::string &&source)
Create a reader which reads from JSON source.
reader(std::istream &source, const parse_options &parse_options)
Create a reader which reads JSON from what is left of the source stream, as parse(std::istream&) does...
reader(std::string_view source)
Create a reader which reads from JSON source.
static reader from_value(value &&value)
Create a reader which reads from an in-memory value.
reader(const char *source)
Create a reader which reads from JSON source.
optional< const value & > current_value() const noexcept
Get the in-memory value this reader is positioned on, if it has one to lend.
reader(reader &&) noexcept
Moving a reader transfers its implementation, leaving the source moved-from: good is false and the ac...
Represents a single JSON value, which can be any one of a potential kind, each behaving slightly diff...
Copyright (c) 2014-2020 by Travis Gockel.
#define JSONV_NODISCARD
Warn if the caller discards the result of this function.
#define JSONV_PUBLIC
This function or class is part of the public API for JSON Voorhees.
ast_node_type
Marker type for an encountered token type.
Pulls in an implementation of optional.
typename detail::optional_type< T >::type optional
Represents a value that may or may not be present.