Skip to content

Commit d742c19

Browse files
committed
Running the CI test locally
1 parent 7961a4f commit d742c19

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

single_include/nlohmann/json.hpp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,19 +2491,31 @@ JSON_HEDLEY_DIAGNOSTIC_POP
24912491
@def NLOHMANN_DEFINE_TYPE_INTRUSIVE_IMPL
24922492
@since version 3.9.2
24932493
*/
2494-
#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_IMPL(BasicJsonType, Type, ...) \
2495-
friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2496-
friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
2494+
#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_IMPL(BasicJsonType, Type, ...) \
2495+
friend void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) \
2496+
{ \
2497+
NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) \
2498+
} \
2499+
friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) \
2500+
{ \
2501+
NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) \
2502+
}
24972503

24982504
/*!
24992505
@brief macro to briefly define non-intrusive serialization of a given type to/from JSON
25002506
@note you can define your own specialized macroses like NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
25012507
@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_IMPL
25022508
@since version 3.9.2
25032509
*/
2504-
#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_IMPL(BasicJsonType, Type, ...) \
2505-
inline void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \
2506-
inline void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) }
2510+
#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_IMPL(BasicJsonType, Type, ...) \
2511+
inline void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) \
2512+
{ \
2513+
NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) \
2514+
} \
2515+
inline void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) \
2516+
{ \
2517+
NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) \
2518+
}
25072519

25082520
/*!
25092521
@brief macro to briefly define intrusive serialization of given type to/from nlohmann::json
@@ -2536,7 +2548,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP
25362548
friend void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) \
25372549
{ \
25382550
NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) \
2539-
} \
2551+
}
25402552

25412553
/*!
25422554
@brief macro to briefly define non-intrusive serialization of a given type to/from any basic_json object

test/src/unit-udt_macro.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ namespace persons
3939
#define START_CLASS_PERSON(ClassName, Visibility) \
4040
class ClassName \
4141
{ \
42-
Visibility : std::string name{}; \
42+
Visibility : std::string name{}; \
4343
int age = 0; \
4444
json metadata = nullptr; \
45-
\
45+
\
4646
public: \
4747
bool operator==(const ClassName& rhs) const \
4848
{ \
4949
return name == rhs.name && age == rhs.age && metadata == rhs.metadata; \
5050
} \
5151
ClassName() = default; \
5252
ClassName(std::string name_, int age_, json metadata_) \
53-
: name(std::move(name_)) \
54-
, age(age_) \
55-
, metadata(std::move(metadata_)) \
53+
: name(std::move(name_)) \
54+
, age(age_) \
55+
, metadata(std::move(metadata_)) \
5656
{}
5757

5858
#define START_CLASS_ALPHABET(ClassName, Visibility) \
@@ -88,7 +88,7 @@ namespace persons
8888
y == other.y && \
8989
z == other.z; \
9090
} \
91-
Visibility : int a = 0; \
91+
Visibility : int a = 0; \
9292
int b = 0; \
9393
int c = 0; \
9494
int d = 0; \
@@ -116,31 +116,31 @@ namespace persons
116116
int z = 0;
117117

118118
START_CLASS_PERSON(person_with_private_data, private)
119-
NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_with_private_data, age, name, metadata)
119+
NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_with_private_data, age, name, metadata)
120120
};
121121

122122
START_CLASS_PERSON(person_without_private_data_1, public)
123-
NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_without_private_data_1, age, name, metadata)
123+
NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_without_private_data_1, age, name, metadata)
124124
};
125125

126126
START_CLASS_PERSON(person_without_private_data_2, public)
127127
};
128128
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person_without_private_data_2, age, name, metadata)
129129

130130
START_CLASS_PERSON(person_t_with_private_data, private)
131-
NLOHMANN_DEFINE_TYPE_INTRUSIVE_T(person_t_with_private_data, age, name, metadata)
131+
NLOHMANN_DEFINE_TYPE_INTRUSIVE_T(person_t_with_private_data, age, name, metadata)
132132
};
133133

134134
START_CLASS_PERSON(person_t_without_private_data_1, public)
135-
NLOHMANN_DEFINE_TYPE_INTRUSIVE_T(person_t_without_private_data_1, age, name, metadata)
135+
NLOHMANN_DEFINE_TYPE_INTRUSIVE_T(person_t_without_private_data_1, age, name, metadata)
136136
};
137137

138138
START_CLASS_PERSON(person_t_without_private_data_2, public)
139139
};
140140
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_T(person_t_without_private_data_2, age, name, metadata)
141141

142142
START_CLASS_ALPHABET(person_with_private_alphabet, private)
143-
NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_with_private_alphabet, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
143+
NLOHMANN_DEFINE_TYPE_INTRUSIVE(person_with_private_alphabet, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
144144
};
145145

146146
START_CLASS_ALPHABET(person_with_public_alphabet, public)
@@ -149,7 +149,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person_with_public_alphabet, a, b, c, d, e, f
149149

150150

151151
START_CLASS_ALPHABET(person_t_with_private_alphabet, private)
152-
NLOHMANN_DEFINE_TYPE_INTRUSIVE_T(person_t_with_private_alphabet, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
152+
NLOHMANN_DEFINE_TYPE_INTRUSIVE_T(person_t_with_private_alphabet, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
153153
};
154154

155155
START_CLASS_ALPHABET(person_t_with_public_alphabet, public)

0 commit comments

Comments
 (0)