Reflection for RapidJSON  0.0.15
Reflection for serializing/deserializing with RapidJSON
reflector-chronoutilities.h
Go to the documentation of this file.
1 #ifndef REFLECTIVE_RAPIDJSON_BINARY_REFLECTOR_CHRONO_UTILITIES_H
2 #define REFLECTIVE_RAPIDJSON_BINARY_REFLECTOR_CHRONO_UTILITIES_H
3 
11 #include "./reflector.h"
12 
13 #include <c++utilities/chrono/datetime.h>
14 #include <c++utilities/chrono/timespan.h>
15 
16 namespace ReflectiveRapidJSON {
17 namespace BinaryReflector {
18 
19 template <> inline void readCustomType<CppUtilities::DateTime>(BinaryDeserializer &deserializer, CppUtilities::DateTime &dateTime)
20 {
21  deserializer.read(dateTime.ticks());
22 }
23 
24 template <> inline void writeCustomType<CppUtilities::DateTime>(BinarySerializer &serializer, const CppUtilities::DateTime &dateTime)
25 {
26  serializer.write(dateTime.totalTicks());
27 }
28 
29 template <> inline void readCustomType<CppUtilities::TimeSpan>(BinaryDeserializer &deserializer, CppUtilities::TimeSpan &timeSpan)
30 {
31  deserializer.read(timeSpan.ticks());
32 }
33 
34 template <> inline void writeCustomType<CppUtilities::TimeSpan>(BinarySerializer &serializer, const CppUtilities::TimeSpan &timeSpan)
35 {
36  serializer.write(timeSpan.totalTicks());
37 }
38 
39 } // namespace BinaryReflector
40 } // namespace ReflectiveRapidJSON
41 
42 #endif // REFLECTIVE_RAPIDJSON_BINARY_REFLECTOR_CHRONO_UTILITIES_H
reflector.h
Contains BinaryReader and BinaryWriter supporting binary (de)serialization of primitive and custom ty...
ReflectiveRapidJSON::BinaryReflector::BinarySerializer
Definition: reflector.h:80
ReflectiveRapidJSON::BinaryReflector::BinarySerializer::write
void write(const Type &pair)
Definition: reflector.h:220
ReflectiveRapidJSON::BinaryReflector::BinaryDeserializer::read
void read(Type &pair)
Definition: reflector.h:104
ReflectiveRapidJSON
Definition: traits.h:13
ReflectiveRapidJSON::BinaryReflector::BinaryDeserializer
Definition: reflector.h:56