2017-10-21 00:32:42 +02:00
|
|
|
namespace ReflectiveRapidJSON {
|
2017-11-02 23:35:56 +01:00
|
|
|
namespace JsonReflector {
|
2017-10-24 01:00:40 +02:00
|
|
|
|
2017-10-25 16:47:14 +02:00
|
|
|
// define code for (de)serializing TestNamespace1::Person objects
|
2017-10-24 01:00:40 +02:00
|
|
|
template <> inline void push<::TestNamespace1::Person>(const ::TestNamespace1::Person &reflectable, ::RAPIDJSON_NAMESPACE::Value::Object &value, ::RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
|
2017-10-21 00:32:42 +02:00
|
|
|
{
|
2017-10-28 15:50:16 +02:00
|
|
|
// push base classes
|
|
|
|
// push members
|
2017-10-21 00:32:42 +02:00
|
|
|
push(reflectable.age, "age", value, allocator);
|
|
|
|
push(reflectable.alive, "alive", value, allocator);
|
|
|
|
}
|
2017-10-28 16:23:39 +02:00
|
|
|
template <> inline void pull<::TestNamespace1::Person>(::TestNamespace1::Person &reflectable, const ::RAPIDJSON_NAMESPACE::GenericValue<::RAPIDJSON_NAMESPACE::UTF8<char>>::ConstObject &value, JsonDeserializationErrors *errors)
|
2017-10-21 00:32:42 +02:00
|
|
|
{
|
2017-10-28 15:50:16 +02:00
|
|
|
// pull base classes
|
|
|
|
// set error context for current record
|
|
|
|
const char *previousRecord;
|
|
|
|
if (errors) {
|
|
|
|
previousRecord = errors->currentRecord;
|
|
|
|
errors->currentRecord = "TestNamespace1::Person";
|
|
|
|
}
|
|
|
|
// pull members
|
|
|
|
pull(reflectable.age, "age", value, errors);
|
|
|
|
pull(reflectable.alive, "alive", value, errors);
|
|
|
|
// restore error context for previous record
|
|
|
|
if (errors) {
|
|
|
|
errors->currentRecord = previousRecord;
|
|
|
|
}
|
2017-10-21 00:32:42 +02:00
|
|
|
}
|
|
|
|
|
2017-11-02 23:35:56 +01:00
|
|
|
} // namespace JsonReflector
|
2017-10-21 00:32:42 +02:00
|
|
|
} // namespace ReflectiveRapidJSON
|