Skip to content

Commit

Permalink
_DECL -> deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Feb 20, 2020
1 parent 59fa8ad commit b7d50ec
Show file tree
Hide file tree
Showing 15 changed files with 310 additions and 198 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ namespace ns {

// Declare the traits. Specify which data members need to be serialized.

JSONCONS_ENUM_TRAITS_DECL(ns::hiking_experience, beginner, intermediate, advanced)
JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL(ns::hiking_reputon, rater, assertion, rated, rating)
JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL(ns::hiking_reputation, application, reputons)
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)

int main()
{
Expand Down Expand Up @@ -300,13 +300,13 @@ Marilyn C, 0.9
]
}
```
This example makes use of the convenience macros `JSONCONS_ENUM_TRAITS_DECL`
and `JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL` to specialize the
This example makes use of the convenience macros `JSONCONS_ENUM_TRAITS`
and `JSONCONS_ALL_GETTER_CTOR_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_DECL` generates the code from
the enum values, and the macro `JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL`
The macro `JSONCONS_ENUM_TRAITS` generates the code from
the enum values, and the macro `JSONCONS_ALL_GETTER_CTOR_TRAITS`
generates the code from the getter functions and a constructor.
These macro declarations must be placed outside any namespace blocks.
Expand Down
2 changes: 1 addition & 1 deletion acknowledgements.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ and a proposal for aggregation functions that work outside a filter.
- [patternoia](https://github.com/patternoia) for fixing the installation script
to include copying the jsoncons_ext directory into the installation place

- [mikewallis](https://github.com/mikewallis) for removing redundant macro continuation character in JSONCONS_TYPE_TRAITS_DECL
- [mikewallis](https://github.com/mikewallis) for removing redundant macro continuation character in JSONCONS_TYPE_TRAITS

- [KonstantinPlotnikov](https://github.com/KonstantinPlotnikov) for fixing GCC 9.2 warning: ‘class jsoncons::json_exception’
has virtual functions and accessible non-virtual destructor
Expand Down
48 changes: 24 additions & 24 deletions doc/Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
[Serialize a templated class with the `_TPL_` macros](#G3)
[Specialize json_type_traits explicitly](#G4)
[Mapping to C++ data structures with and without defaults allowed](#G5)
[An example using JSONCONS_ENUM_TRAITS_DECL and JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL](#G6)
[An example using JSONCONS_ENUM_TRAITS and JSONCONS_ALL_GETTER_CTOR_TRAITS](#G6)
[Serialize a polymorphic type based on the presence of members](#G7)
[Ensuring type selection is possible](#G8)
[Convert JSON numbers to/from boost multiprecision numbers](#G9)
Expand Down Expand Up @@ -566,11 +566,11 @@ public:
} // namespace ns
// Declare the traits at global scope
JSONCONS_ENUM_TRAITS_DECL(ns::BookCategory,fiction,biography)
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_DECL(ns::Book3,category,author,title,price)
JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::Book3,category,author,title,price)
using namespace jsoncons; // for convenience
Expand Down Expand Up @@ -770,15 +770,15 @@ public:
} // namespace ns

// Declare the traits at global scope
JSONCONS_ENUM_NAMED_TRAITS_DECL(ns::BookCategory,(fiction,"Fiction"),(biography,"Biography"))
JSONCONS_ENUM_NAMED_TRAITS(ns::BookCategory,(fiction,"Fiction"),(biography,"Biography"))

JSONCONS_ALL_MEMBER_NAMED_TRAITS_DECL(ns::Book1,(category,"Category"),(author,"Author"),
JSONCONS_ALL_MEMBER_NAMED_TRAITS(ns::Book1,(category,"Category"),(author,"Author"),
(title,"Title"),(price,"Price"))
JSONCONS_ALL_MEMBER_NAMED_TRAITS_DECL(ns::Book2,(category_,"Category"),(author_,"Author"),
JSONCONS_ALL_MEMBER_NAMED_TRAITS(ns::Book2,(category_,"Category"),(author_,"Author"),
(title_,"Title"),(price_,"Price"))
JSONCONS_ALL_GETTER_CTOR_NAMED_TRAITS_DECL(ns::Book3,(category,"Category"),(author,"Author"),
JSONCONS_ALL_GETTER_CTOR_NAMED_TRAITS(ns::Book3,(category,"Category"),(author,"Author"),
(title,"Title"),(price,"Price"))
JSONCONS_ALL_GETTER_SETTER_NAMED_TRAITS_DECL(ns::Book4,(getCategory,setCategory,"Category"),
JSONCONS_ALL_GETTER_SETTER_NAMED_TRAITS(ns::Book4,(getCategory,setCategory,"Category"),
(getAuthor,setAuthor,"Author"),
(getTitle,setTitle,"Title"),
(getPrice,setPrice,"Price"))
Expand Down Expand Up @@ -1150,15 +1150,15 @@ Key 'ssn' not found
<div id="G6"/>
#### An example using JSONCONS_ENUM_TRAITS_DECL and JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL
#### An example using JSONCONS_ENUM_TRAITS and JSONCONS_ALL_GETTER_CTOR_TRAITS
This example makes use of the convenience macros `JSONCONS_ENUM_TRAITS_DECL`
and `JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL` to specialize the
This example makes use of the convenience macros `JSONCONS_ENUM_TRAITS`
and `JSONCONS_ALL_GETTER_CTOR_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_DECL` generates the code from
the enum values, and the macro `JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL`
The macro `JSONCONS_ENUM_TRAITS` generates the code from
the enum values, and the macro `JSONCONS_ALL_GETTER_CTOR_TRAITS`
generates the code from the getter functions and a constructor.
These macro declarations must be placed outside any namespace blocks.
Expand Down Expand Up @@ -1230,9 +1230,9 @@ namespace ns {
} // namespace ns
// Declare the traits. Specify which data members need to be serialized.
JSONCONS_ENUM_TRAITS_DECL(ns::hiking_experience, beginner, intermediate, advanced)
JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL(ns::hiking_reputon, rater, assertion, rated, rating)
JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL(ns::hiking_reputation, application, reputons)
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)
using namespace jsoncons; // for convenience
Expand Down Expand Up @@ -1268,9 +1268,9 @@ Output:

#### Serialize a polymorphic type based on the presence of members

This example uses the convenience macro `JSONCONS_N_GETTER_CTOR_TRAITS_DECL`
This example uses the convenience macro `JSONCONS_N_GETTER_CTOR_TRAITS`
to generate the `json_type_traits` boilerplate for the `HourlyEmployee` and `CommissionedEmployee`
derived classes, and `JSONCONS_POLYMORPHIC_TRAITS_DECL` to generate the `json_type_traits` boilerplate
derived classes, and `JSONCONS_POLYMORPHIC_TRAITS` to generate the `json_type_traits` boilerplate
for `std::shared_ptr<Employee>` and `std::unique_ptr<Employee>`. The type selection strategy is based
on the presence of mandatory members, in particular, to the `firstName`, `lastName`, and `wage` members of an
`HourlyEmployee`, and to the `firstName`, `lastName`, `baseSalary`, and `commission` members of a `CommissionedEmployee`.
Expand Down Expand Up @@ -1369,9 +1369,9 @@ public:

} // ns

JSONCONS_N_GETTER_CTOR_TRAITS_DECL(ns::HourlyEmployee, 3, firstName, lastName, wage, hours)
JSONCONS_N_GETTER_CTOR_TRAITS_DECL(ns::CommissionedEmployee, 4, firstName, lastName, baseSalary, commission, sales)
JSONCONS_POLYMORPHIC_TRAITS_DECL(ns::Employee, ns::HourlyEmployee, ns::CommissionedEmployee)
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_POLYMORPHIC_TRAITS(ns::Employee, ns::HourlyEmployee, ns::CommissionedEmployee)

int main()
{
Expand Down Expand Up @@ -1462,8 +1462,8 @@ derived classes cannot be distinguished in this way,
you can introduce extra members. The convenience
macros `JSONCONS_N_MEMBER_TRAITS`, `JSONCONS_ALL_MEMBER_TRAITS`,
`JSONCONS_TPL_N_MEMBER_TRAITS`, `JSONCONS_TPL_ALL_MEMBER_TRAITS`,
`JSONCONS_N_MEMBER_TRAITS_NAMED_DECL`, `JSONCONS_ALL_MEMBER_TRAITS_NAMED_DECL`,
`JSONCONS_TPL_N_MEMBER_TRAITS_NAMED_DECL`, and `JSONCONS_TPL_ALL_MEMBER_TRAITS_NAMED_DECL`
`JSONCONS_N_MEMBER_TRAITS_NAMED`, `JSONCONS_ALL_MEMBER_TRAITS_NAMED`,
`JSONCONS_TPL_N_MEMBER_TRAITS_NAMED`, and `JSONCONS_TPL_ALL_MEMBER_TRAITS_NAMED`
allow you to have `const` or `static const` data members that are serialized and that
particpate in the type selection strategy during deserialization.
Expand Down Expand Up @@ -1492,7 +1492,7 @@ class Baz : public Foo
JSONCONS_N_MEMBER_TRAITS(ns::Bar,1,bar)
JSONCONS_N_MEMBER_TRAITS(ns::Baz,1,baz)
JSONCONS_POLYMORPHIC_TRAITS_DECL(ns::Foo, ns::Bar, ns::Baz)
JSONCONS_POLYMORPHIC_TRAITS(ns::Foo, ns::Bar, ns::Baz)
int main()
{
Expand Down
14 changes: 7 additions & 7 deletions doc/Pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ namespace ns {

// Declare the traits. Specify which data members need to be serialized.

JSONCONS_ENUM_TRAITS_DECL(ns::hiking_experience, beginner, intermediate, advanced)
JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL(ns::hiking_reputon, rater, assertion, rated, rating)
JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL(ns::hiking_reputation, application, reputons)
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)

int main()
{
Expand Down Expand Up @@ -218,13 +218,13 @@ Marilyn C, 0.9
]
}
```
This example makes use of the convenience macros `JSONCONS_ENUM_TRAITS_DECL`
and `JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL` to specialize the
This example makes use of the convenience macros `JSONCONS_ENUM_TRAITS`
and `JSONCONS_ALL_GETTER_CTOR_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_DECL` generates the code from
the enum values, and the macro `JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL`
The macro `JSONCONS_ENUM_TRAITS` generates the code from
the enum values, and the macro `JSONCONS_ALL_GETTER_CTOR_TRAITS`
generates the code from the getter functions and a constructor.
These macro declarations must be placed outside any namespace blocks.
Expand Down
2 changes: 1 addition & 1 deletion doc/ref/csv/csv.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ struct json_type_traits<Json,boost::gregorian::date>
}
};

JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL(ns::fixing, index_id, observation_date, rate)
JSONCONS_ALL_GETTER_CTOR_TRAITS(ns::fixing, index_id, observation_date, rate)

int main()
{
Expand Down
Loading

0 comments on commit b7d50ec

Please sign in to comment.