| 123456789101112131415161718192021222324252627282930313233 |
- #pragma once
- #include <optional>
- #include <jvalidate/detail/reference.h>
- #include <jvalidate/forward.h>
- namespace jvalidate {
- template <Adapter A> struct ParserContext {
- using Object = decltype(std::declval<A>().as_object());
- Schema & root;
- A schema;
- std::optional<Object> parent = std::nullopt;
- schema::Version version;
- detail::Reference where = {};
- ConstraintFactory<A> const & factory;
- ParserContext child(A const & child, std::string const & key) const {
- return {root, child, schema.as_object(), version, where / key, factory};
- }
- ParserContext child(A const & child, size_t index) const {
- return {root, child, std::nullopt, version, where / index, factory};
- }
- ParserContext neighbor(std::string const & key) const {
- return {root, (*parent)[key], parent, version, where.parent() / key, factory};
- }
- schema::Node const * node() const;
- schema::Node const * always() const;
- };
- }
|