Skip to content

Commit 9e09af1

Browse files
committed
order_preserving_policy -> ordered_policy
1 parent c7fa428 commit 9e09af1

7 files changed

Lines changed: 23 additions & 18 deletions

File tree

doc/ref/corelib/basic_json.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ namespace pmr {
1313
template <typename CharT,typename Policy>
1414
using basic_json = jsoncons::basic_json<CharT, Policy, std::pmr::polymorphic_allocator<char>>;
1515
using json = basic_json<char,sorted_policy>; (since 0.171.0)
16-
using wjson = basic_json<wchar_t,sorted_policy>;
17-
using ojson = basic_json<char, order_preserving_policy>;
18-
using wojson = basic_json<wchar_t, order_preserving_policy>;
16+
using wjson = basic_json<wchar_t, sorted_policy>;
17+
using ojson = basic_json<char, ordered_policy>;
18+
using wojson = basic_json<wchar_t, ordered_policy>;
1919
}
2020
```
2121
@@ -44,13 +44,13 @@ Several aliases for common character types and policies for ordering an object's
4444
Type |Definition
4545
--------------------|------------------------------
4646
[jsoncons::json](json.md) |`jsoncons::basic_json<char,jsoncons::sorted_policy,std::allocator<char>>`
47-
[jsoncons::ojson](ojson.md) |`jsoncons::basic_json<char,jsoncons::order_preserving_policy,std::allocator<char>>`
47+
[jsoncons::ojson](ojson.md) |`jsoncons::basic_json<char,jsoncons::ordered_policy,std::allocator<char>>`
4848
[jsoncons::wjson](wjson.md) |`jsoncons::basic_json<wchar_t,jsoncons::jsoncons::sorted_policy,std::allocator<char>>`
49-
[jsoncons::wojson](wojson.md) |`jsoncons::basic_json<wchar_t,jsoncons::order_preserving_policy,std::allocator<char>>`
49+
[jsoncons::wojson](wojson.md) |`jsoncons::basic_json<wchar_t,jsoncons::ordered_policy,std::allocator<char>>`
5050
`jsoncons::pmr::json` (0.171.0) |`jsoncons::pmr::basic_json<char,jsoncons::sorted_policy>`
51-
`jsoncons::pmr::ojson` (0.171.0) |`jsoncons::pmr::basic_json<char,jsoncons::order_preserving_policy>`
51+
`jsoncons::pmr::ojson` (0.171.0) |`jsoncons::pmr::basic_json<char,jsoncons::ordered_policy>`
5252
`jsoncons::pmr::wjson` (0.171.0) |`jsoncons::pmr::basic_json<wchar_t,jsoncons::sorted_policy>`
53-
`jsoncons::pmr::wojson` (0.171.0) |`jsoncons::pmr::basic_json<wchar_t,jsoncons::order_preserving_policy>`
53+
`jsoncons::pmr::wojson` (0.171.0) |`jsoncons::pmr::basic_json<wchar_t,jsoncons::ordered_policy>`
5454
5555
#### Template parameters
5656

doc/ref/corelib/ojson.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <jsoncons/json.hpp>
55

66
typedef basic_json<char,
7-
Policy = order_preserving_policy,
7+
Policy = ordered_policy,
88
Allocator = std::allocator<char>> ojson
99
```
1010
The `ojson` class is an instantiation of the [basic_json](basic_json.md) class template that uses `char` as the character type. The original insertion order of an object's name/value pairs is preserved.

doc/ref/corelib/wojson.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <jsoncons/json.hpp>
55

66
typedef basic_json<wchar_t,
7-
Policy = order_preserving_policy,
7+
Policy = ordered_policy,
88
Allocator = std::allocator<wchar_t>> wojson
99
```
1010
The `wojson` class is an instantiation of the [basic_json](basic_json.md) class template that uses `wchar_t` as the character type. The original insertion order of an object's name/value pairs is preserved.

include/jsoncons/basic_json.hpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ namespace jsoncons {
269269
using member_key = std::basic_string<CharT, CharTraits, Allocator>;
270270
};
271271

272-
struct order_preserving_policy
272+
struct ordered_policy
273273
{
274274
template <typename KeyT,typename Json>
275275
using object = ordered_json_object<KeyT,Json,std::vector>;
@@ -281,6 +281,11 @@ namespace jsoncons {
281281
using member_key = std::basic_string<CharT, CharTraits, Allocator>;
282282
};
283283

284+
285+
#if !defined(JSONCONS_NO_DEPRECATED)
286+
using order_preserving_policy = ordered_policy;
287+
#endif
288+
284289
template <typename Policy,typename KeyT,typename Json,typename Enable=void>
285290
struct object_iterator_typedefs
286291
{
@@ -5154,8 +5159,8 @@ namespace jsoncons {
51545159

51555160
using json = basic_json<char,sorted_policy,std::allocator<char>>;
51565161
using wjson = basic_json<wchar_t,sorted_policy,std::allocator<char>>;
5157-
using ojson = basic_json<char, order_preserving_policy, std::allocator<char>>;
5158-
using wojson = basic_json<wchar_t, order_preserving_policy, std::allocator<char>>;
5162+
using ojson = basic_json<char, ordered_policy, std::allocator<char>>;
5163+
using wojson = basic_json<wchar_t, ordered_policy, std::allocator<char>>;
51595164

51605165
inline namespace literals {
51615166

@@ -5191,8 +5196,8 @@ namespace jsoncons {
51915196
using basic_json = jsoncons::basic_json<CharT, Policy, std::pmr::polymorphic_allocator<char>>;
51925197
using json = basic_json<char,sorted_policy>;
51935198
using wjson = basic_json<wchar_t,sorted_policy>;
5194-
using ojson = basic_json<char, order_preserving_policy>;
5195-
using wojson = basic_json<wchar_t, order_preserving_policy>;
5199+
using ojson = basic_json<char, ordered_policy>;
5200+
using wojson = basic_json<wchar_t, ordered_policy>;
51965201
} // namespace pmr
51975202
#endif
51985203

include/jsoncons/reflect/encode_traits.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct encode_traits
3939
const T& val,
4040
basic_json_visitor<CharT>& encoder)
4141
{
42-
auto j = json_conv_traits<basic_json<CharT,order_preserving_policy,TempAlloc>,T>::to_json(
42+
auto j = json_conv_traits<basic_json<CharT,ordered_policy,TempAlloc>,T>::to_json(
4343
make_alloc_set(aset.get_temp_allocator(), aset.get_temp_allocator()), val);
4444
return j.try_dump(encoder);
4545
}

test/corelib/src/json_constructor_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ TEST_CASE("json constructor with scoped_allocator")
214214
{
215215
using cust_allocator = std::scoped_allocator_adaptor<mock_stateful_allocator<char>>;
216216
using cust_json = basic_json<char,sorted_policy,cust_allocator>;
217-
//using cust_ojson = basic_json<char,order_preserving_policy,cust_allocator>;
217+
//using cust_ojson = basic_json<char,ordered_policy,cust_allocator>;
218218

219219
cust_allocator alloc1(1);
220220
cust_allocator alloc2(2);

test/corelib/src/ojson_object_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,9 @@ TEST_CASE("test_ojson_merge_or_update_move")
446446
template <typename T>
447447
using MyScopedAllocator = std::scoped_allocator_adaptor<mock_stateful_allocator<T>>;
448448

449-
using cust_json = jsoncons::basic_json<char, jsoncons::order_preserving_policy, MyScopedAllocator<char>>;
449+
using cust_json = jsoncons::basic_json<char, jsoncons::ordered_policy, MyScopedAllocator<char>>;
450450

451-
TEST_CASE("cust_json.merge test with order_preserving_policy and statefule allocator")
451+
TEST_CASE("cust_json.merge test with ordered_policy and statefule allocator")
452452
{
453453
MyScopedAllocator<char> alloc(1);
454454

0 commit comments

Comments
 (0)