1 #ifndef REFLECTIVE_RAPIDJSON_JSON_REFLECTOR_BOOST_HANA_H
2 #define REFLECTIVE_RAPIDJSON_JSON_REFLECTOR_BOOST_HANA_H
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>
25 namespace JsonReflector {
29 template <
typename Type, Traits::DisableIf<IsBuiltInType<Type>> *>
30 void push(
const Type &reflectable, RAPIDJSON_NAMESPACE::Value::Object &value, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
32 boost::hana::for_each(boost::hana::keys(reflectable), [&reflectable, &value, &allocator](
auto key) {
33 push(boost::hana::at_key(reflectable, key), boost::hana::to<char const *>(key), value, allocator);
39 template <
typename Type, Traits::DisableIf<IsBuiltInType<Type>> *>
40 void pull(Type &reflectable,
const RAPIDJSON_NAMESPACE::GenericValue<RAPIDJSON_NAMESPACE::UTF8<char>>::ConstObject &value,
43 boost::hana::for_each(boost::hana::keys(reflectable), [&reflectable, &value, &errors](
auto key) {
44 pull(boost::hana::at_key(reflectable, key), boost::hana::to<char const *>(key), value, errors);
51 #endif // REFLECTIVE_RAPIDJSON_JSON_REFLECTOR_BOOST_HANA_H