20#include <initializer_list>
35class reader_lookahead;
136 explicit reader(std::string_view source);
175 void validate() const;
184 bool owns_source() const noexcept;
222 template <typename TAstNode>
229 if (
auto matched = expect(TAstNode::type()); !matched)
230 return std::unexpected(matched.error());
232 return current().as<TAstNode>();
274 const
path& current_path() const;
298 bool next_token() noexcept;
370 bool next_structure() noexcept;
401 bool next_value() noexcept;
430 class impl_parse_index;
431 class impl_parse_index_owning;
433 class impl_value_owning;
435 template <typename TImpl, typename... TArgs>
436 explicit
reader(
std::in_place_type_t<TImpl>, TArgs&&...);
438 explicit
reader(
std::unique_ptr<impl> impl) noexcept;
444 friend class detail::reader_lookahead;
447 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(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::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.