Reflection for RapidJSON 0.0.16
Reflection for serializing/deserializing with RapidJSON
Loading...
Searching...
No Matches
reflector-boosthana.h File Reference

Contains generic functions relying on Boost.Hana which can replace the code which would otherwise had to be generated. More...

#include "./reflector.h"
#include <boost/hana/adapt_struct.hpp>
#include <boost/hana/at_key.hpp>
#include <boost/hana/define_struct.hpp>
#include <boost/hana/for_each.hpp>
#include <boost/hana/intersection.hpp>
#include <boost/hana/keys.hpp>
Include dependency graph for reflector-boosthana.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  ReflectiveRapidJSON
 
namespace  ReflectiveRapidJSON::JsonReflector
 The JsonReflector namespace contains helper functions to ease the use of RapidJSON for automatic (de)serialization.
 

Functions

template<typename Type , Traits::DisableIf< IsBuiltInType< Type > > * = nullptr>
void ReflectiveRapidJSON::JsonReflector::push (const Type &reflectable, RAPIDJSON_NAMESPACE::Value::Object &value, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
 Pushes the reflectable which has a custom type to the specified object.
 
template<typename Type , Traits::DisableIf< IsBuiltInType< Type > > * = nullptr>
void ReflectiveRapidJSON::JsonReflector::pull (Type &reflectable, const RAPIDJSON_NAMESPACE::GenericValue< RAPIDJSON_NAMESPACE::UTF8< char > >::ConstObject &value, JsonDeserializationErrors *errors)
 Pulls the reflectable which has a custom type from the specified object.
 

Detailed Description

Contains generic functions relying on Boost.Hana which can replace the code which would otherwise had to be generated.

Remarks
These functions use boost::hana::keys() and boost::hana::at_key() rather than the "plain" for-loop shown in the introspection examples of the Boost.Hana documentation. The reason is that the "plain" for-loop involves making copies. This costs performance and - more importantly - prevents modifying the actual object.

Definition in file reflector-boosthana.h.