|
JSON Voorhees
Killer JSON for C++
|
Serialization components are responsible for conversion between a C++ type and a JSON value.
More...
Classes | |
| class | jsonv::reader |
| A reader instance reads from some form of JSON source (probably a string) and converts it into a JSON ast_node sequence. More... | |
| class | jsonv::duplicate_type_error |
| Exception thrown if an insertion of an extractor or serializer into a formats is attempted, but there is already an extractor or serializer for that type. More... | |
| class | jsonv::extraction_error |
Exception thrown if there is any problem running extract. More... | |
| class | jsonv::no_extractor |
Thrown when formats::extract does not have an extractor for the provided type. More... | |
| class | jsonv::no_serializer |
Thrown when formats::to_json does not have a serializer for the provided type. More... | |
| class | jsonv::extract_options |
Configuration for various extraction options. This becomes part of the extraction_context. More... | |
| class | jsonv::extractor |
An extractor holds the method for converting JSON source into an arbitrary C++ type. More... | |
| class | jsonv::serializer |
A serializer holds the method for converting an arbitrary C++ type into a value. More... | |
| class | jsonv::adapter |
An adapter is both an extractor and a serializer. More... | |
| class | jsonv::formats |
Simply put, this class is a collection of extractor and serializer instances. More... | |
| class | jsonv::context_base |
| Provides extra information to routines used for extraction. More... | |
| class | jsonv::extraction_context |
| class | jsonv::serialization_context |
| class | jsonv::adapter_for< T > |
An adapter for the type T. More... | |
| class | jsonv::container_adapter< TContainer > |
| An adapter for container types. More... | |
| class | jsonv::enum_adapter< TEnum, FEnumComp, FValueComp > |
| An adapter for enumeration types. More... | |
| class | jsonv::extractor_construction< T > |
An extractor for type T that has a constructor that accepts either a jsonv::value or a jsonv::value and extraction_context. More... | |
| class | jsonv::extractor_for< T > |
An extractor for the type T. More... | |
| class | jsonv::function_adapter< T, FExtract, FToJson > |
| class | jsonv::function_extractor< T, FExtract > |
An extractor which calls a function to perform extraction. More... | |
| class | jsonv::function_serializer< T, FToJson > |
| class | jsonv::optional_adapter< TOptional > |
| An adapter for optional-like types. More... | |
| class | jsonv::polymorphic_adapter< TPointer > |
| An adapter which can create polymorphic types. More... | |
| class | jsonv::serializer_for< T > |
| class | jsonv::wrapper_adapter< TWrapper > |
| An adapter for "wrapper" types. More... | |
Typedefs | |
| using | jsonv::demangle_function = std::function< std::string(string_view source)> |
| Type of function used in setting a custom demangler. | |
| template<typename TEnum , typename FEnumComp = std::less<TEnum>> | |
| using | jsonv::enum_adapter_icase = enum_adapter< TEnum, FEnumComp, value_less_icase > |
| An adapter for enumeration types which ignores the case when extracting from JSON. | |
Enumerations | |
| enum class | jsonv::duplicate_type_action : unsigned char { duplicate_type_action::ignore , duplicate_type_action::replace , duplicate_type_action::exception } |
| The action to take when an insertion of an extractor or serializer into a formats is attempted, but there is alredy an extractor or serializer for that type. More... | |
| enum class | jsonv::keyed_subtype_action : unsigned char { keyed_subtype_action::none , keyed_subtype_action::check , keyed_subtype_action::insert } |
What to do when serializing a keyed subtype of a polymorphic_adapter. More... | |
Serialization components are responsible for conversion between a C++ type and a JSON value.
| using jsonv::demangle_function = typedef std::function<std::string (string_view source)> |
Type of function used in setting a custom demangler.
Definition at line 40 of file demangle.hpp.
An adapter for enumeration types which ignores the case when extracting from JSON.
Definition at line 118 of file enum_adapter.hpp.
|
strong |
The action to take when an insertion of an extractor or serializer into a formats is attempted, but there is alredy an extractor or serializer for that type.
| Enumerator | |
|---|---|
| ignore | The existing extractor or serializer should be kept, but no exception should be thrown. |
| replace | The new extractor or serializer should be inserted, and no exception should be thrown. |
| exception | A duplicate_type_error should be thrown. |
Definition at line 42 of file serialization.hpp.
|
strong |
What to do when serializing a keyed subtype of a polymorphic_adapter.
See polymorphic_adapter::add_subtype_keyed.
Definition at line 23 of file polymorphic_adapter.hpp.
| JSONV_PUBLIC std::string jsonv::current_exception_type_name | ( | ) |
Get the demangled type name of the current exception.
This is meant to be called from catch (...) blocks to attempt to get more information about the exception type when it doesn't derive from a known entity.
std::type_info implementation) or if discovery is not known for this platform. | JSONV_PUBLIC std::string jsonv::demangle | ( | string_view | source | ) |
Convert the input source from a mangled type into a human-friendly version.
This is used by formats (and the associated serialization functions) to give more user-friendly names in type errors.
Extract a C++ value from from using jsonv::formats::global().
Definition at line 689 of file serialization.hpp.
Here is the call graph for this function:Extract a C++ value from from using the provided fmts.
Definition at line 681 of file serialization.hpp.
Here is the call graph for this function:| auto jsonv::make_adapter | ( | FExtract | extract, |
| FToJson | to_json_ | ||
| ) | -> function_adapter<decltype(extract(std::declval<const extraction_context&>(), std::declval<const value&>())), FExtract, FToJson > |
Definition at line 80 of file function_adapter.hpp.
| auto jsonv::make_adapter | ( | FExtract | extract, |
| FToJson | to_json_ | ||
| ) | -> function_adapter<decltype(extract(std::declval<const value&>())), FExtract, FToJson > |
Definition at line 94 of file function_adapter.hpp.
| auto jsonv::make_extractor | ( | FExtract | func | ) | -> function_extractor<decltype(func(std::declval<const extraction_context&>(), std::declval<const value&>())), FExtract > |
Definition at line 60 of file function_extractor.hpp.
| auto jsonv::make_extractor | ( | FExtract | func | ) | -> function_extractor<decltype(func(std::declval<const value&>())), FExtract > |
Definition at line 72 of file function_extractor.hpp.
| function_serializer< T, FToJson > jsonv::make_serializer | ( | FToJson | to_json_ | ) |
Definition at line 60 of file function_serializer.hpp.
| JSONV_PUBLIC void jsonv::reset_demangle_function | ( | ) |
Resets the demangle function to the default.
| JSONV_PUBLIC void jsonv::set_demangle_function | ( | demangle_function | func | ) |
Sets the global demangle function.
This controls the behavior of demangle – the provided func will be called by demangle.
Encode a JSON value from from using jsonv::formats::global().
Definition at line 735 of file serialization.hpp.
Here is the call graph for this function: