JSON Voorhees
Killer JSON for C++
Loading...
Searching...
No Matches
jsonv::value_serializer_for< T > Class Template Referenceabstract

A base for serializers written against the older value -based interface. More...

#include <jsonv/serialization/serializer_for.hpp>

+ Inheritance diagram for jsonv::value_serializer_for< T >:
+ Collaboration diagram for jsonv::value_serializer_for< T >:

Protected Member Functions

virtual void serialize (const serialization_context &context, const T &from, writer &to) const final override
 Write from into to.
 
virtual value to_json (const serialization_context &context, const T &from) const =0
 Convert from into a value.
 

Additional Inherited Members

- Public Member Functions inherited from jsonv::serializer_for< T >
virtual const std::type_info & get_type () const noexcept override
 
virtual void serialize (const serialization_context &context, const void *from, writer &to) const override
 

Detailed Description

template<typename T>
class jsonv::value_serializer_for< T >

A base for serializers written against the older value -based interface.

The value the subclass's to_json builds is written whole into the writer with writer::write. This costs the tree the writer exists to avoid – so it is a stepping stone for ports, not a destination. New serializers should derive from serializer_for and write into the writer.

Definition at line 61 of file serializer_for.hpp.

Member Function Documentation

◆ serialize()

template<typename T >
virtual void jsonv::value_serializer_for< T >::serialize ( const serialization_context &  context,
const T &  from,
writer &  to 
) const
inlinefinaloverrideprotectedvirtual

Write from into to.

See also
serializer::serialize

Implements jsonv::serializer_for< T >.

Definition at line 65 of file serializer_for.hpp.

+ Here is the call graph for this function:

◆ to_json()

template<typename T >
virtual value jsonv::value_serializer_for< T >::to_json ( const serialization_context &  context,
const T &  from 
) const
protectedpure virtual

Convert from into a value.

Parameters
contextExtra information to help you encode sub-objects for your type, such as the ability to find other formats.
fromThe value to convert.

The documentation for this class was generated from the following file: