Reflection for RapidJSON
0.0.17
Reflection for serializing/deserializing with RapidJSON
Toggle main menu visibility
Loading...
Searching...
No Matches
binary
reflector-boosthana.h
Go to the documentation of this file.
1
#ifndef REFLECTIVE_RAPIDJSON_BINARY_REFLECTOR_BOOST_HANA_H
2
#define REFLECTIVE_RAPIDJSON_BINARY_REFLECTOR_BOOST_HANA_H
3
14
15
#include "
./reflector.h
"
16
17
#include <boost/hana/adapt_struct.hpp>
18
#include <boost/hana/at_key.hpp>
19
#include <boost/hana/define_struct.hpp>
20
#include <boost/hana/for_each.hpp>
21
#include <boost/hana/intersection.hpp>
22
#include <boost/hana/keys.hpp>
23
24
namespace
ReflectiveRapidJSON
{
25
namespace
BinaryReflector
{
26
27
template
<
typename
Type, Traits::EnableIf<IsCustomType<Type>> *>
28
BinaryVersion
readCustomType
(
BinaryDeserializer
&deserializer, Type &customType,
BinaryVersion
version)
29
{
30
boost::hana::for_each(boost::hana::keys(customType), [&](
auto
key) { deserializer.
read
(boost::hana::at_key(customType, key), version); });
31
return
0;
32
}
33
34
template
<
typename
Type, Traits::EnableIf<IsCustomType<Type>> *>
35
void
writeCustomType
(
BinarySerializer
&serializer,
const
Type &customType,
BinaryVersion
version)
36
{
37
boost::hana::for_each(boost::hana::keys(customType), [&](
auto
key) { serializer.
write
(boost::hana::at_key(customType, key), version); });
38
}
39
40
}
// namespace BinaryReflector
41
}
// namespace ReflectiveRapidJSON
42
43
#endif
// REFLECTIVE_RAPIDJSON_BINARY_REFLECTOR_BOOST_HANA_H
reflector.h
Contains BinaryReader and BinaryWriter supporting binary (de)serialization of primitive and custom ty...
ReflectiveRapidJSON::BinaryReflector::BinaryDeserializer
The BinaryDeserializer class can read various data types, including custom ones, from an std::istream...
Definition
reflector.h:73
ReflectiveRapidJSON::BinaryReflector::BinaryDeserializer::read
void read(Type &pair)
Definition
reflector.h:126
ReflectiveRapidJSON::BinaryReflector::BinarySerializer
The BinarySerializer class can write various data types, including custom ones, to an std::ostream.
Definition
reflector.h:100
ReflectiveRapidJSON::BinaryReflector::BinarySerializer::write
void write(const Type &pair)
Definition
reflector.h:257
ReflectiveRapidJSON::BinaryReflector
The BinaryReflector namespace contains BinaryReader and BinaryWriter for automatic binary (de)seriali...
Definition
reflector.h:44
ReflectiveRapidJSON::BinaryReflector::readCustomType
BinaryVersion readCustomType(BinaryDeserializer &deserializer, Type &customType, BinaryVersion version=0)
Reads customType via deserializer.
Definition
reflector-boosthana.h:28
ReflectiveRapidJSON::BinaryReflector::writeCustomType
void writeCustomType(BinarySerializer &serializer, const Type &customType, BinaryVersion version=0)
Writes customType via serializer.
Definition
reflector-boosthana.h:35
ReflectiveRapidJSON
Definition
traits.h:13
ReflectiveRapidJSON::BinaryVersion
std::uint64_t BinaryVersion
Definition
reflector.h:38
Generated on
for Reflection for RapidJSON by
1.18.0