Reflection for RapidJSON
0.0.17
Reflection for serializing/deserializing with RapidJSON
Toggle main menu visibility
Loading...
Searching...
No Matches
tests
morestructs.h
Go to the documentation of this file.
1
#ifndef REFLECTIVE_RAPIDJSON_TESTS_MORE_STRUCTS_H
2
#define REFLECTIVE_RAPIDJSON_TESTS_MORE_STRUCTS_H
3
4
#define REFLECTIVE_RAPIDJSON_SHORT_MACROS
5
6
#include "../../lib/binary/serializable.h"
7
#include "../../lib/json/serializable.h"
8
#include "../../lib/versioning.h"
9
10
using namespace
std;
11
using namespace
ReflectiveRapidJSON
;
12
22
struct
IncludedStruct
:
public
JsonSerializable<IncludedStruct>,
public
BinarySerializable<IncludedStruct> {
23
int
someInt
= 0;
24
};
25
30
struct
ConstStruct
:
public
JsonSerializable<ConstStruct>,
public
BinarySerializable<IncludedStruct> {
31
int
modifiableInt
= 23;
32
const
int
constInt
= 42;
33
};
34
38
struct
PointerTarget
:
public
BinarySerializable<PointerTarget> {
39
PointerTarget
()
40
:
n
(0xAAAAAAAA)
41
,
dummy1
(0x1111111111111111)
42
,
dummy2
(0x1111111111111111)
43
,
dummy3
(0x1111111111111111)
44
{
45
}
46
47
PointerTarget
(uint32_t
n
)
48
:
n
(
n
)
49
,
dummy1
(0x1111111111111111)
50
,
dummy2
(0x1111111111111111)
51
,
dummy3
(0x1111111111111111)
52
{
53
}
54
55
uint32_t
n
;
56
uint64_t
dummy1
;
57
uint64_t
dummy2
;
58
uint64_t
dummy3
;
59
};
60
64
struct
PointerStruct
:
public
BinarySerializable<PointerStruct> {
65
std::shared_ptr<PointerTarget>
s1
;
66
std::unique_ptr<PointerTarget>
u2
;
67
std::unique_ptr<PointerTarget>
u3
;
68
std::shared_ptr<PointerTarget>
s2
;
69
std::unique_ptr<PointerTarget>
u1
;
70
std::shared_ptr<PointerTarget>
s3
;
71
};
72
76
namespace
SomeNamespace
{
77
81
// clang-format off
82
struct
VersionedStruct
:
public
BinarySerializable<VersionedStruct, 3> {
83
std::uint32_t
a
,
b
;
84
85
until_version(2):
86
std::uint32_t c, d;
87
88
as_of_version(3):
89
std::uint32_t e, f;
90
91
as_of_version(4):
92
std::uint32_t g;
93
};
94
// clang-format on
95
96
}
// namespace SomeNamespace
97
98
#endif
// REFLECTIVE_RAPIDJSON_TESTS_MORE_STRUCTS_H
ReflectiveRapidJSON
Definition
codegenerator.h:15
SomeNamespace
All of this is supposed to work if classes are within a namespace so let's use a namespace here.
Definition
morestructs.h:76
ConstStruct
The ConstStruct struct is used to test handling of const members.
Definition
morestructs.h:30
ConstStruct::constInt
const int constInt
Definition
morestructs.h:32
ConstStruct::modifiableInt
int modifiableInt
Definition
morestructs.h:31
IncludedStruct
The IncludedStruct struct is used to test whether only code for directly included structs is generate...
Definition
morestructs.h:22
IncludedStruct::someInt
int someInt
Definition
morestructs.h:23
PointerStruct
The PointerStruct struct is used to test the behavior of the binary (de)serialization with smart poin...
Definition
morestructs.h:64
PointerStruct::s2
std::shared_ptr< PointerTarget > s2
Definition
morestructs.h:68
PointerStruct::u3
std::unique_ptr< PointerTarget > u3
Definition
morestructs.h:67
PointerStruct::u2
std::unique_ptr< PointerTarget > u2
Definition
morestructs.h:66
PointerStruct::s3
std::shared_ptr< PointerTarget > s3
Definition
morestructs.h:70
PointerStruct::s1
std::shared_ptr< PointerTarget > s1
Definition
morestructs.h:65
PointerStruct::u1
std::unique_ptr< PointerTarget > u1
Definition
morestructs.h:69
PointerTarget::dummy2
uint64_t dummy2
Definition
morestructs.h:57
PointerTarget::dummy3
uint64_t dummy3
Definition
morestructs.h:58
PointerTarget::dummy1
uint64_t dummy1
Definition
morestructs.h:56
PointerTarget::PointerTarget
PointerTarget(uint32_t n)
Definition
morestructs.h:47
PointerTarget::PointerTarget
PointerTarget()
Definition
morestructs.h:39
PointerTarget::n
uint32_t n
Definition
morestructs.h:55
SomeNamespace::VersionedStruct
The PointerStruct struct is used to test the behavior of the binary (de)serialization with smart poin...
Definition
morestructs.h:82
SomeNamespace::VersionedStruct::a
std::uint32_t a
Definition
morestructs.h:83
SomeNamespace::VersionedStruct::b
std::uint32_t b
Definition
morestructs.h:83
Generated on
for Reflection for RapidJSON by
1.18.0