Lines Matching refs:detail
37 #include <nlohmann/detail/conversions/from_json.hpp>
38 #include <nlohmann/detail/conversions/to_json.hpp>
39 #include <nlohmann/detail/exceptions.hpp>
40 #include <nlohmann/detail/hash.hpp>
41 #include <nlohmann/detail/input/binary_reader.hpp>
42 #include <nlohmann/detail/input/input_adapters.hpp>
43 #include <nlohmann/detail/input/lexer.hpp>
44 #include <nlohmann/detail/input/parser.hpp>
45 #include <nlohmann/detail/iterators/internal_iterator.hpp>
46 #include <nlohmann/detail/iterators/iter_impl.hpp>
47 #include <nlohmann/detail/iterators/iteration_proxy.hpp>
48 #include <nlohmann/detail/iterators/json_reverse_iterator.hpp>
49 #include <nlohmann/detail/iterators/primitive_iterator.hpp>
50 #include <nlohmann/detail/json_pointer.hpp>
51 #include <nlohmann/detail/json_ref.hpp>
52 #include <nlohmann/detail/macro_scope.hpp>
53 #include <nlohmann/detail/string_concat.hpp>
54 #include <nlohmann/detail/string_escape.hpp>
55 #include <nlohmann/detail/meta/cpp_future.hpp>
56 #include <nlohmann/detail/meta/type_traits.hpp>
57 #include <nlohmann/detail/output/binary_writer.hpp>
58 #include <nlohmann/detail/output/output_adapters.hpp>
59 #include <nlohmann/detail/output/serializer.hpp>
60 #include <nlohmann/detail/value_t.hpp>
98 template<detail::value_t> friend struct detail::external_constructor;
106 friend class ::nlohmann::detail::parser;
107 friend ::nlohmann::detail::serializer<basic_json>;
109 friend class ::nlohmann::detail::iter_impl;
111 friend class ::nlohmann::detail::binary_writer;
113 friend class ::nlohmann::detail::binary_reader;
115 friend class ::nlohmann::detail::json_sax_dom_parser;
117 friend class ::nlohmann::detail::json_sax_dom_callback_parser;
118 friend class ::nlohmann::detail::exception;
124 // convenience aliases for types residing in namespace detail;
125 using lexer = ::nlohmann::detail::lexer_base<basic_json>;
128 static ::nlohmann::detail::parser<basic_json, InputAdapterType> parser(
130 detail::parser_callback_t<basic_json>cb = nullptr,
135 return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter),
140 using primitive_iterator_t = ::nlohmann::detail::primitive_iterator_t;
142 using internal_iterator = ::nlohmann::detail::internal_iterator<BasicJsonType>;
144 using iter_impl = ::nlohmann::detail::iter_impl<BasicJsonType>;
146 using iteration_proxy = ::nlohmann::detail::iteration_proxy<Iterator>;
147 template<typename Base> using json_reverse_iterator = ::nlohmann::detail::json_reverse_iterator<Base>;
150 using output_adapter_t = ::nlohmann::detail::output_adapter_t<CharType>;
153 using binary_reader = ::nlohmann::detail::binary_reader<basic_json, InputType>;
154 template<typename CharType> using binary_writer = ::nlohmann::detail::binary_writer<basic_json, CharType>;
157 using serializer = ::nlohmann::detail::serializer<basic_json>;
160 using value_t = detail::value_t;
166 using error_handler_t = detail::error_handler_t;
168 using cbor_tag_handler_t = detail::cbor_tag_handler_t;
170 using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
172 using input_format_t = detail::input_format_t;
184 using exception = detail::exception;
185 using parse_error = detail::parse_error;
186 using invalid_iterator = detail::invalid_iterator;
187 using type_error = detail::type_error;
188 using out_of_range = detail::out_of_range;
189 using other_error = detail::other_error;
254 detail::concat(std::to_string(NLOHMANN_JSON_VERSION_MAJOR), '.',
278 result["compiler"] = {{"family", "gcc"}, {"version", detail::concat(
369 using object_comparator_t = detail::actual_object_comparator_t<basic_json>;
764 if (detail::is_ordered_map<object_t>::value)
788 using parse_event_t = detail::parse_event_t;
792 using parser_callback_t = detail::parser_callback_t<basic_json>;
822 typename U = detail::uncvref_t<CompatibleType>,
823 detail::enable_if_t <
824 !detail::is_basic_json<U>::value && detail::is_compatible_type<basic_json_t, U>::value, int > = 0 >
837 detail::enable_if_t <
838 detail::is_basic_json<BasicJsonType>::value&& !std::is_same<basic_json, BasicJsonType>::value, int > = 0 >
899 [](const detail::json_ref<basic_json>& element_ref)
1115 JSON_THROW(invalid_iterator::create(206, detail::concat("cannot construct with iterators from ", first.m_object->type_name()), first.m_object));
1128 detail::enable_if_t<detail::conjunction<detail::is_json_ref<JsonRef>,
1265 serializer s(detail::output_adapter<char, string_t>(result), indent_char, error_handler);
1399 JSON_THROW(type_error::create(302, detail::concat("type must be boolean, but is ", type_name()), this));
1520 JSON_THROW(type_error::create(303, detail::concat("incompatible ReferenceType for get_ref, actual type is ", obj.type_name()), &obj));
1589 detail::enable_if_t <
1590 detail::is_default_constructible<ValueType>::value&&
1591 detail::has_from_json<basic_json_t, ValueType>::value,
1593 ValueType get_impl(detail::priority_tag<0> /*unused*/) const noexcept(noexcept(
1632 detail::enable_if_t <
1633 detail::has_non_default_from_json<basic_json_t, ValueType>::value,
1635 ValueType get_impl(detail::priority_tag<1> /*unused*/) const noexcept(noexcept(
1657 detail::enable_if_t <
1658 detail::is_basic_json<BasicJsonType>::value,
1660 BasicJsonType get_impl(detail::priority_tag<2> /*unused*/) const
1680 detail::enable_if_t<
1683 basic_json get_impl(detail::priority_tag<3> /*unused*/) const
1693 detail::enable_if_t<
1696 constexpr auto get_impl(detail::priority_tag<4> /*unused*/) const noexcept
1727 template < typename ValueTypeCV, typename ValueType = detail::uncvref_t<ValueTypeCV>>
1732 noexcept(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {})))
1733 -> decltype(std::declval<const basic_json_t&>().template get_impl<ValueType>(detail::priority_tag<4> {}))
1740 return get_impl<ValueType>(detail::priority_tag<4> {});
1781 detail::enable_if_t <
1782 !detail::is_basic_json<ValueType>::value&&
1783 detail::has_from_json<basic_json_t, ValueType>::value,
1795 detail::enable_if_t <
1796 detail::is_basic_json<ValueType>::value,
1807 detail::enable_if_t <
1808 detail::has_from_json<basic_json_t, Array>::value, int > = 0 >
1868 detail::conjunction <
1869 detail::negation<std::is_pointer<ValueType>>,
1870 detail::negation<std::is_same<ValueType, std::nullptr_t>>,
1871 detail::negation<std::is_same<ValueType, detail::json_ref<basic_json>>>,
1872 detail::negation<std::is_same<ValueType, typename string_t::value_type>>,
1873 detail::negation<detail::is_basic_json<ValueType>>,
1874 detail::negation<std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>>,
1876 detail::negation<std::is_same<ValueType, std::string_view>>,
1879 detail::negation<std::is_same<ValueType, std::any>>,
1881 detail::is_detected_lazy<detail::get_template_function, const basic_json_t&, ValueType>
1895 JSON_THROW(type_error::create(302, detail::concat("type must be binary, but is ", type_name()), this));
1907 JSON_THROW(type_error::create(302, detail::concat("type must be binary, but is ", type_name()), this));
1938 JSON_THROW(out_of_range::create(401, detail::concat("array index ", std::to_string(idx), " is out of range"), this));
1943 JSON_THROW(type_error::create(304, detail::concat("cannot use at() with ", type_name()), this));
1961 JSON_THROW(out_of_range::create(401, detail::concat("array index ", std::to_string(idx), " is out of range"), this));
1966 JSON_THROW(type_error::create(304, detail::concat("cannot use at() with ", type_name()), this));
1977 JSON_THROW(type_error::create(304, detail::concat("cannot use at() with ", type_name()), this));
1983 JSON_THROW(out_of_range::create(403, detail::concat("key '", key, "' not found"), this));
1990 template<class KeyType, detail::enable_if_t<
1991 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
1997 JSON_THROW(type_error::create(304, detail::concat("cannot use at() with ", type_name()), this));
2003 JSON_THROW(out_of_range::create(403, detail::concat("key '", string_t(std::forward<KeyType>(key)), "' not found"), this));
2015 JSON_THROW(type_error::create(304, detail::concat("cannot use at() with ", type_name()), this));
2021 JSON_THROW(out_of_range::create(403, detail::concat("key '", key, "' not found"), this));
2028 template<class KeyType, detail::enable_if_t<
2029 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
2035 JSON_THROW(type_error::create(304, detail::concat("cannot use at() with ", type_name()), this));
2041 JSON_THROW(out_of_range::create(403, detail::concat("key '", string_t(std::forward<KeyType>(key)), "' not found"), this));
2089 JSON_THROW(type_error::create(305, detail::concat("cannot use operator[] with a numeric argument with ", type_name()), this));
2102 JSON_THROW(type_error::create(305, detail::concat("cannot use operator[] with a numeric argument with ", type_name()), this));
2124 JSON_THROW(type_error::create(305, detail::concat("cannot use operator[] with a string argument with ", type_name()), this));
2139 JSON_THROW(type_error::create(305, detail::concat("cannot use operator[] with a string argument with ", type_name()), this));
2158 template<class KeyType, detail::enable_if_t<
2159 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int > = 0 >
2177 JSON_THROW(type_error::create(305, detail::concat("cannot use operator[] with a string argument with ", type_name()), this));
2182 template<class KeyType, detail::enable_if_t<
2183 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int > = 0 >
2194 JSON_THROW(type_error::create(305, detail::concat("cannot use operator[] with a string argument with ", type_name()), this));
2199 using is_comparable_with_object_key = detail::is_comparable <
2204 detail::is_c_string_uncvref<ValueType>::value,
2210 template < class ValueType, detail::enable_if_t <
2211 !detail::is_transparent<object_comparator_t>::value
2212 && detail::is_getable<basic_json_t, ValueType>::value
2213 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >
2229 JSON_THROW(type_error::create(306, detail::concat("cannot use value() with ", type_name()), this));
2235 detail::enable_if_t <
2236 !detail::is_transparent<object_comparator_t>::value
2237 && detail::is_getable<basic_json_t, ReturnType>::value
2238 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >
2254 JSON_THROW(type_error::create(306, detail::concat("cannot use value() with ", type_name()), this));
2259 template < class ValueType, class KeyType, detail::enable_if_t <
2260 detail::is_transparent<object_comparator_t>::value
2261 && !detail::is_json_pointer<KeyType>::value
2263 && detail::is_getable<basic_json_t, ValueType>::value
2264 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >
2280 JSON_THROW(type_error::create(306, detail::concat("cannot use value() with ", type_name()), this));
2286 detail::enable_if_t <
2287 detail::is_transparent<object_comparator_t>::value
2288 && !detail::is_json_pointer<KeyType>::value
2290 && detail::is_getable<basic_json_t, ReturnType>::value
2291 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >
2307 JSON_THROW(type_error::create(306, detail::concat("cannot use value() with ", type_name()), this));
2312 template < class ValueType, detail::enable_if_t <
2313 detail::is_getable<basic_json_t, ValueType>::value
2314 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >
2331 JSON_THROW(type_error::create(306, detail::concat("cannot use value() with ", type_name()), this));
2337 detail::enable_if_t <
2338 detail::is_getable<basic_json_t, ReturnType>::value
2339 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >
2356 JSON_THROW(type_error::create(306, detail::concat("cannot use value() with ", type_name()), this));
2359 template < class ValueType, class BasicJsonType, detail::enable_if_t <
2360 detail::is_basic_json<BasicJsonType>::value
2361 && detail::is_getable<basic_json_t, ValueType>::value
2362 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >
2370 detail::enable_if_t <
2371 detail::is_basic_json<BasicJsonType>::value
2372 && detail::is_getable<basic_json_t, ReturnType>::value
2373 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >
2414 template < class IteratorType, detail::enable_if_t <
2476 JSON_THROW(type_error::create(307, detail::concat("cannot use erase() with ", type_name()), this));
2484 template < class IteratorType, detail::enable_if_t <
2549 JSON_THROW(type_error::create(307, detail::concat("cannot use erase() with ", type_name()), this));
2556 template < typename KeyType, detail::enable_if_t <
2557 detail::has_erase_with_key_type<basic_json_t, KeyType>::value, int > = 0 >
2563 JSON_THROW(type_error::create(307, detail::concat("cannot use erase() with ", type_name()), this));
2569 template < typename KeyType, detail::enable_if_t <
2570 !detail::has_erase_with_key_type<basic_json_t, KeyType>::value, int > = 0 >
2576 JSON_THROW(type_error::create(307, detail::concat("cannot use erase() with ", type_name()), this));
2601 template<class KeyType, detail::enable_if_t<
2602 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
2617 JSON_THROW(out_of_range::create(401, detail::concat("array index ", std::to_string(idx), " is out of range"), this));
2624 JSON_THROW(type_error::create(307, detail::concat("cannot use erase() with ", type_name()), this));
2668 template<class KeyType, detail::enable_if_t<
2669 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
2684 template<class KeyType, detail::enable_if_t<
2685 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
2708 template<class KeyType, detail::enable_if_t<
2709 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
2725 template<class KeyType, detail::enable_if_t<
2726 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
2739 template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value, int> = 0>
3085 JSON_THROW(type_error::create(308, detail::concat("cannot use push_back() with ", type_name()), this));
3118 JSON_THROW(type_error::create(308, detail::concat("cannot use push_back() with ", type_name()), this));
3150 JSON_THROW(type_error::create(308, detail::concat("cannot use push_back() with ", type_name()), this));
3206 JSON_THROW(type_error::create(311, detail::concat("cannot use emplace_back() with ", type_name()), this));
3231 JSON_THROW(type_error::create(311, detail::concat("cannot use emplace() with ", type_name()), this));
3292 JSON_THROW(type_error::create(309, detail::concat("cannot use insert() with ", type_name()), this));
3319 JSON_THROW(type_error::create(309, detail::concat("cannot use insert() with ", type_name()), this));
3329 JSON_THROW(type_error::create(309, detail::concat("cannot use insert() with ", type_name()), this));
3360 JSON_THROW(type_error::create(309, detail::concat("cannot use insert() with ", type_name()), this));
3380 JSON_THROW(type_error::create(309, detail::concat("cannot use insert() with ", type_name()), this));
3419 JSON_THROW(type_error::create(312, detail::concat("cannot use update() with ", type_name()), this));
3431 JSON_THROW(type_error::create(312, detail::concat("cannot use update() with ", first.m_object->type_name()), first.m_object));
3493 JSON_THROW(type_error::create(310, detail::concat("cannot use swap(array_t&) with ", type_name()), this));
3509 JSON_THROW(type_error::create(310, detail::concat("cannot use swap(object_t&) with ", type_name()), this));
3525 JSON_THROW(type_error::create(310, detail::concat("cannot use swap(string_t&) with ", type_name()), this));
3541 JSON_THROW(type_error::create(310, detail::concat("cannot use swap(binary_t&) with ", type_name()), this));
3557 JSON_THROW(type_error::create(310, detail::concat("cannot use swap(binary_t::container_type&) with ", type_name()), this));
3977 serializer s(detail::output_adapter<char>(o), o.fill());
4014 parser(detail::input_adapter(std::forward<InputType>(i)), cb, allow_exceptions, ignore_comments).parse(true, result);
4029 parser(detail::input_adapter(std::move(first), std::move(last)), cb, allow_exceptions, ignore_comments).parse(true, result);
4035 static basic_json parse(detail::span_input_adapter&& i,
4051 return parser(detail::input_adapter(std::forward<InputType>(i)), nullptr, false, ignore_comments).accept(true);
4060 return parser(detail::input_adapter(std::move(first), std::move(last)), nullptr, false, ignore_comments).accept(true);
4065 static bool accept(detail::span_input_adapter&& i,
4080 auto ia = detail::input_adapter(std::forward<InputType>(i));
4083 : detail::binary_reader<basic_json, decltype(ia), SAX>(std::move(ia), format).sax_parse(format, sax, strict);
4095 auto ia = detail::input_adapter(std::move(first), std::move(last));
4098 : detail::binary_reader<basic_json, decltype(ia), SAX>(std::move(ia), format).sax_parse(format, sax, strict);
4109 static bool sax_parse(detail::span_input_adapter&& i, SAX* sax,
4119 : detail::binary_reader<basic_json, decltype(ia), SAX>(std::move(ia), format).sax_parse(format, sax, strict);
4138 parser(detail::input_adapter(i)).parse(false, j);
4213 static void to_cbor(const basic_json& j, detail::output_adapter<std::uint8_t> o)
4220 static void to_cbor(const basic_json& j, detail::output_adapter<char> o)
4236 static void to_msgpack(const basic_json& j, detail::output_adapter<std::uint8_t> o)
4243 static void to_msgpack(const basic_json& j, detail::output_adapter<char> o)
4261 static void to_ubjson(const basic_json& j, detail::output_adapter<std::uint8_t> o,
4269 static void to_ubjson(const basic_json& j, detail::output_adapter<char> o,
4288 static void to_bjdata(const basic_json& j, detail::output_adapter<std::uint8_t> o,
4296 static void to_bjdata(const basic_json& j, detail::output_adapter<char> o,
4313 static void to_bson(const basic_json& j, detail::output_adapter<std::uint8_t> o)
4320 static void to_bson(const basic_json& j, detail::output_adapter<char> o)
4335 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4336 auto ia = detail::input_adapter(std::forward<InputType>(i));
4351 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4352 auto ia = detail::input_adapter(std::move(first), std::move(last));
4371 static basic_json from_cbor(detail::span_input_adapter&& i,
4377 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4393 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4394 auto ia = detail::input_adapter(std::forward<InputType>(i));
4408 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4409 auto ia = detail::input_adapter(std::move(first), std::move(last));
4426 static basic_json from_msgpack(detail::span_input_adapter&& i,
4431 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4447 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4448 auto ia = detail::input_adapter(std::forward<InputType>(i));
4462 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4463 auto ia = detail::input_adapter(std::move(first), std::move(last));
4480 static basic_json from_ubjson(detail::span_input_adapter&& i,
4485 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4502 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4503 auto ia = detail::input_adapter(std::forward<InputType>(i));
4517 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4518 auto ia = detail::input_adapter(std::move(first), std::move(last));
4532 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4533 auto ia = detail::input_adapter(std::forward<InputType>(i));
4547 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4548 auto ia = detail::input_adapter(std::move(first), std::move(last));
4565 static basic_json from_bson(detail::span_input_adapter&& i,
4570 detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
4592 template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value, int> = 0>
4606 template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value, int> = 0>
4620 template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value, int> = 0>
4634 template<typename BasicJsonType, detail::enable_if_t<detail::is_basic_json<BasicJsonType>::value, int> = 0>
4750 JSON_THROW(out_of_range::create(401, detail::concat("array index ", std::to_string(idx), " is out of range"), &parent));
4791 JSON_THROW(out_of_range::create(403, detail::concat("key '", last_path, "' not found"), this));
4819 const auto error_msg = (op == "op") ? "operation" : detail::concat("operation '", op, '\'');
4825 JSON_THROW(parse_error::create(105, 0, detail::concat(error_msg, " must have member '", member, "'"), &val));
4832 JSON_THROW(parse_error::create(105, 0, detail::concat(error_msg, " must have string member '", member, "'"), &val));
4920 JSON_THROW(other_error::create(501, detail::concat("unsuccessful: ", val.dump()), &val));
4931 JSON_THROW(parse_error::create(105, 0, detail::concat("operation value '", op, "' is invalid"), &val));
4980 auto temp_diff = diff(source[i], target[i], detail::concat(path, '/', std::to_string(i)));
4997 {"path", detail::concat(path, '/', std::to_string(i))}
5008 {"path", detail::concat(path, "/-")},
5023 const auto path_key = detail::concat(path, '/', detail::escape(it.key()));
5047 const auto path_key = detail::concat(path, '/', detail::escape(it.key()));
5167 return nlohmann::detail::hash(j);
5173 struct less< ::nlohmann::detail::value_t> // do not remove the space after '<', see https://github.com/nlohmann/json/pull/679
5179 bool operator()(::nlohmann::detail::value_t lhs,
5180 ::nlohmann::detail::value_t rhs) const noexcept
5185 return ::nlohmann::detail::operator<(lhs, rhs);
5212 #include <nlohmann/detail/macro_unscope.hpp>