Lines Matching defs:value

311     // JSON value data types //
314 /// @name JSON value data types
315 /// The data types to store a JSON value. These types are derived from
394 // JSON value storage //
399 @brief a JSON value
401 The actual storage for a JSON value of the @ref basic_json class. This
402 union combines the different storage types for the JSON value types
415 null | null | *no value is stored*
419 value types are used.
525 json_value(const string_t& value) : string(create<string_t>(value)) {}
528 json_value(string_t&& value) : string(create<string_t>(std::move(value))) {}
531 json_value(const object_t& value) : object(create<object_t>(value)) {}
534 json_value(object_t&& value) : object(create<object_t>(std::move(value))) {}
537 json_value(const array_t& value) : array(create<array_t>(value)) {}
540 json_value(array_t&& value) : array(create<array_t>(std::move(value))) {}
543 json_value(const typename binary_t::container_type& value) : binary(create<binary_t>(value)) {}
546 json_value(typename binary_t::container_type&& value) : binary(create<binary_t>(std::move(value))) {}
549 json_value(const binary_t& value) : binary(create<binary_t>(value)) {}
552 json_value(binary_t&& value) : binary(create<binary_t>(std::move(value))) {}
660 value is changed, because the invariant expresses a relationship between
664 @a check_parents true and the value is an array or object, then the
665 container's elements must have the current value as parent.
668 The value is true by default and should only be set to false
764 if (detail::is_ordered_map<object_t>::value)
803 /// @brief create an empty value with a given type
819 /// @brief create a JSON value from compatible types
824 !detail::is_basic_json<U>::value && detail::is_compatible_type<basic_json_t, U>::value, int > = 0 >
834 /// @brief create a JSON value from an existing one
838 detail::is_basic_json<BasicJsonType>::value&& !std::is_same<basic_json, BasicJsonType>::value, int > = 0 >
1005 /// @brief construct an array with count copies of given value
1018 std::is_same<InputIT, typename basic_json_t::iterator>::value ||
1019 std::is_same<InputIT, typename basic_json_t::const_iterator>::value, int >::type = 0 >
1025 // make sure iterator fits the current value
1129 std::is_same<typename JsonRef::value_type, basic_json>>::value, int> = 0 >
1137 // check of passed value is valid
1206 // check that passed value is valid
1220 std::is_nothrow_move_constructible<value_t>::value&&
1221 std::is_nothrow_move_assignable<value_t>::value&&
1222 std::is_nothrow_move_constructible<json_value>::value&&
1223 std::is_nothrow_move_assignable<json_value>::value
1226 // check that passed value is valid
1254 /// Functions to inspect the type of a JSON value.
1279 /// @brief return the type of the JSON value (explicit)
1300 /// @brief return whether value is null
1307 /// @brief return whether value is a boolean
1314 /// @brief return whether value is a number
1321 /// @brief return whether value is an integer number
1328 /// @brief return whether value is an unsigned integer number
1335 /// @brief return whether value is a floating-point number
1342 /// @brief return whether value is an object
1349 /// @brief return whether value is an array
1356 /// @brief return whether value is a string
1363 /// @brief return whether value is a binary array
1370 /// @brief return whether value is discarded
1377 /// @brief return the type of the JSON value (implicit)
1388 // value access //
1402 /// get a pointer to the value (object)
1408 /// get a pointer to the value (object)
1414 /// get a pointer to the value (array)
1420 /// get a pointer to the value (array)
1426 /// get a pointer to the value (string)
1432 /// get a pointer to the value (string)
1438 /// get a pointer to the value (boolean)
1444 /// get a pointer to the value (boolean)
1450 /// get a pointer to the value (integer number)
1456 /// get a pointer to the value (integer number)
1462 /// get a pointer to the value (unsigned number)
1468 /// get a pointer to the value (unsigned number)
1474 /// get a pointer to the value (floating-point number)
1480 /// get a pointer to the value (floating-point number)
1486 /// get a pointer to the value (binary)
1492 /// get a pointer to the value (binary)
1506 @throw type_error.303 if ReferenceType does not match underlying value
1524 /// @name value access
1525 /// Direct access to the stored value of a JSON value.
1528 /// @brief get a pointer value (implicit)
1531 std::is_pointer<PointerType>::value, int>::type = 0>
1538 /// @brief get a pointer value (implicit)
1541 std::is_pointer<PointerType>::value&&
1542 std::is_const<typename std::remove_pointer<PointerType>::type>::value, int >::type = 0 >
1551 @brief get a value (explicit)
1553 Explicit type conversion between the JSON value and a compatible value
1556 The value is converted by calling the @ref json_serializer<ValueType>
1573 @tparam ValueType the returned value type
1575 @return copy of the JSON value, converted to @a ValueType
1590 detail::is_default_constructible<ValueType>::value&&
1591 detail::has_from_json<basic_json_t, ValueType>::value,
1602 @brief get a value (explicit); special case
1604 Explicit type conversion between the JSON value and a compatible value
1607 The value is converted by calling the @ref json_serializer<ValueType>
1623 @tparam ValueType the returned value type
1625 @return copy of the JSON value, converted to @a ValueType
1633 detail::has_non_default_from_json<basic_json_t, ValueType>::value,
1658 detail::is_basic_json<BasicJsonType>::value,
1681 std::is_same<BasicJsonType, basic_json_t>::value,
1689 @brief get a pointer value (explicit)
1694 std::is_pointer<PointerType>::value,
1705 @brief get a (pointer) value (explicit)
1707 Performs explicit type conversion between the JSON value and a compatible value if required.
1709 - If the requested type is a pointer to the internally stored JSON value that pointer is returned.
1715 - Otherwise the value is converted by calling the @ref json_serializer<ValueType> `from_json()`
1718 @tparam ValueTypeCV the provided value type
1719 @tparam ValueType the returned value type
1721 @return copy of the JSON value, converted to @tparam ValueType if necessary
1738 static_assert(!std::is_reference<ValueTypeCV>::value,
1744 @brief get a pointer value (explicit)
1746 Explicit pointer access to the internally stored JSON value. No copies are
1756 @return pointer to the internally stored JSON value if the requested
1757 pointer type @a PointerType fits to the JSON value; `nullptr` otherwise
1762 JSON value can be requested. Note that no type conversions are made and a
1763 `nullptr` is returned if the value and the requested pointer type does not
1771 std::is_pointer<PointerType>::value, int>::type = 0>
1778 /// @brief get a value (explicit)
1782 !detail::is_basic_json<ValueType>::value&&
1783 detail::has_from_json<basic_json_t, ValueType>::value,
1792 // specialization to allow calling get_to with a basic_json value
1796 detail::is_basic_json<ValueType>::value,
1808 detail::has_from_json<basic_json_t, Array>::value, int > = 0 >
1817 /// @brief get a reference value (implicit)
1820 std::is_reference<ReferenceType>::value, int>::type = 0>
1827 /// @brief get a reference value (implicit)
1830 std::is_reference<ReferenceType>::value&&
1831 std::is_const<typename std::remove_reference<ReferenceType>::type>::value, int >::type = 0 >
1839 @brief get a value (implicit)
1841 Implicit type conversion between the JSON value and a compatible value.
1844 @tparam ValueType non-pointer type compatible to the JSON value, for
1850 @return copy of the JSON value, converted to type @a ValueType
1853 to the JSON value type (e.g., the JSON value is of type boolean, but a
1856 @complexity Linear in the size of the JSON value.
1882 >::value, int >::type = 0 >
1889 /// @brief get a binary value
1901 /// @brief get a binary value
1921 /// Access to the JSON value.
1991 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
2029 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
2050 // implicitly convert null value to an empty array
2109 // implicitly convert null value to an empty object
2159 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int > = 0 >
2162 // implicitly convert null value to an empty object
2183 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int > = 0 >
2204 detail::is_c_string_uncvref<ValueType>::value,
2208 /// @brief access specified object element with default value
2209 /// @sa https://json.nlohmann.me/api/basic_json/value/
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 >
2214 ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const
2216 // value only works for objects
2219 // if key is found, return value and given default value otherwise
2229 JSON_THROW(type_error::create(306, detail::concat("cannot use value() with ", type_name()), this));
2232 /// @brief access specified object element with default value
2233 /// @sa https://json.nlohmann.me/api/basic_json/value/
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 >
2239 ReturnType value(const typename object_t::key_type& key, ValueType && default_value) const
2241 // value only works for objects
2244 // if key is found, return value and given default value otherwise
2254 JSON_THROW(type_error::create(306, detail::concat("cannot use value() with ", type_name()), this));
2257 /// @brief access specified object element with default value
2258 /// @sa https://json.nlohmann.me/api/basic_json/value/
2260 detail::is_transparent<object_comparator_t>::value
2261 && !detail::is_json_pointer<KeyType>::value
2262 && is_comparable_with_object_key<KeyType>::value
2263 && detail::is_getable<basic_json_t, ValueType>::value
2264 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >
2265 ValueType value(KeyType && key, const ValueType& default_value) const
2267 // value only works for objects
2270 // if key is found, return value and given default value otherwise
2280 JSON_THROW(type_error::create(306, detail::concat("cannot use value() with ", type_name()), this));
2283 /// @brief access specified object element via JSON Pointer with default value
2284 /// @sa https://json.nlohmann.me/api/basic_json/value/
2287 detail::is_transparent<object_comparator_t>::value
2288 && !detail::is_json_pointer<KeyType>::value
2289 && is_comparable_with_object_key<KeyType>::value
2290 && detail::is_getable<basic_json_t, ReturnType>::value
2291 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >
2292 ReturnType value(KeyType && key, ValueType && default_value) const
2294 // value only works for objects
2297 // if key is found, return value and given default value otherwise
2307 JSON_THROW(type_error::create(306, detail::concat("cannot use value() with ", type_name()), this));
2310 /// @brief access specified object element via JSON Pointer with default value
2311 /// @sa https://json.nlohmann.me/api/basic_json/value/
2313 detail::is_getable<basic_json_t, ValueType>::value
2314 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >
2315 ValueType value(const json_pointer& ptr, const ValueType& default_value) const
2317 // value only works for objects
2320 // if pointer resolves a value, return it or use default value
2331 JSON_THROW(type_error::create(306, detail::concat("cannot use value() with ", type_name()), this));
2334 /// @brief access specified object element via JSON Pointer with default value
2335 /// @sa https://json.nlohmann.me/api/basic_json/value/
2338 detail::is_getable<basic_json_t, ReturnType>::value
2339 && !std::is_same<value_t, detail::uncvref_t<ValueType>>::value, int > = 0 >
2340 ReturnType value(const json_pointer& ptr, ValueType && default_value) const
2342 // value only works for objects
2345 // if pointer resolves a value, return it or use default value
2356 JSON_THROW(type_error::create(306, detail::concat("cannot use value() with ", type_name()), this));
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 >
2364 ValueType value(const ::nlohmann::json_pointer<BasicJsonType>& ptr, const ValueType& default_value) const
2366 return value(ptr.convert(), default_value);
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 >
2375 ReturnType value(const ::nlohmann::json_pointer<BasicJsonType>& ptr, ValueType && default_value) const
2377 return value(ptr.convert(), std::forward<ValueType>(default_value));
2415 std::is_same<IteratorType, typename basic_json_t::iterator>::value ||
2416 std::is_same<IteratorType, typename basic_json_t::const_iterator>::value, int > = 0 >
2419 // make sure iterator fits the current value
2422 JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value", this));
2485 std::is_same<IteratorType, typename basic_json_t::iterator>::value ||
2486 std::is_same<IteratorType, typename basic_json_t::const_iterator>::value, int > = 0 >
2489 // make sure iterator fits the current value
2492 JSON_THROW(invalid_iterator::create(203, "iterators do not fit current value", this));
2557 detail::has_erase_with_key_type<basic_json_t, KeyType>::value, int > = 0 >
2570 !detail::has_erase_with_key_type<basic_json_t, KeyType>::value, int > = 0 >
2602 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
2669 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
2685 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
2709 detail::is_usable_as_basic_json_key_type<basic_json_t, KeyType>::value, int> = 0>
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>
3269 // but the return value of insert is missing in GCC 4.8, so it is written this way instead.
3282 // check if iterator pos fits to this JSON value
3285 JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value", this));
3309 // check if iterator pos fits to this JSON value
3312 JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value", this));
3332 // check if iterator pos fits to this JSON value
3335 JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value", this));
3363 // check if iterator pos fits to this JSON value
3366 JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value", this));
3409 // implicitly convert null value to an empty object
3436 if (merge_objects && it.value().is_object())
3441 it2->second.update(it.value(), true);
3445 m_value.object->operator[](it.key()) = it.value();
3455 std::is_nothrow_move_constructible<value_t>::value&&
3456 std::is_nothrow_move_assignable<value_t>::value&&
3457 std::is_nothrow_move_constructible<json_value>::value&&
3458 std::is_nothrow_move_assignable<json_value>::value
3472 std::is_nothrow_move_constructible<value_t>::value&&
3473 std::is_nothrow_move_assignable<value_t>::value&&
3474 std::is_nothrow_move_constructible<json_value>::value&&
3475 std::is_nothrow_move_assignable<json_value>::value
3793 std::is_scalar<ScalarType>::value, int>::type = 0>
3802 std::is_scalar<ScalarType>::value, int>::type = 0>
3822 std::is_scalar<ScalarType>::value, int>::type = 0>
3831 std::is_scalar<ScalarType>::value, int>::type = 0>
3850 std::is_scalar<ScalarType>::value, int>::type = 0>
3859 std::is_scalar<ScalarType>::value, int>::type = 0>
3879 std::is_scalar<ScalarType>::value, int>::type = 0>
3888 std::is_scalar<ScalarType>::value, int>::type = 0>
3909 std::is_scalar<ScalarType>::value, int>::type = 0>
3918 std::is_scalar<ScalarType>::value, int>::type = 0>
3938 std::is_scalar<ScalarType>::value, int>::type = 0>
3947 std::is_scalar<ScalarType>::value, int>::type = 0>
4186 /// the value of the current element
4190 /// a pointer to a parent value (for debugging purposes)
4202 /// @brief create a CBOR serialization of a given JSON value
4211 /// @brief create a CBOR serialization of a given JSON value
4218 /// @brief create a CBOR serialization of a given JSON value
4225 /// @brief create a MessagePack serialization of a given JSON value
4234 /// @brief create a MessagePack serialization of a given JSON value
4241 /// @brief create a MessagePack serialization of a given JSON value
4248 /// @brief create a UBJSON serialization of a given JSON value
4259 /// @brief create a UBJSON serialization of a given JSON value
4267 /// @brief create a UBJSON serialization of a given JSON value
4275 /// @brief create a BJData serialization of a given JSON value
4286 /// @brief create a BJData serialization of a given JSON value
4294 /// @brief create a BJData serialization of a given JSON value
4302 /// @brief create a BSON serialization of a given JSON value
4311 /// @brief create a BSON serialization of a given JSON value
4318 /// @brief create a BSON serialization of a given JSON value
4325 /// @brief create a JSON value from an input in CBOR format
4341 /// @brief create a JSON value from an input in CBOR format
4384 /// @brief create a JSON value from an input in MessagePack format
4399 /// @brief create a JSON value from an input in MessagePack format
4438 /// @brief create a JSON value from an input in UBJSON format
4453 /// @brief create a JSON value from an input in UBJSON format
4493 /// @brief create a JSON value from an input in BJData format
4508 /// @brief create a JSON value from an input in BJData format
4523 /// @brief create a JSON value from an input in BSON format
4538 /// @brief create a JSON value from an input in BSON format
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>
4641 /// @brief return flattened JSON value
4650 /// @brief unflatten a previously flattened JSON value
4704 // wrapper for "add" operation; add value at ptr
4732 // use operator[] to add value
4772 // wrapper for "remove" operation; remove value at ptr
4801 // type check: top level value must be an array
4810 // wrapper to get a value for an operation
4815 // find value
4821 // check if desired value is present
4835 // no error: return value
4854 operation_add(ptr, get_value("add", "value", false));
4867 result.at(ptr) = get_value("replace", "value", false);
4882 // location with the value that was just removed.
4897 // operation at the target location using the value
4908 // check if "value" matches the one at "path"
4910 success = (result.at(ptr) == get_value("test", "value", false));
4931 JSON_THROW(parse_error::create(105, 0, detail::concat("operation value '", op, "' is invalid"), &val));
4963 // different types: replace value
4966 {"op", "replace"}, {"path", path}, {"value", target}
5009 {"value", target[i]}
5028 auto temp_diff = diff(it.value(), target[it.key()], path_key);
5051 {"value", it.value()}
5069 // both primitive type: replace value
5072 {"op", "replace"}, {"path", path}, {"value", target}
5101 if (it.value().is_null())
5107 operator[](it.key()).merge_patch(it.value());
5160 /// @brief hash value for JSON objects
5197 is_nothrow_move_constructible<nlohmann::NLOHMANN_BASIC_JSON_TPL>::value&& // NOLINT(misc-redundant-expression)
5198 is_nothrow_move_assignable<nlohmann::NLOHMANN_BASIC_JSON_TPL>::value)