MCPcopy Create free account
hub / github.com/boostorg/json / value

Class value

include/boost/json/value.hpp:52–3323  ·  view source on GitHub ↗

The type used to represent any JSON value This is a [Regular](https://en.cppreference.com/w/cpp/concepts/regular) type which works like a variant of the basic JSON data types: array, object, string, number, boolean, and null. @par Thread Safety Distinct instances may be accessed concurrently. Non-const member functions of a shared instance may not be called concurrently w

Source from the content-addressed store, hash-verified

50 other member functions of that instance.
51*/
52class value
53{
54#ifndef BOOST_JSON_DOCS
55 using scalar = detail::scalar;
56
57 union
58 {
59 storage_ptr sp_; // must come first
60 array arr_;
61 object obj_;
62 string str_;
63 scalar sca_;
64 };
65#endif
66
67 struct init_iter;
68
69#ifndef BOOST_JSON_DOCS
70 // VFALCO doc toolchain incorrectly treats this as public
71 friend struct detail::access;
72#endif
73
74 explicit
75 value(
76 detail::unchecked_array&& ua)
77 : arr_(std::move(ua))
78 {
79 }
80
81 explicit
82 value(
83 detail::unchecked_object&& uo)
84 : obj_(std::move(uo))
85 {
86 }
87
88 value(
89 detail::key_t const&,
90 string_view s,
91 storage_ptr sp)
92 : str_(detail::key_t{}, s, std::move(sp))
93 {
94 }
95
96 value(
97 detail::key_t const&,
98 string_view s1,
99 string_view s2,
100 storage_ptr sp)
101 : str_(detail::key_t{}, s1, s2, std::move(sp))
102 {
103 }
104
105 inline bool is_scalar() const noexcept
106 {
107 return sca_.k < json::kind::string;
108 }
109

Callers 1

key_value_pairClass · 0.70

Calls 1

as_stringClass · 0.50

Tested by

no test coverage detected