Skip to content

Commit bcb4459

Browse files
committed
json_type_traits dir -> legacy_reflect
1 parent 9b79710 commit bcb4459

9 files changed

Lines changed: 34 additions & 35 deletions

File tree

doc/Examples.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ json j = R"(
117117
)"_json;
118118
```
119119
120-
See [basic_json::parse](ref/json/parse.md).
120+
See [basic_json::parse](./ref/corelib/json/parse.md).
121121
122122
<div id="A2"/>
123123
@@ -129,7 +129,7 @@ std::ifstream is("myfile.json");
129129
json j = json::parse(is);
130130
```
131131
132-
See [basic_json::parse](ref/json/parse.md).
132+
See [basic_json::parse](./ref/corelib/json/parse.md).
133133
134134
<div id="A10"/>
135135
@@ -293,7 +293,7 @@ Output:
293293
["foo","bar"]
294294
```
295295

296-
See [basic_json::parse](ref/json/parse.md).
296+
See [basic_json::parse](./ref/corelib/json/parse.md).
297297

298298
<div id="A8"/>
299299

@@ -971,7 +971,7 @@ begin_object
971971
end_array
972972
```
973973

974-
See [basic_json_cursor](ref/basic_json_cursor.md)
974+
See [basic_json_cursor](./ref/corelib/basic_json_cursor.md)
975975

976976
<div id="I4"/>
977977

@@ -1009,7 +1009,7 @@ Output:
10091009
}
10101010
```
10111011

1012-
See [staj_array_iterator](ref/staj_array_iterator.md)
1012+
See [staj_array_iterator](./ref/corelib/staj_array_iterator.md)
10131013

10141014
<div id="I5"/>
10151015

@@ -1052,7 +1052,7 @@ Haruki Murakami, Hard-Boiled Wonderland and the End of the World
10521052
Graham Greene, The Comedians
10531053
```
10541054

1055-
See [staj_array_iterator](ref/staj_array_iterator.md)
1055+
See [staj_array_iterator](./ref/corelib/staj_array_iterator.md)
10561056

10571057
<div id="G0"/>
10581058

@@ -1540,7 +1540,7 @@ namespace ns {
15401540

15411541
class Person
15421542
{
1543-
// Make json_type_traits specializations friends to give accesses to private members
1543+
// Make reflection traits specializations friends to give accesses to private members
15441544
JSONCONS_TYPE_TRAITS_FRIEND
15451545

15461546
std::string name;
@@ -1593,7 +1593,7 @@ If all members of the JSON data must be present, use
15931593
```
15941594
JSONCONS_ALL_MEMBER_TRAITS(ns::Person, name, surname, ssn, age)
15951595
```
1596-
instead. This will cause a [jsoncons::conv_error](ref/conv_error.md) to be thrown with the message
1596+
instead. This will cause a [jsoncons::conv_error](./ref/corelib/conv_error.md) to be thrown with the message
15971597
```
15981598
Key not found: 'ssn'
15991599
```
@@ -1602,14 +1602,13 @@ Key not found: 'ssn'
16021602
16031603
#### Specialize jsoncons::reflect::json_traits explicitly
16041604
1605-
jsoncons supports conversion between JSON text and C++ data structures. The functions [decode_json](ref/decode_json.md)
1606-
and [encode_json](ref/encode_json.md) convert JSON formatted strings or streams to C++ data structures and back.
1605+
jsoncons supports conversion between JSON text and C++ data structures. The functions [decode_json](./ref/corelib/decode_json.md)
1606+
and [encode_json](./ref/corelib/encode_json.md) convert JSON formatted strings or streams to C++ data structures and back.
16071607
Decode and encode work for all C++ classes that have
1608-
[reflection traits](./ref/corelib/reflection_traits.md)
1608+
[reflection traits](./ref/corelib/reflection-traits.md)
16091609
defined. jsoncons already supports many types in the standard library,
1610-
and your own types will be supported too if you specialize `json_traits`
1611-
in the `jsoncons::reflect` namespace.
1612-
1610+
and your own types will be supported too if you specialize [json_conv_traits](./ref/corelib/reflect/json_conv_traits.md)
1611+
(since 1.4.0, rename to json_traits in 1.9.0) or [json_type_traits](./ref/corelib/legacy_reflect/json_type_traits.md).
16131612
16141613
```cpp
16151614
#include <iostream>
@@ -1628,7 +1627,7 @@ namespace jsoncons {
16281627
namespace reflect {
16291628
16301629
template <typename Json>
1631-
struct json_traits<Json, ns::book> // since 1.9.0, use json_conv_traits until 1.9.0
1630+
struct json_traits<Json, ns::book> // since 1.9.0
16321631
{
16331632
using allocator_type = Json::allocator_type;
16341633
using result_type = conversion_result<ns::book>;
@@ -1754,7 +1753,7 @@ Charles Bukowski, Pulp, 22.48
17541753

17551754
#### Serialize non-mandatory std::optional values using the convenience macros
17561755

1757-
The jsoncons library includes a [json_type_traits](ref/json_type_traits/json_type_traits.md) specialization for
1756+
The jsoncons library includes a [reflection traits](./ref/corelib/reflection-traits.md) specialization for
17581757
`jsoncons::optional<T>` if `T` is also specialized. `jsoncons::optional<T>` is aliased to
17591758
[std::optional<T>](https://en.cppreference.com/w/cpp/utility/optional) if
17601759
jsoncons detects the presence of C++17, or if `JSONCONS_HAS_STD_OPTIONAL` is defined.
@@ -1859,7 +1858,7 @@ Output:
18591858

18601859
#### An example with std::shared_ptr and std::unique_ptr
18611860

1862-
The jsoncons library includes [json_type_traits](ref/json_type_traits/json_type_traits.md) specializations for
1861+
The jsoncons library includes [reflection traits](./ref/corelib/reflection-traits.md) specializations for
18631862
`std::shared_ptr<T>` and `std::unique_ptr<T>` if `T` is not a [polymorphic class](https://en.cppreference.com/w/cpp/language/object#Polymorphic_objects),
18641863
i.e., does not have any virtual functions, and if `T` is also specialized. Empty `std::shared_ptr<T>` and `std::unique_ptr<T>` values correspond to JSON null.
18651864
In addition, users can implement `json_type_traits` for `std::shared_ptr` and `std::unique_ptr`
@@ -1983,7 +1982,7 @@ int main()
19831982

19841983
This example makes use of the convenience macros `JSONCONS_ENUM_TRAITS`
19851984
and `JSONCONS_ALL_CTOR_GETTER_TRAITS` to specialize the
1986-
[json_type_traits](ref/json_type_traits/json_type_traits.md) for the enum type
1985+
[reflection traits](./ref/corelib/reflection-traits.md) for the enum type
19871986
`ns::hiking_experience` and the classes `ns::hiking_reputon` and
19881987
`ns::hiking_reputation`.
19891988
The macro `JSONCONS_ENUM_TRAITS` generates the code from
@@ -2110,7 +2109,7 @@ Marilyn C, 0.9, 1514862245
21102109
#### Serialize a polymorphic type based on the presence of members
21112110

21122111
This example uses the convenience macro `JSONCONS_N_CTOR_GETTER_TRAITS`
2113-
to generate the [json_type_traits](ref/json_type_traits/json_type_traits.md) boilerplate for the `HourlyEmployee` and `CommissionedEmployee`
2112+
to generate the [reflection traits](./ref/corelib/reflection-traits.md) boilerplate for the `HourlyEmployee` and `CommissionedEmployee`
21142113
derived classes, and `JSONCONS_POLYMORPHIC_TRAITS` to generate the `json_type_traits` boilerplate
21152114
for `std::shared_ptr<Employee>` and `std::unique_ptr<Employee>`. The type selection strategy is based
21162115
on the presence of mandatory members, in particular, to the `firstName`, `lastName`, and `wage` members of an
@@ -3023,7 +3022,7 @@ we use the function object `ns::rectangle_marker` to ouput the value
30233022
this position cannot be a lambda expression (at least until C++20),
30243023
because jsoncons uses it in an unevaluated context, so it is
30253024
provided as a variable containing a lambda expression instead.
3026-
See [convenience macros](ref/json_type_traits/reflect/reflect-traits-gen.md)
3025+
See [convenience macros](./ref/corelib/legacy_reflect/reflect/reflect-traits-gen.md)
30273026
for full details.
30283027

30293028
<div id="G13"/>
@@ -3609,10 +3608,10 @@ Output:
36093608
36103609
#### Merge two json objects
36113610
3612-
[json::merge](ref/json/merge.md) inserts another json object's key-value pairs into a json object,
3611+
[json::merge](./ref/corelib/json/merge.md) inserts another json object's key-value pairs into a json object,
36133612
unless they already exist with an equivalent key.
36143613
3615-
[json::merge_or_update](ref/json/merge_or_update.md) inserts another json object's key-value pairs
3614+
[json::merge_or_update](./ref/corelib/json/merge_or_update.md) inserts another json object's key-value pairs
36163615
into a json object, or assigns them if they already exist.
36173616
36183617
The `merge` and `merge_or_update` functions perform only a one-level-deep shallow merge,
@@ -3796,7 +3795,7 @@ Output:
37963795

37973796
#### Search for and repace an object member key
37983797

3799-
You can rename object members with the built in filter [rename_object_key_filter](ref/rename_object_key_filter.md)
3798+
You can rename object members with the built in filter [rename_object_key_filter](./ref/corelib/rename_object_key_filter.md)
38003799

38013800
```cpp
38023801
#include <sstream>

doc/Pages/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ to work with the data in a number of ways:
2929

3030
- As a variant-like data structure, [basic_json](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/basic_json.md)
3131

32-
- As a strongly typed C++ data structure that implements [json_type_traits](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/json_type_traits/json_type_traits.md)
32+
- As a strongly typed C++ data structure that implements [json_type_traits](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/legacy_reflect/json_type_traits.md)
3333

3434
- With [cursor-level access](https://github.com/danielaparker/jsoncons/blob/doc/doc/ref/corelib/basic_json_cursor.md) to a stream of parse events, somewhat analogous to StAX pull parsing and push serializing
3535
in the XML world.
@@ -38,7 +38,7 @@ Compared to other JSON libraries, jsoncons has been designed to handle very larg
3838
SAX-style parsers and serializers. It supports reading an entire JSON text in memory in a variant-like structure.
3939
But it also supports efficient access to the underlying data using StAX-style pull parsing and push serializing.
4040
And it supports incremental parsing into a user's preferred form, using
41-
information about user types provided by specializations of [json_type_traits](doc/ref/corelib/json_type_traits/json_type_traits.md).
41+
information about user types provided by specializations of [json_type_traits](doc/ref/corelib/legacy_reflect/json_type_traits.md).
4242

4343
The [jsoncons data model](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/data-model.md) supports the familiar JSON types - nulls,
4444
booleans, numbers, strings, arrays, objects - plus byte strings. In addition, jsoncons
@@ -75,7 +75,7 @@ jsoncons allows you to work with the data in a number of ways:
7575

7676
- As a variant-like data structure, [basic_json](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/basic_json.md)
7777

78-
- As a strongly typed C++ data structure that implements [json_type_traits](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/json_type_traits/json_type_traits.md)
78+
- As a strongly typed C++ data structure that implements [json_type_traits](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/legacy_reflect/json_type_traits.md)
7979

8080
- As a stream of parse events
8181

@@ -145,7 +145,7 @@ jsoncons supports transforming JSON texts into C++ data structures.
145145
The functions [decode_json](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/decode_json.md) and [encode_json](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/encode_json.md)
146146
convert strings or streams of JSON data to C++ data structures and back.
147147
Decode and encode work for all C++ classes that have
148-
[json_type_traits](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/json_type_traits/json_type_traits.md)
148+
[json_type_traits](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/legacy_reflect/json_type_traits.md)
149149
defined. jsoncons already supports many types in the standard library,
150150
and your own types will be supported too if you specialize `json_type_traits`
151151
in the `jsoncons` namespace.
@@ -266,7 +266,7 @@ Marilyn C, 0.9, 1514862245
266266

267267
This example makes use of the convenience macros `JSONCONS_ENUM_TRAITS`
268268
and `JSONCONS_ALL_CTOR_GETTER_TRAITS` to specialize the
269-
[json_type_traits](doc/ref/corelib/json_type_traits/json_type_traits.md) for the enum type
269+
[json_type_traits](doc/ref/corelib/legacy_reflect/json_type_traits.md) for the enum type
270270
`ns::hiking_experience` and the classes `ns::hiking_reputon` and
271271
`ns::hiking_reputation`.
272272
The macro `JSONCONS_ENUM_TRAITS` generates the code from

doc/Reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ All core jsoncons classes and functions are in namespace `jsoncons`.
66

77
#### Serialize and Deserialize Support
88

9-
[json_type_traits](ref/corelib/json_type_traits/json_type_traits.md)
9+
[json_type_traits](ref/corelib/legacy_reflect/json_type_traits.md)
1010
[encode_json](ref/corelib/encode_json.md)
1111
[decode_json, try_decode_json](ref/corelib/decode_json.md)
1212
[basic_json_options](ref/corelib/basic_json_options.md)

doc/ref/corelib/decode_json.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ or support [reflection traits](./reflection-traits.md).
6161
6262
(2) Reads JSON from an input stream into a type T, using the specified (or defaulted) [options](basic_json_options.md).
6363
Type 'T' must be an instantiation of [basic_json](basic_json.md)
64-
or support [json_type_traits](../json_type_traits/json_type_traits.md).
64+
or support [json_type_traits](../legacy_reflect/json_type_traits.md).
6565
6666
(3)-(4) are identical to (1)-(2) except an [allocator_set](allocator_set.md) is passed as an additional argument and
6767
provides allocators for result data and temporary allocations.

doc/ref/corelib/json_type_traits/Eigen-Matrix-example.md renamed to doc/ref/corelib/legacy_reflect/Eigen-Matrix-example.md

File renamed without changes.

doc/ref/corelib/json_type_traits/built-in-specializations.md renamed to doc/ref/corelib/legacy_reflect/built-in-specializations.md

File renamed without changes.

doc/ref/corelib/json_type_traits/custom-specializations.md renamed to doc/ref/corelib/legacy_reflect/custom-specializations.md

File renamed without changes.

doc/ref/corelib/json_type_traits/json_type_traits.md renamed to doc/ref/corelib/legacy_reflect/json_type_traits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ try to convert `val` into a `Json` value.
4040
jsoncons includes specializiations for most types in the standard library.
4141
And it includes convenience macros that make specializing `json_type_traits` for your own types easier.
4242

43-
[Built-in Specializations](built-in-specializations.md)
43+
[Built-in Specializations](./built-in-specializations.md)
4444

4545
[Custom Specializations](custom-specializations.md)
4646

doc/ref/corelib/reflection-traits.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Until 1.9.0, these were named [json_conv_traits](./reflect/json_conv_traits.md),
2121
1.9.0, they have been renamed to [json_traits](./reflect/json_traits.md).
2222
For backwards compatibility, the old name is aliased to the new name.
2323

24-
`json_traits` defaults to the legacy [json_type_traits](json_type_traits/json_type_traits.md) if a type conversion is undefined,
24+
`json_traits` defaults to the legacy [json_type_traits](./legacy_reflect/json_type_traits.md) if a type conversion is undefined,
2525
these traits do not support non-throwing conversions and uses-allocator construction.
2626

2727
See [Eigen::Matrix example](reflect/Eigen-Matrix-example.md) for an example of specializing `json_traits` for an [Eigen matrix class](https://eigen.tuxfamily.org/dox-devel/group__TutorialMatrixClass.html).
@@ -30,10 +30,10 @@ See [User-allocator construction example](reflect/uses-allocator-construction-ex
3030

3131
#### Legacy jsoncons::json_type_traits
3232

33-
[json_type_traits](json_type_traits/json_type_traits.md) defines a compile time template based interface for conversion between a `basic_json` value
33+
[json_type_traits](./legacy_reflect/json_type_traits.md) defines a compile time template based interface for conversion between a `basic_json` value
3434
and a value of some other type.
3535

36-
See [Eigen::Matrix example](json_type_traits/Eigen-Matrix-example.md) for an example of specializing `json_type_traits` for an [Eigen matrix class](https://eigen.tuxfamily.org/dox-devel/group__TutorialMatrixClass.html).
36+
See [Eigen::Matrix example](./legacy_reflect/Eigen-Matrix-example.md) for an example of specializing `json_type_traits` for an [Eigen matrix class](https://eigen.tuxfamily.org/dox-devel/group__TutorialMatrixClass.html).
3737

3838
### Streaming traits
3939

@@ -57,6 +57,6 @@ In the case that the jsoncons decode and encode traits have no specialization fo
5757
### Convenience macros
5858

5959
jsoncons includes some [convenience macros](reflect/reflect-traits-gen.md) for generating reflection traits classes.
60-
Until 1.4.0, these macros generated [json_type_traits](json_type_traits/json_type_traits.md) class templates. Since 1.4.0, they
60+
Until 1.4.0, these macros generated [json_type_traits](./legacy_reflect/json_type_traits.md) class templates. Since 1.4.0, they
6161
generate [json_traits](reflect/json_traits.md) class templates, as well as some additional traits that support streaming.
6262

0 commit comments

Comments
 (0)