diff --git a/README.md b/README.md
index e0bba3dbd1..aa3536e5a6 100644
--- a/README.md
+++ b/README.md
@@ -239,10 +239,10 @@ namespace ns {
JSONCONS_ENUM_TRAITS(ns::hiking_experience, beginner, intermediate, advanced)
// First four members listed are mandatory, confidence and expires are optional
-JSONCONS_N_GETTER_CTOR_TRAITS(ns::hiking_reputon, 4, rater, assertion, rated, rating,
+JSONCONS_N_CTOR_GETTER_TRAITS(ns::hiking_reputon, 4, rater, assertion, rated, rating,
confidence, expires)
// All members are mandatory
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::hiking_reputation, application, reputons)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::hiking_reputation, application, reputons)
int main()
{
@@ -282,13 +282,13 @@ Marilyn C, 0.9
}
```
This example makes use of the convenience macros `JSONCONS_ENUM_TRAITS`
-`JSONCONS_N_GETTER_CTOR_TRAITS`, and `JSONCONS_ALL_GETTER_CTOR_TRAITS` to specialize the
+`JSONCONS_N_CTOR_GETTER_TRAITS`, and `JSONCONS_ALL_CTOR_GETTER_TRAITS` to specialize the
[json_type_traits](doc/ref/json_type_traits.md) for the enum type
`ns::hiking_experience`, the class `ns::hiking_reputon` (with some non-mandatory members), and the class
`ns::hiking_reputation` (with all mandatory members.)
The macro `JSONCONS_ENUM_TRAITS` generates the code from
-the enum identifiers, and the macros `JSONCONS_N_GETTER_CTOR_TRAITS`
-and `JSONCONS_ALL_GETTER_CTOR_TRAITS`
+the enum identifiers, and the macros `JSONCONS_N_CTOR_GETTER_TRAITS`
+and `JSONCONS_ALL_CTOR_GETTER_TRAITS`
generate the code from the get functions and a constructor.
These macro declarations must be placed outside any namespace blocks.
diff --git a/doc/Examples.md b/doc/Examples.md
index f0a48cffaa..873322ab9d 100644
--- a/doc/Examples.md
+++ b/doc/Examples.md
@@ -27,7 +27,7 @@
[Serialize non-mandatory std::optional values using the convenience macros](#G4)
[An example with std::shared_ptr and std::unique_ptr](#G5)
[Serialize a templated class with the `_TPL_` macros](#G6)
-[An example using JSONCONS_ENUM_TRAITS and JSONCONS_ALL_GETTER_CTOR_TRAITS](#G7)
+[An example using JSONCONS_ENUM_TRAITS and JSONCONS_ALL_CTOR_GETTER_TRAITS](#G7)
[Serialize a polymorphic type based on the presence of members](#G8)
[Ensuring type selection is possible](#G9)
[Specialize json_type_traits explicitly](#G10)
@@ -572,7 +572,7 @@ JSONCONS_ENUM_TRAITS(ns::BookCategory,fiction,biography)
JSONCONS_ALL_MEMBER_TRAITS(ns::Book1,category,author,title,price)
JSONCONS_ALL_MEMBER_TRAITS(ns::Book2,category,author,title,price)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::Book3,category,author,title,price)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::Book3,category,author,title,price)
using namespace jsoncons; // for convenience
@@ -778,7 +778,7 @@ JSONCONS_ALL_MEMBER_NAME_TRAITS(ns::Book1,(category,"Category"),(author,"Author"
(title,"Title"),(price,"Price"))
JSONCONS_ALL_MEMBER_NAME_TRAITS(ns::Book2,(category_,"Category"),(author_,"Author"),
(title_,"Title"),(price_,"Price"))
-JSONCONS_ALL_GETTER_CTOR_NAME_TRAITS(ns::Book3,(category,"Category"),(author,"Author"),
+JSONCONS_ALL_CTOR_GETTER_NAME_TRAITS(ns::Book3,(category,"Category"),(author,"Author"),
(title,"Title"),(price,"Price"))
JSONCONS_ALL_GETTER_SETTER_NAME_TRAITS(ns::Book4,(getCategory,setCategory,"Category"),
(getAuthor,setAuthor,"Author"),
@@ -1208,15 +1208,15 @@ int main()
-#### An example using JSONCONS_ENUM_TRAITS and JSONCONS_ALL_GETTER_CTOR_TRAITS
+#### An example using JSONCONS_ENUM_TRAITS and JSONCONS_ALL_CTOR_GETTER_TRAITS
This example makes use of the convenience macros `JSONCONS_ENUM_TRAITS`
-and `JSONCONS_ALL_GETTER_CTOR_TRAITS` to specialize the
+and `JSONCONS_ALL_CTOR_GETTER_TRAITS` to specialize the
[json_type_traits](ref/json_type_traits.md) for the enum type
`ns::hiking_experience` and the classes `ns::hiking_reputon` and
`ns::hiking_reputation`.
The macro `JSONCONS_ENUM_TRAITS` generates the code from
-the enum values, and the macro `JSONCONS_ALL_GETTER_CTOR_TRAITS`
+the enum values, and the macro `JSONCONS_ALL_CTOR_GETTER_TRAITS`
generates the code from the get functions and a constructor.
These macro declarations must be placed outside any namespace blocks.
@@ -1289,8 +1289,8 @@ namespace ns {
// Declare the traits. Specify which data members need to be serialized.
JSONCONS_ENUM_TRAITS(ns::hiking_experience, beginner, intermediate, advanced)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::hiking_reputon, rater, assertion, rated, rating)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::hiking_reputation, application, reputons)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::hiking_reputon, rater, assertion, rated, rating)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::hiking_reputation, application, reputons)
using namespace jsoncons; // for convenience
@@ -1326,7 +1326,7 @@ Output:
#### Serialize a polymorphic type based on the presence of members
-This example uses the convenience macro `JSONCONS_N_GETTER_CTOR_TRAITS`
+This example uses the convenience macro `JSONCONS_N_CTOR_GETTER_TRAITS`
to generate the [json_type_traits](ref/json_type_traits.md) boilerplate for the `HourlyEmployee` and `CommissionedEmployee`
derived classes, and `JSONCONS_POLYMORPHIC_TRAITS` to generate the `json_type_traits` boilerplate
for `std::shared_ptr` and `std::unique_ptr`. The type selection strategy is based
@@ -1427,8 +1427,8 @@ public:
} // ns
-JSONCONS_N_GETTER_CTOR_TRAITS(ns::HourlyEmployee, 3, firstName, lastName, wage, hours)
-JSONCONS_N_GETTER_CTOR_TRAITS(ns::CommissionedEmployee, 4, firstName, lastName, baseSalary, commission, sales)
+JSONCONS_N_CTOR_GETTER_TRAITS(ns::HourlyEmployee, 3, firstName, lastName, wage, hours)
+JSONCONS_N_CTOR_GETTER_TRAITS(ns::CommissionedEmployee, 4, firstName, lastName, baseSalary, commission, sales)
JSONCONS_POLYMORPHIC_TRAITS(ns::Employee, ns::HourlyEmployee, ns::CommissionedEmployee)
int main()
diff --git a/doc/Pages/index.md b/doc/Pages/index.md
index 0c0597ad50..3db013f33b 100644
--- a/doc/Pages/index.md
+++ b/doc/Pages/index.md
@@ -200,10 +200,10 @@ namespace ns {
JSONCONS_ENUM_TRAITS(ns::hiking_experience, beginner, intermediate, advanced)
// First four members listed are mandatory, confidence and expires are optional
-JSONCONS_N_GETTER_CTOR_TRAITS(ns::hiking_reputon, 4, rater, assertion, rated, rating,
+JSONCONS_N_CTOR_GETTER_TRAITS(ns::hiking_reputon, 4, rater, assertion, rated, rating,
confidence, expires)
// All members are mandatory
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::hiking_reputation, application, reputons)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::hiking_reputation, application, reputons)
int main()
{
@@ -243,12 +243,12 @@ Marilyn C, 0.9
}
```
This example makes use of the convenience macros `JSONCONS_ENUM_TRAITS`
-and `JSONCONS_ALL_GETTER_CTOR_TRAITS` to specialize the
+and `JSONCONS_ALL_CTOR_GETTER_TRAITS` to specialize the
[json_type_traits](doc/ref/json_type_traits.md) for the enum type
`ns::hiking_experience` and the classes `ns::hiking_reputon` and
`ns::hiking_reputation`.
The macro `JSONCONS_ENUM_TRAITS` generates the code from
-the enum values, and the macro `JSONCONS_ALL_GETTER_CTOR_TRAITS`
+the enum values, and the macro `JSONCONS_ALL_CTOR_GETTER_TRAITS`
generates the code from the get functions and a constructor.
These macro declarations must be placed outside any namespace blocks.
diff --git a/doc/ref/csv/csv.md b/doc/ref/csv/csv.md
index 0dbdedef21..2fedab271a 100644
--- a/doc/ref/csv/csv.md
+++ b/doc/ref/csv/csv.md
@@ -155,7 +155,7 @@ struct json_type_traits
}
};
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::fixing, index_id, observation_date, rate)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::fixing, index_id, observation_date, rate)
int main()
{
diff --git a/doc/ref/json_type_traits.md b/doc/ref/json_type_traits.md
index 766b781265..d27a19d8a0 100644
--- a/doc/ref/json_type_traits.md
+++ b/doc/ref/json_type_traits.md
@@ -126,35 +126,35 @@ JSONCONS_ENUM_NAME_TRAITS(enum_name,
(identifier0,serialized_name0),
(identifier1,serialized_name1)...) // (10)
-JSONCONS_N_GETTER_CTOR_TRAITS(class_name,num_mandatory,
+JSONCONS_N_CTOR_GETTER_TRAITS(class_name,num_mandatory,
getter_name0,
getter_name1,...) // (11)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(class_name,
+JSONCONS_ALL_CTOR_GETTER_TRAITS(class_name,
getter_name0,getter_name1,...) // (12)
-JSONCONS_TPL_N_GETTER_CTOR_TRAITS(num_template_params,
+JSONCONS_TPL_N_CTOR_GETTER_TRAITS(num_template_params,
class_name,num_mandatory,
getter_name0,getter_name1,...) // (13)
-JSONCONS_TPL_ALL_GETTER_CTOR_TRAITS(num_template_params,
+JSONCONS_TPL_ALL_CTOR_GETTER_TRAITS(num_template_params,
class_name,
getter_name0,getter_name1,...) // (14)
-JSONCONS_N_GETTER_CTOR_NAME_TRAITS(class_name,num_mandatory,
+JSONCONS_N_CTOR_GETTER_NAME_TRAITS(class_name,num_mandatory,
(getter_name0,serialized_name0),
(getter_name1,serialized_name1)...) // (15)
-JSONCONS_ALL_GETTER_CTOR_NAME_TRAITS(class_name,
+JSONCONS_ALL_CTOR_GETTER_NAME_TRAITS(class_name,
(getter_name0,serialized_name0),
(getter_name1,serialized_name1)...) // (16)
-JSONCONS_TPL_N_GETTER_CTOR_NAME_TRAITS(num_template_params,
+JSONCONS_TPL_N_CTOR_GETTER_NAME_TRAITS(num_template_params,
class_name,num_mandatory,
(getter_name0,serialized_name0),
(getter_name1,serialized_name1)...) // (17)
-JSONCONS_TPL_ALL_GETTER_CTOR_NAME_TRAITS(num_template_params,
+JSONCONS_TPL_ALL_CTOR_GETTER_NAME_TRAITS(num_template_params,
class_name,
(getter_name0,serialized_name0),
(getter_name1,serialized_name1)...) // (18)
@@ -310,7 +310,7 @@ All of the `json_type_traits` specializations for type `T` generated by the conv
[Convert from and to std::tuple](#A4)
[Extend json_type_traits to support `boost::gregorian` dates.](#A5)
[Specialize json_type_traits to support a book class.](#A6)
-[Using JSONCONS_ALL_GETTER_CTOR_TRAITS to generate the json_type_traits](#A7)
+[Using JSONCONS_ALL_CTOR_GETTER_TRAITS to generate the json_type_traits](#A7)
[Example with std::shared_ptr, std::unique_ptr and std::optional](#A8)
[Serialize a polymorphic type based on the presence of members](#A9)
[Ensuring type selection is possible](#A10)
@@ -599,9 +599,9 @@ Charles Bukowski, Pulp, 22.48
-#### Using JSONCONS_ALL_GETTER_CTOR_TRAITS to generate the json_type_traits
+#### Using JSONCONS_ALL_CTOR_GETTER_TRAITS to generate the json_type_traits
-`JSONCONS_ALL_GETTER_CTOR_TRAITS` is a macro that can be used to generate the `json_type_traits` boilerplate
+`JSONCONS_ALL_CTOR_GETTER_TRAITS` is a macro that can be used to generate the `json_type_traits` boilerplate
for your own types.
```c++
@@ -675,8 +675,8 @@ using namespace jsoncons; // for convenience
// Declare the traits. Specify which data members need to be serialized.
JSONCONS_ENUM_TRAITS(ns::hiking_experience, beginner, intermediate, advanced)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::hiking_reputon, rater, assertion, rated, rating)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::hiking_reputation, application, reputons)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::hiking_reputon, rater, assertion, rated, rating)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::hiking_reputation, application, reputons)
int main()
{
@@ -799,7 +799,7 @@ Output:
#### Serialize a polymorphic type based on the presence of members
-This example uses the convenience macro `JSONCONS_N_GETTER_CTOR_TRAITS`
+This example uses the convenience macro `JSONCONS_N_CTOR_GETTER_TRAITS`
to generate the `json_type_traits` boilerplate for the `HourlyEmployee` and `CommissionedEmployee`
derived classes, and `JSONCONS_POLYMORPHIC_TRAITS` to generate the `json_type_traits` boilerplate
for `std::shared_ptr` and `std::unique_ptr`. The type selection strategy is based
@@ -900,8 +900,8 @@ public:
} // ns
-JSONCONS_N_GETTER_CTOR_TRAITS(ns::HourlyEmployee, 3, firstName, lastName, wage, hours)
-JSONCONS_N_GETTER_CTOR_TRAITS(ns::CommissionedEmployee, 4, firstName, lastName, baseSalary, commission, sales)
+JSONCONS_N_CTOR_GETTER_TRAITS(ns::HourlyEmployee, 3, firstName, lastName, wage, hours)
+JSONCONS_N_CTOR_GETTER_TRAITS(ns::CommissionedEmployee, 4, firstName, lastName, baseSalary, commission, sales)
JSONCONS_POLYMORPHIC_TRAITS(ns::Employee, ns::HourlyEmployee, ns::CommissionedEmployee)
int main()
diff --git a/doc/ref/ubjson/ubjson.md b/doc/ref/ubjson/ubjson.md
index 588b8f5593..d5d220308a 100644
--- a/doc/ref/ubjson/ubjson.md
+++ b/doc/ref/ubjson/ubjson.md
@@ -390,8 +390,8 @@ namespace ns {
// Declare the traits. Specify which data members need to be serialized.
JSONCONS_ENUM_TRAITS(ns::hiking_experience, beginner, intermediate, advanced)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::hiking_reputon, rater, assertion, rated, rating)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::hiking_reputation, application, reputons)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::hiking_reputon, rater, assertion, rated, rating)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::hiking_reputation, application, reputons)
int main()
{
diff --git a/examples/src/json_traits_macros_examples.cpp b/examples/src/json_traits_macros_examples.cpp
index 54469187d1..ec3ce34c44 100644
--- a/examples/src/json_traits_macros_examples.cpp
+++ b/examples/src/json_traits_macros_examples.cpp
@@ -220,10 +220,10 @@ JSONCONS_ENUM_TRAITS(ns::BookCategory,fiction,biography)
JSONCONS_ALL_MEMBER_TRAITS(ns::Book1,category,author,title,price)
JSONCONS_ALL_MEMBER_TRAITS(ns::Book2,category,author,title,price)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::Book3,category,author,title,price)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::Book3,category,author,title,price)
-JSONCONS_N_GETTER_CTOR_TRAITS(ns::HourlyEmployee, 3, firstName, lastName, wage, hours)
-JSONCONS_N_GETTER_CTOR_TRAITS(ns::CommissionedEmployee, 4, firstName, lastName, baseSalary, commission, sales)
+JSONCONS_N_CTOR_GETTER_TRAITS(ns::HourlyEmployee, 3, firstName, lastName, wage, hours)
+JSONCONS_N_CTOR_GETTER_TRAITS(ns::CommissionedEmployee, 4, firstName, lastName, baseSalary, commission, sales)
JSONCONS_POLYMORPHIC_TRAITS(ns::Employee, ns::HourlyEmployee, ns::CommissionedEmployee)
JSONCONS_N_MEMBER_TRAITS(ns::Bar,1,bar)
diff --git a/examples/src/json_traits_macros_named_examples.cpp b/examples/src/json_traits_macros_named_examples.cpp
index 74b7e31db4..b5841c7579 100644
--- a/examples/src/json_traits_macros_named_examples.cpp
+++ b/examples/src/json_traits_macros_named_examples.cpp
@@ -108,7 +108,7 @@ JSONCONS_ALL_MEMBER_NAME_TRAITS(ns::Book1,(category,"Category"),(author,"Author"
(title,"Title"),(price,"Price"))
JSONCONS_ALL_MEMBER_NAME_TRAITS(ns::Book2,(category_,"Category"),(author_,"Author"),
(title_,"Title"),(price_,"Price"))
-JSONCONS_ALL_GETTER_CTOR_NAME_TRAITS(ns::Book3,(category,"Category"),(author,"Author"),
+JSONCONS_ALL_CTOR_GETTER_NAME_TRAITS(ns::Book3,(category,"Category"),(author,"Author"),
(title,"Title"),(price,"Price"))
JSONCONS_ALL_GETTER_SETTER_NAME_TRAITS(ns::Book4,(getCategory,setCategory,"Category"),
(getAuthor,setAuthor,"Author"),
diff --git a/examples/src/sample_types.hpp b/examples/src/sample_types.hpp
index 5c04098746..e23e6ee2cd 100644
--- a/examples/src/sample_types.hpp
+++ b/examples/src/sample_types.hpp
@@ -198,12 +198,12 @@ JSONCONS_ALL_MEMBER_NAME_TRAITS(ns::bond, (principal,"notional"), (maturity,"mat
JSONCONS_ENUM_TRAITS(ns::hiking_experience, beginner, intermediate, advanced)
// First four members listed are mandatory, confidence and expires are optional
-JSONCONS_N_GETTER_CTOR_TRAITS(ns::hiking_reputon, 4, rater, assertion, rated, rating,
+JSONCONS_N_CTOR_GETTER_TRAITS(ns::hiking_reputon, 4, rater, assertion, rated, rating,
confidence, expires)
// All members are mandatory
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::hiking_reputation, application, reputons)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::hiking_reputation, application, reputons)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::fixing, index_id, observation_date, rate)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::fixing, index_id, observation_date, rate)
JSONCONS_ALL_MEMBER_TRAITS(ns::employee, employeeNo, name, title)
// Declare the traits. Specify which data members need to be serialized.
diff --git a/examples_boost/more_examples/src/extensibility.cpp b/examples_boost/more_examples/src/extensibility.cpp
index 4e51c189f0..af8a8a930b 100644
--- a/examples_boost/more_examples/src/extensibility.cpp
+++ b/examples_boost/more_examples/src/extensibility.cpp
@@ -174,7 +174,7 @@ namespace ns {
};
} namespace ns
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::fixing, index_id, observation_date, rate)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::fixing, index_id, observation_date, rate)
using namespace jsoncons;
using boost::numeric::ublas::matrix;
diff --git a/include/jsoncons/json_traits_macros.hpp b/include/jsoncons/json_traits_macros.hpp
index 67f2509b9a..b33d1f0004 100644
--- a/include/jsoncons/json_traits_macros.hpp
+++ b/include/jsoncons/json_traits_macros.hpp
@@ -390,15 +390,15 @@ namespace jsoncons \
namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \
/**/
-#define JSONCONS_GETTER_CTOR_IS(Prefix, P2, P3, Member, Count) JSONCONS_GETTER_CTOR_IS_LAST(Prefix, P2, P3, Member, Count)
-#define JSONCONS_GETTER_CTOR_IS_LAST(Prefix, P2, P3, Member, Count) if ((num_params-Count) < num_mandatory_params1 && !ajson.contains(json_traits_macro_names::Member##_str(char_type{}))) return false;
+#define JSONCONS_CTOR_GETTER_IS(Prefix, P2, P3, Member, Count) JSONCONS_CTOR_GETTER_IS_LAST(Prefix, P2, P3, Member, Count)
+#define JSONCONS_CTOR_GETTER_IS_LAST(Prefix, P2, P3, Member, Count) if ((num_params-Count) < num_mandatory_params1 && !ajson.contains(json_traits_macro_names::Member##_str(char_type{}))) return false;
-#define JSONCONS_GETTER_CTOR_AS(Prefix, P2, P3, Member, Count) JSONCONS_GETTER_CTOR_AS_LAST(Prefix, P2, P3, Member, Count),
-#define JSONCONS_GETTER_CTOR_AS_LAST(Prefix, P2, P3, Member, Count) ((num_params-Count) < num_mandatory_params2) ? (ajson.at(json_traits_macro_names::Member##_str(char_type{}))).template asMember())>::type>() : (ajson.contains(json_traits_macro_names::Member##_str(char_type{})) ? (ajson.at(json_traits_macro_names::Member##_str(char_type{}))).template asMember())>::type>() : typename std::decayMember())>::type())
+#define JSONCONS_CTOR_GETTER_AS(Prefix, P2, P3, Member, Count) JSONCONS_CTOR_GETTER_AS_LAST(Prefix, P2, P3, Member, Count),
+#define JSONCONS_CTOR_GETTER_AS_LAST(Prefix, P2, P3, Member, Count) ((num_params-Count) < num_mandatory_params2) ? (ajson.at(json_traits_macro_names::Member##_str(char_type{}))).template asMember())>::type>() : (ajson.contains(json_traits_macro_names::Member##_str(char_type{})) ? (ajson.at(json_traits_macro_names::Member##_str(char_type{}))).template asMember())>::type>() : typename std::decayMember())>::type())
-#define JSONCONS_GETTER_CTOR_TO_JSON(Prefix, P2, P3, Member, Count) JSONCONS_GETTER_CTOR_TO_JSON_LAST(Prefix, P2, P3, Member, Count)
+#define JSONCONS_CTOR_GETTER_TO_JSON(Prefix, P2, P3, Member, Count) JSONCONS_CTOR_GETTER_TO_JSON_LAST(Prefix, P2, P3, Member, Count)
-#define JSONCONS_GETTER_CTOR_TO_JSON_LAST(Prefix, P2, P3, Member, Count) \
+#define JSONCONS_CTOR_GETTER_TO_JSON_LAST(Prefix, P2, P3, Member, Count) \
if ((num_params-Count) < num_mandatory_params2) { \
ajson.try_emplace(json_traits_macro_names::Member##_str(char_type{}), aval.Member() ); \
} \
@@ -406,7 +406,7 @@ else { \
set_json_member(json_traits_macro_names::Member##_str(char_type{}), aval.Member(), ajson); \
}
-#define JSONCONS_GETTER_CTOR_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \
+#define JSONCONS_CTOR_GETTER_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \
namespace jsoncons \
{ \
template \
@@ -427,17 +427,17 @@ namespace jsoncons \
static bool is(const Json& ajson) noexcept \
{ \
if (!ajson.is_object()) return false; \
- JSONCONS_VARIADIC_REP_N(JSONCONS_GETTER_CTOR_IS, ,,, __VA_ARGS__)\
+ JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_IS, ,,, __VA_ARGS__)\
return true; \
} \
static value_type as(const Json& ajson) \
{ \
- return value_type ( JSONCONS_VARIADIC_REP_N(JSONCONS_GETTER_CTOR_AS, ,,, __VA_ARGS__) ); \
+ return value_type ( JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_AS, ,,, __VA_ARGS__) ); \
} \
static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \
{ \
Json ajson(json_object_arg, semantic_tag::none, alloc); \
- JSONCONS_VARIADIC_REP_N(JSONCONS_GETTER_CTOR_TO_JSON, ,,, __VA_ARGS__) \
+ JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_TO_JSON, ,,, __VA_ARGS__) \
return ajson; \
} \
template \
@@ -464,37 +464,37 @@ namespace jsoncons \
} \
/**/
-#define JSONCONS_ALL_GETTER_CTOR_TRAITS(ValueType, ...) \
- JSONCONS_GETTER_CTOR_TRAITS_BASE(0, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \
+#define JSONCONS_ALL_CTOR_GETTER_TRAITS(ValueType, ...) \
+ JSONCONS_CTOR_GETTER_TRAITS_BASE(0, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \
namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \
/**/
-#define JSONCONS_TPL_ALL_GETTER_CTOR_TRAITS(NumTemplateParams, ValueType, ...) \
- JSONCONS_GETTER_CTOR_TRAITS_BASE(NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \
+#define JSONCONS_TPL_ALL_CTOR_GETTER_TRAITS(NumTemplateParams, ValueType, ...) \
+ JSONCONS_CTOR_GETTER_TRAITS_BASE(NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \
namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \
/**/
-#define JSONCONS_N_GETTER_CTOR_TRAITS(ValueType,NumMandatoryParams, ...) \
- JSONCONS_GETTER_CTOR_TRAITS_BASE(0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \
+#define JSONCONS_N_CTOR_GETTER_TRAITS(ValueType,NumMandatoryParams, ...) \
+ JSONCONS_CTOR_GETTER_TRAITS_BASE(0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \
namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \
/**/
-#define JSONCONS_N_ALL_GETTER_CTOR_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \
- JSONCONS_GETTER_CTOR_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \
+#define JSONCONS_N_ALL_CTOR_GETTER_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \
+ JSONCONS_CTOR_GETTER_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \
namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \
/**/
-#define JSONCONS_GETTER_CTOR_NAME_IS(P1, P2, P3, Seq, Count) JSONCONS_GETTER_CTOR_NAME_IS_LAST(P1, P2, P3, Seq, Count)
-#define JSONCONS_GETTER_CTOR_NAME_IS_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params1 && JSONCONS_EXPAND(JSONCONS_GETTER_CTOR_NAME_IS_ Seq)
-#define JSONCONS_GETTER_CTOR_NAME_IS_(Member, Name) !ajson.contains(Name)) return false;
+#define JSONCONS_CTOR_GETTER_NAME_IS(P1, P2, P3, Seq, Count) JSONCONS_CTOR_GETTER_NAME_IS_LAST(P1, P2, P3, Seq, Count)
+#define JSONCONS_CTOR_GETTER_NAME_IS_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params1 && JSONCONS_EXPAND(JSONCONS_CTOR_GETTER_NAME_IS_ Seq)
+#define JSONCONS_CTOR_GETTER_NAME_IS_(Member, Name) !ajson.contains(Name)) return false;
-#define JSONCONS_GETTER_CTOR_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_GETTER_CTOR_NAME_AS_LAST(P1, P2, P3, Seq, Count),
-#define JSONCONS_GETTER_CTOR_NAME_AS_LAST(P1, P2, P3, Seq, Count) ((num_params-Count) < num_mandatory_params2) ? JSONCONS_EXPAND(JSONCONS_GETTER_CTOR_NAME_AS_ Seq)
-#define JSONCONS_GETTER_CTOR_NAME_AS_(Member, Name) (ajson.at(Name)).template asMember())>::type>() : (ajson.contains(Name)) ? (ajson.at(Name)).template asMember())>::type>() : typename std::decayMember())>::type()
+#define JSONCONS_CTOR_GETTER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_CTOR_GETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count),
+#define JSONCONS_CTOR_GETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) ((num_params-Count) < num_mandatory_params2) ? JSONCONS_EXPAND(JSONCONS_CTOR_GETTER_NAME_AS_ Seq)
+#define JSONCONS_CTOR_GETTER_NAME_AS_(Member, Name) (ajson.at(Name)).template asMember())>::type>() : (ajson.contains(Name)) ? (ajson.at(Name)).template asMember())>::type>() : typename std::decayMember())>::type()
-#define JSONCONS_GETTER_CTOR_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_GETTER_CTOR_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count)
-#define JSONCONS_GETTER_CTOR_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params2) JSONCONS_EXPAND(JSONCONS_GETTER_CTOR_NAME_TO_JSON_ Seq)
-#define JSONCONS_GETTER_CTOR_NAME_TO_JSON_(Member, Name) \
+#define JSONCONS_CTOR_GETTER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_CTOR_GETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count)
+#define JSONCONS_CTOR_GETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params2) JSONCONS_EXPAND(JSONCONS_CTOR_GETTER_NAME_TO_JSON_ Seq)
+#define JSONCONS_CTOR_GETTER_NAME_TO_JSON_(Member, Name) \
{ \
ajson.try_emplace(Name, aval.Member() ); \
} \
@@ -502,7 +502,7 @@ else { \
set_json_member(Name, aval.Member(), ajson); \
}
-#define JSONCONS_GETTER_CTOR_NAME_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \
+#define JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams1,NumMandatoryParams2, ...) \
namespace jsoncons \
{ \
template \
@@ -518,17 +518,17 @@ namespace jsoncons \
static bool is(const Json& ajson) noexcept \
{ \
if (!ajson.is_object()) return false; \
- JSONCONS_VARIADIC_REP_N(JSONCONS_GETTER_CTOR_NAME_IS,,,, __VA_ARGS__)\
+ JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_NAME_IS,,,, __VA_ARGS__)\
return true; \
} \
static value_type as(const Json& ajson) \
{ \
- return value_type ( JSONCONS_VARIADIC_REP_N(JSONCONS_GETTER_CTOR_NAME_AS,,,, __VA_ARGS__) ); \
+ return value_type ( JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_NAME_AS,,,, __VA_ARGS__) ); \
} \
static Json to_json(const value_type& aval, allocator_type alloc=allocator_type()) \
{ \
Json ajson(json_object_arg, semantic_tag::none, alloc); \
- JSONCONS_VARIADIC_REP_N(JSONCONS_GETTER_CTOR_NAME_TO_JSON,,,, __VA_ARGS__) \
+ JSONCONS_VARIADIC_REP_N(JSONCONS_CTOR_GETTER_NAME_TO_JSON,,,, __VA_ARGS__) \
return ajson; \
} \
template \
@@ -555,23 +555,23 @@ namespace jsoncons \
} \
/**/
-#define JSONCONS_ALL_GETTER_CTOR_NAME_TRAITS(ValueType, ...) \
- JSONCONS_GETTER_CTOR_NAME_TRAITS_BASE(0, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \
+#define JSONCONS_ALL_CTOR_GETTER_NAME_TRAITS(ValueType, ...) \
+ JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(0, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \
namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \
/**/
-#define JSONCONS_TPL_ALL_GETTER_CTOR_NAME_TRAITS(NumTemplateParams, ValueType, ...) \
- JSONCONS_GETTER_CTOR_NAME_TRAITS_BASE(NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \
+#define JSONCONS_TPL_ALL_CTOR_GETTER_NAME_TRAITS(NumTemplateParams, ValueType, ...) \
+ JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), JSONCONS_NARGS(__VA_ARGS__), __VA_ARGS__) \
namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \
/**/
-#define JSONCONS_N_GETTER_CTOR_NAME_TRAITS(ValueType,NumMandatoryParams, ...) \
- JSONCONS_GETTER_CTOR_NAME_TRAITS_BASE(0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \
+#define JSONCONS_N_CTOR_GETTER_NAME_TRAITS(ValueType,NumMandatoryParams, ...) \
+ JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(0, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \
namespace jsoncons { template <> struct is_json_type_traits_declared : public std::true_type {}; } \
/**/
-#define JSONCONS_TPL_N_GETTER_CTOR_NAME_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \
-JSONCONS_GETTER_CTOR_NAME_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \
+#define JSONCONS_TPL_N_CTOR_GETTER_NAME_TRAITS(NumTemplateParams, ValueType,NumMandatoryParams, ...) \
+JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(NumTemplateParams, ValueType,NumMandatoryParams,NumMandatoryParams, __VA_ARGS__) \
namespace jsoncons { template struct is_json_type_traits_declared : public std::true_type {}; } \
/**/
diff --git a/include/jsoncons/json_traits_macros_deprecated.hpp b/include/jsoncons/json_traits_macros_deprecated.hpp
index b1a71b70d9..0d44e3892a 100644
--- a/include/jsoncons/json_traits_macros_deprecated.hpp
+++ b/include/jsoncons/json_traits_macros_deprecated.hpp
@@ -42,6 +42,17 @@ JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(JSONCONS_GETTER_SETTER_NAME_AS,JSONCONS_
#define JSONCONS_TPL_GETTER_SETTER_NAMED_TRAITS_DECL(NumTemplateParams, ValueType, ...) \
JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(JSONCONS_GETTER_SETTER_NAME_AS,JSONCONS_GETTER_SETTER_NAME_TO_JSON, NumTemplateParams, ValueType, JSONCONS_NARGS(__VA_ARGS__), 0, __VA_ARGS__) \
/**/
+
+#define JSONCONS_ALL_GETTER_CTOR_TRAITS JSONCONS_ALL_CTOR_GETTER_TRAITS
+#define JSONCONS_N_GETTER_CTOR_TRAITS JSONCONS_N_CTOR_GETTER_TRAITS
+#define JSONCONS_TPL_ALL_GETTER_CTOR_TRAITS JSONCONS_TPL_ALL_CTOR_GETTER_TRAITS
+#define JSONCONS_TPL_N_GETTER_CTOR_TRAITS JSONCONS_TPL_N_CTOR_GETTER_TRAITS
+
+#define JSONCONS_ALL_GETTER_CTOR_NAME_TRAITS JSONCONS_ALL_CTOR_GETTER_NAME_TRAITS
+#define JSONCONS_N_GETTER_CTOR_NAME_TRAITS JSONCONS_N_CTOR_GETTER_NAME_TRAITS
+#define JSONCONS_TPL_ALL_GETTER_CTOR_NAME_TRAITS JSONCONS_TPL_ALL_CTOR_GETTER_NAME_TRAITS
+#define JSONCONS_TPL_N_GETTER_CTOR_NAME_TRAITS JSONCONS_TPL_N_CTOR_GETTER_NAME_TRAITS
+
#define JSONCONS_PROPERTY_TRAITS_DECL JSONCONS_GETTER_SETTER_TRAITS_DECL
#define JSONCONS_TPL_PROPERTY_TRAITS_DECL JSONCONS_TPL_GETTER_SETTER_TRAITS_DECL
#define JSONCONS_TYPE_TRAITS_DECL JSONCONS_MEMBER_TRAITS_DECL
diff --git a/tests/src/json_traits_macro_tests.cpp b/tests/src/json_traits_macro_tests.cpp
index 4e553282ce..c42458837f 100644
--- a/tests/src/json_traits_macro_tests.cpp
+++ b/tests/src/json_traits_macro_tests.cpp
@@ -482,15 +482,15 @@ JSONCONS_ALL_MEMBER_TRAITS(ns::book1a,author,title,price)
JSONCONS_N_MEMBER_TRAITS(ns::book1b,3,author,title,price,isbn)
JSONCONS_N_MEMBER_TRAITS(ns::book1c,3,author,title,price,isbn)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::book2a, author, title, price)
-JSONCONS_N_GETTER_CTOR_TRAITS(ns::book2b, 2, author, title, price, isbn, publisher)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::book2a, author, title, price)
+JSONCONS_N_CTOR_GETTER_TRAITS(ns::book2b, 2, author, title, price, isbn, publisher)
JSONCONS_TPL_ALL_MEMBER_TRAITS(1,ns::MyStruct,typeContent,someString)
JSONCONS_TPL_ALL_MEMBER_TRAITS(1,ns::MyStruct2,typeContent,someString)
-JSONCONS_TPL_ALL_GETTER_CTOR_TRAITS(1,ns::MyStruct3,typeContent,someString)
+JSONCONS_TPL_ALL_CTOR_GETTER_TRAITS(1,ns::MyStruct3,typeContent,someString)
JSONCONS_TPL_ALL_MEMBER_TRAITS(2,ns::TemplatedStruct,aT1,aT2)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::HourlyEmployee, firstName, lastName, wage, hours)
-JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::CommissionedEmployee, firstName, lastName, baseSalary, commission, sales)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::HourlyEmployee, firstName, lastName, wage, hours)
+JSONCONS_ALL_CTOR_GETTER_TRAITS(ns::CommissionedEmployee, firstName, lastName, baseSalary, commission, sales)
JSONCONS_POLYMORPHIC_TRAITS(ns::Employee, ns::HourlyEmployee, ns::CommissionedEmployee)
JSONCONS_ALL_GETTER_SETTER_TRAITS(ns::book3a, get, set, Author, Title, Price)
@@ -663,7 +663,7 @@ TEST_CASE("JSONCONS_N_MEMBER_TRAITS with optional tests")
}
}
-TEST_CASE("JSONCONS_ALL_GETTER_CTOR_TRAITS tests")
+TEST_CASE("JSONCONS_ALL_CTOR_GETTER_TRAITS tests")
{
std::string an_author = "Haruki Murakami";
std::string a_title = "Kafka on the Shore";
@@ -705,7 +705,7 @@ TEST_CASE("JSONCONS_ALL_GETTER_CTOR_TRAITS tests")
}
}
-TEST_CASE("JSONCONS_N_GETTER_CTOR_TRAITS tests")
+TEST_CASE("JSONCONS_N_CTOR_GETTER_TRAITS tests")
{
std::string an_author = "Haruki Murakami";
std::string a_title = "Kafka on the Shore";
@@ -841,7 +841,7 @@ TEST_CASE("JSONCONS_TPL_ALL_MEMBER_TRAITS tests")
}
}
-TEST_CASE("JSONCONS_TPL_ALL_GETTER_CTOR_TRAITS tests")
+TEST_CASE("JSONCONS_TPL_ALL_CTOR_GETTER_TRAITS tests")
{
SECTION("MyStruct>")
{
diff --git a/tests/src/json_traits_named_macro_tests.cpp b/tests/src/json_traits_named_macro_tests.cpp
index b0edf86984..303cdec7dc 100644
--- a/tests/src/json_traits_named_macro_tests.cpp
+++ b/tests/src/json_traits_named_macro_tests.cpp
@@ -332,8 +332,8 @@ namespace ns = json_type_traits_named_macro_tests;
JSONCONS_ALL_MEMBER_NAME_TRAITS(ns::book1a,(author,"Author"),(title,"Title"),(price,"Price"))
JSONCONS_ALL_MEMBER_NAME_TRAITS(ns::book1b,(author,"Author"),(title,"Title"),(price,"Price"))
-JSONCONS_ALL_GETTER_CTOR_NAME_TRAITS(ns::book2a, (author,"Author"),(title,"Title"),(price,"Price"))
-JSONCONS_N_GETTER_CTOR_NAME_TRAITS(ns::book2b, 2, (author,"Author"),(title,"Title"),(price,"Price"), (isbn, "Isbn"), (publisher, "Publisher"))
+JSONCONS_ALL_CTOR_GETTER_NAME_TRAITS(ns::book2a, (author,"Author"),(title,"Title"),(price,"Price"))
+JSONCONS_N_CTOR_GETTER_NAME_TRAITS(ns::book2b, 2, (author,"Author"),(title,"Title"),(price,"Price"), (isbn, "Isbn"), (publisher, "Publisher"))
JSONCONS_ALL_GETTER_SETTER_NAME_TRAITS(ns::book3a, (get_author,set_author,"Author"),(get_title,set_title,"Title"),(get_price,set_price,"Price"))
JSONCONS_N_GETTER_SETTER_NAME_TRAITS(ns::book3b, 2, (get_author,set_author,"Author"),(get_title,set_title,"Title"),(get_price,set_price,"Price"),(get_isbn,set_isbn,"Isbn"))
JSONCONS_TPL_ALL_MEMBER_NAME_TRAITS(1,ns::TemplatedStruct1,(typeContent,"type-content"),(someString,"some-string"))
@@ -490,7 +490,7 @@ TEST_CASE("JSONCONS_ENUM_NAME_TRAITS tests")
}
}
-TEST_CASE("JSONCONS_ALL_GETTER_CTOR_NAME_TRAITS tests")
+TEST_CASE("JSONCONS_ALL_CTOR_GETTER_NAME_TRAITS tests")
{
std::string an_author = "Haruki Murakami";
std::string a_title = "Kafka on the Shore";
@@ -532,7 +532,7 @@ TEST_CASE("JSONCONS_ALL_GETTER_CTOR_NAME_TRAITS tests")
}
}
-TEST_CASE("JSONCONS_N_GETTER_CTOR_NAME_TRAITS tests")
+TEST_CASE("JSONCONS_N_CTOR_GETTER_NAME_TRAITS tests")
{
std::string an_author = "Haruki Murakami";
std::string a_title = "Kafka on the Shore";