Lines Matching defs:object
82 - If `m_type == value_t::object`, then `m_value.object != nullptr`.
319 /// @brief default object key comparator type
320 /// The actual object key comparator type (@ref object_comparator_t) may be
331 /// @brief a type for an object
367 /// @brief object key comparator type
375 /// helper for exception-safe object creation
407 object | object | pointer to @ref object_t
425 /// object (stored with pointer to save storage)
426 object_t* object;
457 case value_t::object:
459 object = create<object_t>();
507 object = nullptr; // silence warning, see #821
514 object = nullptr; // silence warning, see #821
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))) {}
556 if (t == value_t::array || t == value_t::object)
569 stack.reserve(object->size());
570 for (auto&& it : *object)
582 // if current_item is array/object, move
592 for (auto&& it : *current_item.m_value.object)
597 current_item.m_value.object->clear();
607 case value_t::object:
610 std::allocator_traits<decltype(alloc)>::destroy(alloc, object);
611 std::allocator_traits<decltype(alloc)>::deallocate(alloc, object, 1);
664 @a check_parents true and the value is an array or object, then the
674 JSON_ASSERT(m_type != value_t::object || m_value.object != nullptr);
707 case value_t::object:
709 for (auto& element : *m_value.object)
811 /// @brief create a null object
867 case value_t::object:
890 /// @brief create a container (array or object) from an initializer list
907 // if array is wanted, do not create an object though possible
913 // if object is wanted but impossible, throw an exception
914 if (JSON_HEDLEY_UNLIKELY(manual_type == value_t::object && !is_an_object))
916 JSON_THROW(type_error::create(301, "cannot create object from initializer list", nullptr));
922 // the initializer list is a list of pairs -> create object
923 m_type = value_t::object;
924 m_value = value_t::object;
929 m_value.object->emplace(
997 /// @brief explicitly create an object from an initializer list
998 /// @sa https://json.nlohmann.me/api/basic_json/object/
1000 static basic_json object(initializer_list_t init = {})
1002 return basic_json(init, false, value_t::object);
1052 case value_t::object:
1092 case value_t::object:
1094 m_value.object = create<object_t>(first.m_it.object_iterator,
1142 case value_t::object:
1144 m_value = *other.m_value.object;
1250 // object inspection //
1253 /// @name object inspection
1342 /// @brief return whether value is an object
1346 return m_type == value_t::object;
1402 /// get a pointer to the value (object)
1405 return is_object() ? m_value.object : nullptr;
1408 /// get a pointer to the value (object)
1411 return is_object() ? m_value.object : nullptr;
1582 `std::vector<short>`\, (3) A JSON object can be converted to C++
1749 @warning The pointer becomes invalid if the underlying JSON object
1861 `std::vector<short>`\, (3) A JSON object can be converted to C++
1970 /// @brief access specified object element with bounds checking
1980 auto it = m_value.object->find(key);
1981 if (it == m_value.object->end())
1988 /// @brief access specified object element with bounds checking
2000 auto it = m_value.object->find(std::forward<KeyType>(key));
2001 if (it == m_value.object->end())
2008 /// @brief access specified object element with bounds checking
2018 auto it = m_value.object->find(key);
2019 if (it == m_value.object->end())
2026 /// @brief access specified object element with bounds checking
2038 auto it = m_value.object->find(std::forward<KeyType>(key));
2039 if (it == m_value.object->end())
2105 /// @brief access specified object element
2109 // implicitly convert null value to an empty object
2112 m_type = value_t::object;
2113 m_value.object = create<object_t>();
2120 auto result = m_value.object->emplace(std::move(key), nullptr);
2127 /// @brief access specified object element
2134 auto it = m_value.object->find(key);
2135 JSON_ASSERT(it != m_value.object->end());
2156 /// @brief access specified object element
2162 // implicitly convert null value to an empty object
2165 m_type = value_t::object;
2166 m_value.object = create<object_t>();
2173 auto result = m_value.object->emplace(std::forward<KeyType>(key), nullptr);
2180 /// @brief access specified object element
2189 auto it = m_value.object->find(std::forward<KeyType>(key));
2190 JSON_ASSERT(it != m_value.object->end());
2208 /// @brief access specified object element with default value
2232 /// @brief access specified object element with default value
2257 /// @brief access specified object element with default value
2283 /// @brief access specified object element via JSON Pointer with default value
2310 /// @brief access specified object element via JSON Pointer with default value
2334 /// @brief access specified object element via JSON Pointer with default value
2461 case value_t::object:
2463 result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
2532 case value_t::object:
2534 result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator,
2566 return m_value.object->erase(std::forward<KeyType>(key));
2579 const auto it = m_value.object->find(std::forward<KeyType>(key));
2580 if (it != m_value.object->end())
2582 m_value.object->erase(it);
2590 /// @brief remove element from a JSON object given a key
2599 /// @brief remove element from a JSON object given a key
2638 /// @brief find an element in a JSON object
2646 result.m_it.object_iterator = m_value.object->find(key);
2652 /// @brief find an element in a JSON object
2660 result.m_it.object_iterator = m_value.object->find(key);
2666 /// @brief find an element in a JSON object
2676 result.m_it.object_iterator = m_value.object->find(std::forward<KeyType>(key));
2682 /// @brief find an element in a JSON object
2692 result.m_it.object_iterator = m_value.object->find(std::forward<KeyType>(key));
2698 /// @brief returns the number of occurrences of a key in a JSON object
2703 return is_object() ? m_value.object->count(key) : 0;
2706 /// @brief returns the number of occurrences of a key in a JSON object
2713 return is_object() ? m_value.object->count(std::forward<KeyType>(key)) : 0;
2716 /// @brief check the existence of an element in a JSON object
2720 return is_object() && m_value.object->find(key) != m_value.object->end();
2723 /// @brief check the existence of an element in a JSON object
2729 return is_object() && m_value.object->find(std::forward<KeyType>(key)) != m_value.object->end();
2732 /// @brief check the existence of an element in a JSON object given a JSON pointer
2913 case value_t::object:
2916 return m_value.object->empty();
2952 case value_t::object:
2955 return m_value.object->size();
2985 case value_t::object:
2988 return m_value.object->max_size();
3065 case value_t::object:
3067 m_value.object->clear();
3078 /// @brief add an object to an array
3088 // transform null object into an array
3103 /// @brief add an object to an array
3111 /// @brief add an object to an array
3121 // transform null object into an array
3135 /// @brief add an object to an array
3143 /// @brief add an object to an object
3153 // transform null object into an object
3156 m_type = value_t::object;
3157 m_value = value_t::object;
3161 // add element to object
3162 auto res = m_value.object->insert(val);
3166 /// @brief add an object to an object
3174 /// @brief add an object to an object
3190 /// @brief add an object to an object
3198 /// @brief add an object to an array
3209 // transform null object into an array
3223 /// @brief add an object to an object if key does not exist
3234 // transform null object into an object
3237 m_type = value_t::object;
3238 m_value = value_t::object;
3243 auto res = m_value.object->emplace(std::forward<Args>(args)...);
3338 // check if range iterators belong to the same JSON object
3373 /// @brief inserts range of elements into object
3383 // check if range iterators belong to the same JSON object
3395 m_value.object->insert(first.m_it.object_iterator, last.m_it.object_iterator);
3398 /// @brief updates a JSON object from another object, overwriting existing keys
3405 /// @brief updates a JSON object from another object, overwriting existing keys
3409 // implicitly convert null value to an empty object
3412 m_type = value_t::object;
3413 m_value.object = create<object_t>();
3422 // check if range iterators belong to the same JSON object
3438 auto it2 = m_value.object->find(it.key());
3439 if (it2 != m_value.object->end())
3445 m_value.object->operator[](it.key()) = it.value();
3447 m_value.object->operator[](it.key()).m_parent = this;
3505 swap(*(m_value.object), other);
3583 case value_t::object: \
3584 return (*lhs.m_value.object) op (*rhs.m_value.object); \
4157 case value_t::object:
4158 return "object";
4645 basic_json result(value_t::object);
4666 /// @brief applies a JSON patch in-place without copying the object
4730 case value_t::object:
4816 auto it = val.m_value.object->find(member);
4822 if (JSON_HEDLEY_UNLIKELY(it == val.m_value.object->end()))
4839 // type check: every element of the array must be an object
4937 /// @brief applies a JSON patch to a copy of the current object
4994 result.insert(result.begin() + end_index, object(
5017 case value_t::object:
5019 // first pass: traverse this object's elements
5027 // recursive call to compare object values at key it
5034 result.push_back(object(
5041 // second pass: traverse other object's elements
5097 *this = object();