diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index a4cf2b961..dd0bae891 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -24,6 +24,6 @@ assignees: '' **What jsoncons library version?** - - [ ] Latest release 0.175.0 + - [ ] Latest release 0.176.0 - [ ] Other release ______ - [ ] master diff --git a/CHANGELOG.md b/CHANGELOG.md index 359ca4534..7f5ed0742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,16 +1,18 @@ -0.176.0 (pre-release, on master) +0.176.0 ------- Compiler support - Update to [Supported compilers](https://github.com/danielaparker/jsoncons?tab=readme-ov-file#supported-compilers) -documentation to accurately reflect the compilers that currently in continuous integration testing. +documentation to reflect the compilers that are currently in continuous integration testing. - Support for some ancient compilers, in particular g++ 4.8 and 4.9, has been dropped. +- Accepted pr #519 to support build with with llvm-toolset-7 on CentOS 7. + - We (and users) have seen some compilation errors with tests of `std::scoped_allocator_adaptor` using our sample stateful allocator `FreeListAllocator` in versions of clang predating version 11, and versions of g++ predating version 10. We've therefore excluded these tests when testing with -these older compilers. +the older compilers. Enhancements @@ -25,6 +27,16 @@ for (const auto& [key, value] : j.object_range()) - Addressed issue #509 of over allocating memory due to alignment constraints through pr #510 +jsonschema library defect fixes: + +- Fixed issue #520 where enabling format validation resulted in a premature abort to validation + +- Addressed issue #521 so that jsonschema now supports big integers + +Other defect fixes: + +- Resolved #518 about CUDA and int128 and float 128 + 0.175.0 ------- diff --git a/include/jsoncons/json_traits_macros.hpp b/include/jsoncons/json_traits_macros.hpp index b8d7bce55..4e73a3f47 100644 --- a/include/jsoncons/json_traits_macros.hpp +++ b/include/jsoncons/json_traits_macros.hpp @@ -264,20 +264,20 @@ namespace jsoncons #define JSONCONS_N_MEMBER_AS(Prefix,P2,P3, Member, Count) JSONCONS_N_MEMBER_AS_LAST(Prefix,P2,P3, Member, Count) #define JSONCONS_N_MEMBER_AS_LAST(Prefix,P2,P3, Member, Count) \ if ((num_params-Count) < num_mandatory_params2 || ajson.contains(json_traits_macro_names::Member##_str(char_type{}))) \ - {json_traits_helper::set_udt_member(ajson,json_traits_macro_names::Member##_str(char_type{}),aval.Member);} + {json_traits_helper::set_udt_member(ajson,json_traits_macro_names::Member##_str(char_type{}),class_instance.Member);} #define JSONCONS_ALL_MEMBER_AS(Prefix, P2,P3,Member, Count) JSONCONS_ALL_MEMBER_AS_LAST(Prefix,P2,P3, Member, Count) #define JSONCONS_ALL_MEMBER_AS_LAST(Prefix,P2,P3, Member, Count) \ - json_traits_helper::set_udt_member(ajson,json_traits_macro_names::Member##_str(char_type{}),aval.Member); + json_traits_helper::set_udt_member(ajson,json_traits_macro_names::Member##_str(char_type{}),class_instance.Member); #define JSONCONS_TO_JSON(Prefix, P2, P3, Member, Count) JSONCONS_TO_JSON_LAST(Prefix, P2, P3, Member, Count) #define JSONCONS_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);} \ - else {json_traits_helper::set_optional_json_member(json_traits_macro_names::Member##_str(char_type{}), aval.Member, ajson);} + {ajson.try_emplace(json_traits_macro_names::Member##_str(char_type{}), class_instance.Member);} \ + else {json_traits_helper::set_optional_json_member(json_traits_macro_names::Member##_str(char_type{}), class_instance.Member, ajson);} #define JSONCONS_ALL_TO_JSON(Prefix, P2, P3, Member, Count) JSONCONS_ALL_TO_JSON_LAST(Prefix, P2, P3, Member, Count) #define JSONCONS_ALL_TO_JSON_LAST(Prefix, P2, P3, Member, Count) \ - ajson.try_emplace(json_traits_macro_names::Member##_str(char_type{}), aval.Member); + ajson.try_emplace(json_traits_macro_names::Member##_str(char_type{}), class_instance.Member); #define JSONCONS_MEMBER_TRAITS_BASE(AsT,ToJ,NumTemplateParams,ClassType,NumMandatoryParams1,NumMandatoryParams2, ...) \ namespace jsoncons \ @@ -306,11 +306,11 @@ namespace jsoncons \ static class_type as(const Json& ajson) \ { \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # ClassType)); \ - class_type aval{}; \ + class_type class_instance{}; \ JSONKONS_VARIADIC_FOR_EACH(AsT, ,,, __VA_ARGS__) \ - return aval; \ + return class_instance; \ } \ - static Json to_json(const class_type& aval, allocator_type alloc=allocator_type()) \ + static Json to_json(const class_type& class_instance, allocator_type alloc=allocator_type()) \ { \ Json ajson(json_object_arg, semantic_tag::none, alloc); \ JSONKONS_VARIADIC_FOR_EACH(ToJ, ,,, __VA_ARGS__) \ @@ -353,48 +353,48 @@ namespace jsoncons \ #define JSONCONS_N_MEMBER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_N_MEMBER_NAME_AS_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_N_MEMBER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_N_MEMBER_NAME_AS_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_N_MEMBER_NAME_AS_2(Member, Name) \ - if (ajson.contains(Name)) {json_traits_helper::set_udt_member(ajson,Name,aval.Member);} + if (ajson.contains(Name)) {json_traits_helper::set_udt_member(ajson,Name,class_instance.Member);} #define JSONCONS_N_MEMBER_NAME_AS_3(Member, Name, Mode) Mode(JSONCONS_N_MEMBER_NAME_AS_2(Member, Name)) #define JSONCONS_N_MEMBER_NAME_AS_4(Member, Name, Mode, Match) \ - Mode(if (ajson.contains(Name)) {json_traits_helper::set_udt_member(ajson,Name,aval.Member);}) + Mode(if (ajson.contains(Name)) {json_traits_helper::set_udt_member(ajson,Name,class_instance.Member);}) #define JSONCONS_N_MEMBER_NAME_AS_5(Member, Name, Mode, Match, Into) \ - Mode(if (ajson.contains(Name)) {json_traits_helper::template set_udt_member())->Member))>::type>(ajson,Name,aval.Member);}) + Mode(if (ajson.contains(Name)) {json_traits_helper::template set_udt_member())->Member))>::type>(ajson,Name,class_instance.Member);}) #define JSONCONS_N_MEMBER_NAME_AS_6(Member, Name, Mode, Match, Into, From) \ - Mode(if (ajson.contains(Name)) {json_traits_helper::template set_udt_member())->Member))>::type>(ajson,Name,From,aval.Member);}) + Mode(if (ajson.contains(Name)) {json_traits_helper::template set_udt_member())->Member))>::type>(ajson,Name,From,class_instance.Member);}) #define JSONCONS_ALL_MEMBER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_ALL_MEMBER_NAME_AS_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_ALL_MEMBER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_ALL_MEMBER_NAME_AS_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_ALL_MEMBER_NAME_AS_2(Member, Name) \ - json_traits_helper::set_udt_member(ajson,Name,aval.Member); + json_traits_helper::set_udt_member(ajson,Name,class_instance.Member); #define JSONCONS_ALL_MEMBER_NAME_AS_3(Member, Name, Mode) Mode(JSONCONS_ALL_MEMBER_NAME_AS_2(Member, Name)) #define JSONCONS_ALL_MEMBER_NAME_AS_4(Member, Name, Mode, Match) \ - Mode(json_traits_helper::set_udt_member(ajson,Name,aval.Member);) + Mode(json_traits_helper::set_udt_member(ajson,Name,class_instance.Member);) #define JSONCONS_ALL_MEMBER_NAME_AS_5(Member, Name, Mode, Match, Into) \ - Mode(json_traits_helper::template set_udt_member())->Member))>::type>(ajson,Name,aval.Member);) + Mode(json_traits_helper::template set_udt_member())->Member))>::type>(ajson,Name,class_instance.Member);) #define JSONCONS_ALL_MEMBER_NAME_AS_6(Member, Name, Mode, Match, Into, From) \ - Mode(json_traits_helper::template set_udt_member())->Member))>::type>(ajson,Name,From,aval.Member);) + Mode(json_traits_helper::template set_udt_member())->Member))>::type>(ajson,Name,From,class_instance.Member);) #define JSONCONS_N_MEMBER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_N_MEMBER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_N_MEMBER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params2) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_N_MEMBER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_N_MEMBER_NAME_TO_JSON_2(Member, Name) \ - {ajson.try_emplace(Name, aval.Member);} \ + {ajson.try_emplace(Name, class_instance.Member);} \ else \ - {json_traits_helper::set_optional_json_member(Name, aval.Member, ajson);} + {json_traits_helper::set_optional_json_member(Name, class_instance.Member, ajson);} #define JSONCONS_N_MEMBER_NAME_TO_JSON_3(Member, Name, Mode) JSONCONS_N_MEMBER_NAME_TO_JSON_2(Member, Name) #define JSONCONS_N_MEMBER_NAME_TO_JSON_4(Member, Name, Mode, Match) JSONCONS_N_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match,,) #define JSONCONS_N_MEMBER_NAME_TO_JSON_5(Member, Name, Mode, Match, Into) JSONCONS_N_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, ) #define JSONCONS_N_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, From) \ - {ajson.try_emplace(Name, Into(aval.Member));} \ + {ajson.try_emplace(Name, Into(class_instance.Member));} \ else \ - {json_traits_helper::set_optional_json_member(Name, Into(aval.Member), ajson);} + {json_traits_helper::set_optional_json_member(Name, Into(class_instance.Member), ajson);} #define JSONCONS_ALL_MEMBER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_ALL_MEMBER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_ALL_MEMBER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_ALL_MEMBER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_ALL_MEMBER_NAME_TO_JSON_2(Member, Name) ajson.try_emplace(Name, aval.Member); +#define JSONCONS_ALL_MEMBER_NAME_TO_JSON_2(Member, Name) ajson.try_emplace(Name, class_instance.Member); #define JSONCONS_ALL_MEMBER_NAME_TO_JSON_3(Member, Name, Mode) JSONCONS_ALL_MEMBER_NAME_TO_JSON_2(Member, Name) #define JSONCONS_ALL_MEMBER_NAME_TO_JSON_4(Member, Name, Mode, Match) JSONCONS_ALL_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match,,) #define JSONCONS_ALL_MEMBER_NAME_TO_JSON_5(Member, Name, Mode, Match, Into) JSONCONS_ALL_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, ) -#define JSONCONS_ALL_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, From) ajson.try_emplace(Name, Into(aval.Member)); +#define JSONCONS_ALL_MEMBER_NAME_TO_JSON_6(Member, Name, Mode, Match, Into, From) ajson.try_emplace(Name, Into(class_instance.Member)); #define JSONCONS_MEMBER_NAME_TRAITS_BASE(AsT,ToJ, NumTemplateParams, ClassType,NumMandatoryParams1,NumMandatoryParams2, ...) \ namespace jsoncons \ @@ -418,11 +418,11 @@ namespace jsoncons \ static class_type as(const Json& ajson) \ { \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # ClassType)); \ - class_type aval{}; \ + class_type class_instance{}; \ JSONKONS_VARIADIC_FOR_EACH(AsT,,,, __VA_ARGS__) \ - return aval; \ + return class_instance; \ } \ - static Json to_json(const class_type& aval, allocator_type alloc=allocator_type()) \ + static Json to_json(const class_type& class_instance, allocator_type alloc=allocator_type()) \ { \ Json ajson(json_object_arg, semantic_tag::none, alloc); \ JSONKONS_VARIADIC_FOR_EACH(ToJ,,,, __VA_ARGS__) \ @@ -463,10 +463,10 @@ namespace jsoncons \ #define JSONCONS_CTOR_GETTER_TO_JSON_LAST(Prefix, P2, P3, Getter, Count) \ if ((num_params-Count) < num_mandatory_params2) { \ - ajson.try_emplace(json_traits_macro_names::Getter##_str(char_type{}), aval.Getter() ); \ + ajson.try_emplace(json_traits_macro_names::Getter##_str(char_type{}), class_instance.Getter() ); \ } \ else { \ - json_traits_helper::set_optional_json_member(json_traits_macro_names::Getter##_str(char_type{}), aval.Getter(), ajson); \ + json_traits_helper::set_optional_json_member(json_traits_macro_names::Getter##_str(char_type{}), class_instance.Getter(), ajson); \ } #define JSONCONS_CTOR_GETTER_TRAITS_BASE(NumTemplateParams, ClassType,NumMandatoryParams1,NumMandatoryParams2, ...) \ @@ -498,7 +498,7 @@ namespace jsoncons \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # ClassType)); \ return class_type ( JSONKONS_VARIADIC_FOR_EACH(JSONCONS_CTOR_GETTER_AS, ,,, __VA_ARGS__) ); \ } \ - static Json to_json(const class_type& aval, allocator_type alloc=allocator_type()) \ + static Json to_json(const class_type& class_instance, allocator_type alloc=allocator_type()) \ { \ Json ajson(json_object_arg, semantic_tag::none, alloc); \ JSONKONS_VARIADIC_FOR_EACH(JSONCONS_CTOR_GETTER_TO_JSON, ,,, __VA_ARGS__) \ @@ -557,20 +557,20 @@ namespace jsoncons \ #define JSONCONS_CTOR_GETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params2) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_CTOR_GETTER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_CTOR_GETTER_NAME_TO_JSON_2(Getter, Name) \ { \ - ajson.try_emplace(Name, aval.Getter() ); \ + ajson.try_emplace(Name, class_instance.Getter() ); \ } \ else { \ - json_traits_helper::set_optional_json_member(Name, aval.Getter(), ajson); \ + json_traits_helper::set_optional_json_member(Name, class_instance.Getter(), ajson); \ } #define JSONCONS_CTOR_GETTER_NAME_TO_JSON_3(Getter, Name, Mode) JSONCONS_CTOR_GETTER_NAME_TO_JSON_2(Getter, Name) #define JSONCONS_CTOR_GETTER_NAME_TO_JSON_4(Getter, Name, Mode, Match) JSONCONS_CTOR_GETTER_NAME_TO_JSON_2(Getter, Name) #define JSONCONS_CTOR_GETTER_NAME_TO_JSON_5(Getter, Name, Mode, Match, Into) JSONCONS_CTOR_GETTER_NAME_TO_JSON_6(Getter, Name, Mode, Match, Into, ) #define JSONCONS_CTOR_GETTER_NAME_TO_JSON_6(Getter, Name, Mode, Match, Into, From) \ { \ - ajson.try_emplace(Name, Into(aval.Getter()) ); \ + ajson.try_emplace(Name, Into(class_instance.Getter()) ); \ } \ else { \ - json_traits_helper::set_optional_json_member(Name, Into(aval.Getter()), ajson); \ + json_traits_helper::set_optional_json_member(Name, Into(class_instance.Getter()), ajson); \ } #define JSONCONS_CTOR_GETTER_NAME_TRAITS_BASE(NumTemplateParams, ClassType,NumMandatoryParams1,NumMandatoryParams2, ...) \ @@ -597,7 +597,7 @@ namespace jsoncons \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # ClassType)); \ return class_type ( JSONKONS_VARIADIC_FOR_EACH(JSONCONS_CTOR_GETTER_NAME_AS,,,, __VA_ARGS__) ); \ } \ - static Json to_json(const class_type& aval, allocator_type alloc=allocator_type()) \ + static Json to_json(const class_type& class_instance, allocator_type alloc=allocator_type()) \ { \ Json ajson(json_object_arg, semantic_tag::none, alloc); \ JSONKONS_VARIADIC_FOR_EACH(JSONCONS_CTOR_GETTER_NAME_TO_JSON,,,, __VA_ARGS__) \ @@ -702,17 +702,17 @@ namespace jsoncons \ } \ return it->first; \ } \ - static Json to_json(enum_type aval, allocator_type alloc=allocator_type()) \ + static Json to_json(enum_type class_instance, allocator_type alloc=allocator_type()) \ { \ static constexpr char_type empty_string[] = {0}; \ auto first = get_values().first; \ auto last = get_values().second; \ auto it = std::find_if(first, last, \ - [aval](const mapped_type& item) -> bool \ - { return item.first == aval; }); \ + [class_instance](const mapped_type& item) -> bool \ + { return item.first == class_instance; }); \ if (it == last) \ { \ - if (aval == enum_type()) \ + if (class_instance == enum_type()) \ { \ return Json(empty_string); \ } \ @@ -803,17 +803,17 @@ namespace jsoncons \ } \ return it->first; \ } \ - static Json to_json(enum_type aval, allocator_type alloc=allocator_type()) \ + static Json to_json(enum_type class_instance, allocator_type alloc=allocator_type()) \ { \ static constexpr char_type empty_string[] = {0}; \ auto first = get_values().first; \ auto last = get_values().second; \ auto it = std::find_if(first, last, \ - [aval](const mapped_type& item) -> bool \ - { return item.first == aval; }); \ + [class_instance](const mapped_type& item) -> bool \ + { return item.first == class_instance; }); \ if (it == last) \ { \ - if (aval == enum_type()) \ + if (class_instance == enum_type()) \ { \ return Json(empty_string); \ } \ @@ -831,23 +831,23 @@ namespace jsoncons \ #define JSONCONS_GETTER_SETTER_AS(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_GETTER_SETTER_AS_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_GETTER_SETTER_AS_LAST(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_GETTER_SETTER_AS_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) -#define JSONCONS_GETTER_SETTER_AS_(Prefix, Getter, Setter, Property, Count) if ((num_params-Count) < num_mandatory_params2 || ajson.contains(json_traits_macro_names::Property##_str(char_type{}))) {aval.Setter(ajson.at(json_traits_macro_names::Property##_str(char_type{})).template as::type>());} +#define JSONCONS_GETTER_SETTER_AS_(Prefix, Getter, Setter, Property, Count) if ((num_params-Count) < num_mandatory_params2 || ajson.contains(json_traits_macro_names::Property##_str(char_type{}))) {class_instance.Setter(ajson.at(json_traits_macro_names::Property##_str(char_type{})).template as::type>());} #define JSONCONS_ALL_GETTER_SETTER_AS(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_ALL_GETTER_SETTER_AS_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_ALL_GETTER_SETTER_AS_LAST(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_ALL_GETTER_SETTER_AS_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) -#define JSONCONS_ALL_GETTER_SETTER_AS_(Prefix, Getter, Setter, Property, Count) aval.Setter(ajson.at(json_traits_macro_names::Property##_str(char_type{})).template as::type>()); +#define JSONCONS_ALL_GETTER_SETTER_AS_(Prefix, Getter, Setter, Property, Count) class_instance.Setter(ajson.at(json_traits_macro_names::Property##_str(char_type{})).template as::type>()); #define JSONCONS_GETTER_SETTER_TO_JSON(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_GETTER_SETTER_TO_JSON_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_GETTER_SETTER_TO_JSON_LAST(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_GETTER_SETTER_TO_JSON_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_GETTER_SETTER_TO_JSON_(Prefix, Getter, Setter, Property, Count) \ if ((num_params-Count) < num_mandatory_params2) \ - {ajson.try_emplace(json_traits_macro_names::Property##_str(char_type{}), aval.Getter());} \ + {ajson.try_emplace(json_traits_macro_names::Property##_str(char_type{}), class_instance.Getter());} \ else \ - {json_traits_helper::set_optional_json_member(json_traits_macro_names::Property##_str(char_type{}), aval.Getter(), ajson);} + {json_traits_helper::set_optional_json_member(json_traits_macro_names::Property##_str(char_type{}), class_instance.Getter(), ajson);} #define JSONCONS_ALL_GETTER_SETTER_TO_JSON(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_ALL_GETTER_SETTER_TO_JSON_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) #define JSONCONS_ALL_GETTER_SETTER_TO_JSON_LAST(Prefix, GetPrefix, SetPrefix, Property, Count) JSONCONS_ALL_GETTER_SETTER_TO_JSON_(Prefix, GetPrefix ## Property, SetPrefix ## Property, Property, Count) -#define JSONCONS_ALL_GETTER_SETTER_TO_JSON_(Prefix, Getter, Setter, Property, Count) ajson.try_emplace(json_traits_macro_names::Property##_str(char_type{}), aval.Getter() ); +#define JSONCONS_ALL_GETTER_SETTER_TO_JSON_(Prefix, Getter, Setter, Property, Count) ajson.try_emplace(json_traits_macro_names::Property##_str(char_type{}), class_instance.Getter() ); #define JSONCONS_GETTER_SETTER_TRAITS_BASE(AsT,ToJ,NumTemplateParams, ClassType,GetPrefix,SetPrefix,NumMandatoryParams1,NumMandatoryParams2, ...) \ namespace jsoncons \ @@ -876,11 +876,11 @@ namespace jsoncons \ static class_type as(const Json& ajson) \ { \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # ClassType)); \ - class_type aval{}; \ + class_type class_instance{}; \ JSONKONS_VARIADIC_FOR_EACH(AsT, ,GetPrefix,SetPrefix, __VA_ARGS__) \ - return aval; \ + return class_instance; \ } \ - static Json to_json(const class_type& aval, allocator_type alloc=allocator_type()) \ + static Json to_json(const class_type& class_instance, allocator_type alloc=allocator_type()) \ { \ Json ajson(json_object_arg, semantic_tag::none, alloc); \ JSONKONS_VARIADIC_FOR_EACH(ToJ, ,GetPrefix,SetPrefix, __VA_ARGS__) \ @@ -921,39 +921,39 @@ namespace jsoncons \ #define JSONCONS_N_GETTER_SETTER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_N_GETTER_SETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_N_GETTER_SETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_N_GETTER_SETTER_NAME_AS_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_N_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name) if (ajson.contains(Name)) aval.Setter(ajson.at(Name).template as::type>()); +#define JSONCONS_N_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name) if (ajson.contains(Name)) class_instance.Setter(ajson.at(Name).template as::type>()); #define JSONCONS_N_GETTER_SETTER_NAME_AS_4(Getter, Setter, Name, Mode) Mode(JSONCONS_N_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name)) #define JSONCONS_N_GETTER_SETTER_NAME_AS_5(Getter, Setter, Name, Mode, Match) JSONCONS_N_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, , ) #define JSONCONS_N_GETTER_SETTER_NAME_AS_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_N_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, ) -#define JSONCONS_N_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, From) Mode(if (ajson.contains(Name)) aval.Setter(From(ajson.at(Name).template as::type>()));) +#define JSONCONS_N_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, From) Mode(if (ajson.contains(Name)) class_instance.Setter(From(ajson.at(Name).template as::type>()));) #define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_3(Getter, Setter, Name) ajson.try_emplace(Name, aval.Getter() ); +#define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_3(Getter, Setter, Name) ajson.try_emplace(Name, class_instance.Getter() ); #define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_5(Getter, Setter, Name, Mode, Match) JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, , ) #define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, ) -#define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, From) ajson.try_emplace(Name, Into(aval.Getter()) ); +#define JSONCONS_N_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, From) ajson.try_emplace(Name, Into(class_instance.Getter()) ); #define JSONCONS_ALL_GETTER_SETTER_NAME_AS(P1, P2, P3, Seq, Count) JSONCONS_ALL_GETTER_SETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_ALL_GETTER_SETTER_NAME_AS_LAST(P1, P2, P3, Seq, Count) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_ALL_GETTER_SETTER_NAME_AS_,JSONCONS_NARGS Seq) Seq) -#define JSONCONS_ALL_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name) aval.Setter(ajson.at(Name).template as::type>()); +#define JSONCONS_ALL_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name) class_instance.Setter(ajson.at(Name).template as::type>()); #define JSONCONS_ALL_GETTER_SETTER_NAME_AS_4(Getter, Setter, Name, Mode) Mode(JSONCONS_ALL_GETTER_SETTER_NAME_AS_3(Getter, Setter, Name)) #define JSONCONS_ALL_GETTER_SETTER_NAME_AS_5(Getter, Setter, Name, Mode, Match) JSONCONS_ALL_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, , ) #define JSONCONS_ALL_GETTER_SETTER_NAME_AS_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_ALL_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, ) -#define JSONCONS_ALL_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, From) Mode(aval.Setter(From(ajson.at(Name).template as::type>()));) +#define JSONCONS_ALL_GETTER_SETTER_NAME_AS_7(Getter, Setter, Name, Mode, Match, Into, From) Mode(class_instance.Setter(From(ajson.at(Name).template as::type>()));) #define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON(P1, P2, P3, Seq, Count) JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) #define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_LAST(P1, P2, P3, Seq, Count) if ((num_params-Count) < num_mandatory_params2) JSONCONS_EXPAND(JSONCONS_CONCAT(JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_,JSONCONS_NARGS Seq) Seq) #define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_3(Getter, Setter, Name) \ - ajson.try_emplace(Name, aval.Getter()); \ + ajson.try_emplace(Name, class_instance.Getter()); \ else \ - {json_traits_helper::set_optional_json_member(Name, aval.Getter(), ajson);} + {json_traits_helper::set_optional_json_member(Name, class_instance.Getter(), ajson);} #define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_5(Getter, Setter, Name, Mode, Match) JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, , ) #define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_6(Getter, Setter, Name, Mode, Match, Into) JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, ) #define JSONCONS_ALL_GETTER_SETTER_NAME_TO_JSON_7(Getter, Setter, Name, Mode, Match, Into, From) \ - ajson.try_emplace(Name, Into(aval.Getter())); \ + ajson.try_emplace(Name, Into(class_instance.Getter())); \ else \ - {json_traits_helper::set_optional_json_member(Name, Into(aval.Getter()), ajson);} + {json_traits_helper::set_optional_json_member(Name, Into(class_instance.Getter()), ajson);} #define JSONCONS_GETTER_SETTER_NAME_TRAITS_BASE(AsT,ToJ, NumTemplateParams, ClassType,NumMandatoryParams1,NumMandatoryParams2, ...) \ namespace jsoncons \ @@ -977,11 +977,11 @@ namespace jsoncons \ static class_type as(const Json& ajson) \ { \ if (!is(ajson)) JSONCONS_THROW(conv_error(conv_errc::conversion_failed, "Not a " # ClassType)); \ - class_type aval{}; \ + class_type class_instance{}; \ JSONKONS_VARIADIC_FOR_EACH(AsT,,,, __VA_ARGS__) \ - return aval; \ + return class_instance; \ } \ - static Json to_json(const class_type& aval, allocator_type alloc=allocator_type()) \ + static Json to_json(const class_type& class_instance, allocator_type alloc=allocator_type()) \ { \ Json ajson(json_object_arg, semantic_tag::none, alloc); \ JSONKONS_VARIADIC_FOR_EACH(ToJ,,,, __VA_ARGS__) \