Skip to content

Commit 1990a18

Browse files
committed
json_view -> json_ref
1 parent fff5fe6 commit 1990a18

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
// See https://github.com/danielaparker/jsoncons for latest version
66

7-
#ifndef JSONCONS_JSON_VIEW_HPP
8-
#define JSONCONS_JSON_VIEW_HPP
7+
#ifndef JSONCONS_JSON_REF_HPP
8+
#define JSONCONS_JSON_REF_HPP
99

1010
#include <functional> // std::reference_wrapper
1111
#include <type_traits> // std::remove_const
@@ -18,14 +18,14 @@ namespace jsoncons {
1818
enum class json_view_storage_kind : uint8_t {json_ref,array,object};
1919

2020
template <typename Json,typename Allocator=std::allocator<char>>
21-
class json_view
21+
class json_ref
2222
{
2323
using allocator_type = Allocator;
2424
using json_type = typename std::remove_const<Json>::type;
2525
using key_type = typename json_type::key_type;
2626
using policy_type = typename json_type::policy_type;
27-
using array = typename policy_type::template array<json_view>;
28-
using object = typename policy_type::template object<key_type,json_view>;
27+
using array = typename policy_type::template array<json_ref>;
28+
using object = typename policy_type::template object<key_type,json_ref>;
2929

3030
struct common_storage
3131
{
@@ -99,13 +99,13 @@ class json_view
9999
object_storage object_;
100100
};
101101
public:
102-
json_view(Json& j)
102+
json_ref(Json& j)
103103
{
104104
common_.storage_kind_ = json_view_storage_kind::json_ref;
105105
json_ref_ = json_ref_storage{j};
106106
}
107107

108-
json_view(const json_view<Json>& jv)
108+
json_ref(const json_ref<Json>& jv)
109109
{
110110
common_.storage_kind_ = jv.common_.storage_kind_;
111111
switch (jv.common_.storage_kind_)
@@ -133,4 +133,4 @@ class json_view
133133

134134
} // namespace jsoncons
135135

136-
#endif // JSONCONS_JSON_VIEW_HPP
136+
#endif // JSONCONS_JSON_REF_HPP

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ add_executable(unit_tests
116116
#corelib/src/json_storage_tests.cpp
117117
#corelib/src/json_swap_tests.cpp
118118
#corelib/src/json_uses_allocator_tests.cpp
119-
corelib/src/json_view_tests.cpp
119+
corelib/src/json_ref_tests.cpp
120120
#corelib/src/jsoncons_tests.cpp
121121
#corelib/src/JSONTestSuite_tests.cpp
122122
#corelib/src/legacy_json_type_traits_tests.cpp
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
// Copyright 2013-2026 Daniel Parker
22
// Distributed under Boost license
33

4-
#include <jsoncons/json_view.hpp>
4+
#include <jsoncons/json_ref.hpp>
55
#include <jsoncons/basic_json.hpp>
66

77
#include <catch/catch.hpp>
88

9-
TEST_CASE("json_view constructor tests")
9+
TEST_CASE("json_ref constructor tests")
1010
{
1111
SECTION("ref")
1212
{
1313
jsoncons::json j{100};
14-
jsoncons::json_view<jsoncons::json> jv{j};
14+
jsoncons::json_ref<jsoncons::json> jv{j};
1515
CHECK(jv.is<int>());
16-
jsoncons::json_view<jsoncons::json> jv2{jv};
16+
jsoncons::json_ref<jsoncons::json> jv2{jv};
1717
CHECK(jv2.is<int>());
1818
}
1919
SECTION("const ref")
2020
{
2121
jsoncons::json j{100};
22-
jsoncons::json_view<const jsoncons::json> jv{j};
22+
jsoncons::json_ref<const jsoncons::json> jv{j};
2323
CHECK(jv.is<int>());
24-
jsoncons::json_view<const jsoncons::json> jv2{jv};
24+
jsoncons::json_ref<const jsoncons::json> jv2{jv};
2525
CHECK(jv2.is<int>());
2626
}
2727
}

0 commit comments

Comments
 (0)