Reflection for RapidJSON 0.0.16
Reflection for serializing/deserializing with RapidJSON
Loading...
Searching...
No Matches
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
16namespace ReflectiveRapidJSON {
17namespace BinaryReflector {
18
19template <>
20inline BinaryVersion readCustomType<CppUtilities::DateTime>(BinaryDeserializer &deserializer, CppUtilities::DateTime &dateTime, BinaryVersion version)
21{
22 CPP_UTILITIES_UNUSED(version)
23 deserializer.read(dateTime.ticks());
24 return 0;
25}
26
27template <>
28inline void writeCustomType<CppUtilities::DateTime>(BinarySerializer &serializer, const CppUtilities::DateTime &dateTime, BinaryVersion version)
29{
30 CPP_UTILITIES_UNUSED(version)
31 serializer.write(dateTime.totalTicks());
32}
33
34template <>
35inline BinaryVersion readCustomType<CppUtilities::TimeSpan>(BinaryDeserializer &deserializer, CppUtilities::TimeSpan &timeSpan, BinaryVersion version)
36{
37 CPP_UTILITIES_UNUSED(version)
38 deserializer.read(timeSpan.ticks());
39 return 0;
40}
41
42template <>
43inline void writeCustomType<CppUtilities::TimeSpan>(BinarySerializer &serializer, const CppUtilities::TimeSpan &timeSpan, BinaryVersion version)
44{
45 CPP_UTILITIES_UNUSED(version)
46 serializer.write(timeSpan.totalTicks());
47}
48
49} // namespace BinaryReflector
50} // namespace ReflectiveRapidJSON
51
52#endif // REFLECTIVE_RAPIDJSON_BINARY_REFLECTOR_CHRONO_UTILITIES_H
Contains BinaryReader and BinaryWriter supporting binary (de)serialization of primitive and custom ty...
The BinaryDeserializer class can read various data types, including custom ones, from an std::istream...
Definition reflector.h:73
The BinarySerializer class can write various data types, including custom ones, to an std::ostream.
Definition reflector.h:100
BinaryVersion readCustomType< CppUtilities::TimeSpan >(BinaryDeserializer &deserializer, CppUtilities::TimeSpan &timeSpan, BinaryVersion version)
void writeCustomType< CppUtilities::DateTime >(BinarySerializer &serializer, const CppUtilities::DateTime &dateTime, BinaryVersion version)
void writeCustomType< CppUtilities::TimeSpan >(BinarySerializer &serializer, const CppUtilities::TimeSpan &timeSpan, BinaryVersion version)
BinaryVersion readCustomType< CppUtilities::DateTime >(BinaryDeserializer &deserializer, CppUtilities::DateTime &dateTime, BinaryVersion version)
std::uint64_t BinaryVersion
Definition reflector.h:38