-
Notifications
You must be signed in to change notification settings - Fork 36
/
test.generated.hxx
105 lines (90 loc) · 3.36 KB
/
test.generated.hxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* this file is generated. do not edit! */
#pragma once
#include "metareflect.hxx"
#if 1
namespace metareflect
{
template<> struct IsSerializable<Point> { static constexpr bool value = true; };
template<> struct HasBeforeSerialize<Point> { static constexpr bool value = false; };
template<> struct HasAfterSerialize<Point> { static constexpr bool value = false; };
template<> struct HasCustomSerialize<Point> { static constexpr bool value = false; };
template<>
detail::ClassStorage<3, 1>::ClassStorage() noexcept
{
/* Field 1 */
static Type type0{sizeof(int), Hash("signed int")};
fields[0].m_type = &type0;
fields[0].m_flags = Field::kFlagsSerialized;
fields[0].m_serializedWidth = 32;
fields[0].m_offset = offsetof(::Point, x);
fields[0].m_qualifier = Qualifier{kCVQualifierNone, kRefQualifierNone, kStorageClassMember};
/* Field 2 */
static Type type1{sizeof(int), Hash("signed int")};
fields[1].m_type = &type1;
fields[1].m_flags = Field::kFlagsSerialized;
fields[1].m_serializedWidth = 32;
fields[1].m_offset = offsetof(::Point, y);
fields[1].m_qualifier = Qualifier{kCVQualifierNone, kRefQualifierNone, kStorageClassMember};
/* Field 3 */
static Type type2{sizeof(int), Hash("signed int")};
fields[2].m_type = &type2;
fields[2].m_flags = Field::kFlagsSerialized;
fields[2].m_serializedWidth = 32;
fields[2].m_offset = offsetof(::Point, z);
fields[2].m_qualifier = Qualifier{kCVQualifierNone, kRefQualifierNone, kStorageClassMember};
/* Function 1 */
static Type functionRetType0{sizeof(unsigned long long), Hash("unsigned long long")};
static FunctionReturn functionRet0;
functionRet0.m_type = &functionRetType0;
functionRet0.m_flags = Field::kFlagsNull;
functionRet0.m_serializedWidth = 0;
functionRet0.m_qualifier = Qualifier{};
static FunctionParameter functionParameters0[1];
static Type functionParameterType00{sizeof(::Point), Hash("::Point")};
functionParameters0[0].m_type = &functionParameterType00;
functionParameters0[0].m_flags = Field::kFlagsNull;
functionParameters0[0].m_serializedWidth = 0;
functionParameters0[0].m_qualifier = Qualifier{kCVQualifierConst, kRefQualifierNone, kStorageClassMember, true};
functions[0].m_returnType = &functionRet0;
functions[0].m_parameters = &functionParameters0[0];
functions[0].m_parametersEnd = &functionParameters0[1];
functions[0].m_flags = Function::kFlagsNull;
}
template<>
Class const *
GetClass<Point>() noexcept
{
static detail::ClassStorage<3, 1> reflected;
static Class cache{
sizeof(::Point),
Hash("::Point"),
nullptr,
reflected.fields,
reflected.fields + reflected.numFields,
reflected.functions,
reflected.functions + reflected.numFunctions};
return &cache;
}
template<>
Type const *
GetType<Point>() noexcept
{
return GetClass<Point>();
}
template<class Serializer>
struct Serialize<Point, Serializer>
{
constexpr bool
operator()(Point &obj, Serializer &serializer) noexcept
{
serializer.SerializeBits(obj.x, 32);
serializer.SerializeBits(obj.y, 32);
serializer.SerializeBits(obj.z, 32);
if constexpr (HasCustomSerialize<Point>::value)
if (!obj.Serialize(serializer))
return false;
return true;
}
};
} /* namespace metareflect */
#endif /* if 0 */