41 virtual const std::type_info&
get_type() const noexcept
override
48 virtual std::expected<void, ast_node_type>
55 new(into) T(std::move(created).value());
62 context.note_value_consumed(from);
69 return std::unexpected(created.error());
112 virtual std::expected<T, ast_node_type>
118 detail::borrowed_subtree subtree(
context, from);
134 context.note_value_consumed(from);
Copyright (c) 2015-2020 by Travis Gockel.
An adapter for the type T.
virtual std::expected< T, ast_node_type > create(deserialization_context &context, reader &from) const =0
Create an instance of T by reading from.
virtual const std::type_info & get_type() const noexcept override
virtual void serialize(const serialization_context &context, const T &from, writer &to) const =0
Write from into to.
virtual void serialize(const serialization_context &context, const void *from, writer &to) const override
virtual std::expected< void, ast_node_type > deserialize(deserialization_context &context, reader &from, void *into) const override
An adapter is both a deserializer and a serializer.
Provides extra information to routines used for deserialization and serialization.
Provides extra information to routines used for deserialization, collects the problems they encounter...
A reader instance reads from some form of JSON source (probably a string) and converts it into a JSON...
Provides extra information to routines used for serialization: the formats to find other serializers ...
A base for adapters written against the older value -based interface, in both directions.
virtual value to_json(const serialization_context &context, const T &from) const =0
Convert from into a value.
virtual std::expected< T, ast_node_type > create(deserialization_context &context, reader &from) const final override
Create an instance of T by reading from.
virtual void serialize(const serialization_context &context, const T &from, writer &to) const final override
Write from into to.
virtual T create(deserialization_context &context, const value &from) const =0
Create an instance of T from the materialised from.
Represents a single JSON value, which can be any one of a potential kind, each behaving slightly diff...
A writer instance writes a JSON ast_node sequence to some form of sink: an encoder,...
Copyright (c) 2014-2020 by Travis Gockel.
#define JSONV_NODISCARD
Warn if the caller discards the result of this function.
Serialization of C++ types into a JSON token stream.
Copyright (c) 2012-2020 by Travis Gockel.