Lines Matching defs:object
2859 object, ///< object (unordered set of name/value pairs)
2874 - order: null < boolean < number < object < array < string < binary
2890 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */,
3411 /// @brief specialization that maintains the insertion order of object keys
3567 // obtains the actual object key comparator
3915 // type trait to check if KeyType can be used as object key (without a BasicJsonType)
3929 // type trait to check if KeyType can be used as object key
4348 case value_t::object:
4350 for (const auto& element : *current->m_parent->m_value.object)
4392 /// an exception object as storage for error messages
4408 @return parse_error object
4628 case value_t::object:
4868 JSON_THROW(type_error::create(302, concat("type must be object, but is ", j.type_name()), &j));
4922 case value_t::object:
5209 // use key from the object
5210 case value_t::object:
5528 struct external_constructor<value_t::object>
5534 j.m_type = value_t::object;
5544 j.m_type = value_t::object;
5558 j.m_type = value_t::object;
5559 j.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(obj), end(obj));
5675 external_constructor<value_t::object>::construct(j, obj);
5681 external_constructor<value_t::object>::construct(j, std::move(obj));
5967 case BasicJsonType::value_t::object:
6659 @brief the beginning of an object was read
6660 @param[in] elements number of object elements or -1 if unknown
6667 @brief an object key was read
6668 @param[in] val object key
6675 @brief the end of an object was read
6698 @param[in] ex an exception object describing the error
6722 a pointer to the respective array or object for each recursion depth.
6799 ref_stack.push_back(handle_value(BasicJsonType::value_t::object));
6803 JSON_THROW(out_of_range::create(408, concat("excessive object size: ", std::to_string(len)), ref_stack.back()));
6815 object_element = &(ref_stack.back()->m_value.object->operator[](val));
6874 object to which we can add elements
6904 /// helper to hold the reference for the next object element
6983 // check callback for object start
6987 auto val = handle_value(BasicJsonType::value_t::object, true);
6990 // check object limit
6993 JSON_THROW(out_of_range::create(408, concat("excessive object size: ", std::to_string(len)), ref_stack.back()));
7010 object_element = &(ref_stack.back()->m_value.object->operator[](val) = discarded);
7022 // discard object
7125 callback function with an empty array or object, respectively.
7130 object to which we can add elements
7182 // object
7205 /// stack to manage which object keys to keep
7207 /// helper to hold the reference for the next object element
7350 begin_object, ///< the character for object begin `{`
7352 end_object, ///< the character for object end `}`
9239 @brief Reads in a BSON-object and passes it to the SAX-parser.
9344 @return whether a valid BSON-object/array was passed to the SAX parser
9364 case 0x03: // object
9419 (true --> array, false --> object).
9422 treated as an object (@a is_array == false), or as an
9424 @return whether a valid BSON-object/array was passed to the SAX parser
10209 @param[in] len the length of the object or static_cast<std::size_t>(-1) for an
10210 object of indefinite size
10212 @return whether object creation completed
10864 @param[in] len the length of the object
10865 @return whether object creation completed
10913 indicating a string, or in case of an object key where the 'S' byte can be
11242 if (!dim.empty()) // if ndarray, convert to an object in JData annotated array format
11543 case '{': // object
11564 // if bit-8 of size_and_type.second is set to 1, encode bjdata ndarray as an object in JData annotated array format (https://github.com/NeuroJSON/jdata):
11662 @return whether object creation completed
11677 exception_message(input_format, "BJData object does not support ND-array size in optimized format", "object"), nullptr));
12134 /// the parser read `{` and started to process a JSON object
12136 /// the parser read `}` and finished processing a JSON object
12142 /// the parser read a key of a value in an object
12281 // true = array; false = object
12315 parse_error::create(101, m_lexer.get_position(), exception_message(token_type::value_string, "object key"), nullptr));
12327 parse_error::create(101, m_lexer.get_position(), exception_message(token_type::name_separator, "object separator"), nullptr));
12330 // remember we are now inside an object
12503 // states.back() is false -> object
12513 parse_error::create(101, m_lexer.get_position(), exception_message(token_type::value_string, "object key"), nullptr));
12526 parse_error::create(101, m_lexer.get_position(), exception_message(token_type::name_separator, "object separator"), nullptr));
12542 // We are done with this object. Before we can parse a
12554 parse_error::create(101, m_lexer.get_position(), exception_message(token_type::end_object, "object"), nullptr));
12851 "basic_json iterator assumes array and object type iterators satisfy the LegacyBidirectionalIterator named requirement.");
12882 @param[in] object pointer to a JSON object for this iterator
12883 @pre object != nullptr
12886 explicit iter_impl(pointer object) noexcept : m_object(object)
12892 case value_t::object:
12989 case value_t::object:
12991 m_it.object_iterator = m_object->m_value.object->begin();
13033 case value_t::object:
13035 m_it.object_iterator = m_object->m_value.object->end();
13072 case value_t::object:
13074 JSON_ASSERT(m_it.object_iterator != m_object->m_value.object->end());
13116 case value_t::object:
13118 JSON_ASSERT(m_it.object_iterator != m_object->m_value.object->end());
13169 case value_t::object:
13220 case value_t::object:
13267 case value_t::object:
13312 case value_t::object:
13313 JSON_THROW(invalid_iterator::create(213, "cannot compare order of object iterators", m_object));
13368 case value_t::object:
13369 JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators", m_object));
13447 case value_t::object:
13448 JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators", m_object));
13476 case value_t::object:
13477 JSON_THROW(invalid_iterator::create(208, "cannot use operator[] for object iterators", m_object));
13505 @brief return the key of an object iterator
13517 JSON_THROW(invalid_iterator::create(207, "cannot use key() for non-object iterators", m_object));
13656 /// return the key of an object iterator
13974 // start a new object otherwise
13980 case detail::value_t::object:
13982 // create an entry in the object
14022 changing the null value to an object.
14050 // change value to array for numbers or "-" or to object otherwise
14053 : detail::value_t::object;
14058 case detail::value_t::object:
14060 // use unchecked object access
14109 case detail::value_t::object:
14167 case detail::value_t::object:
14169 // use unchecked object access
14216 case detail::value_t::object:
14265 case detail::value_t::object:
14269 // we did not find the key in the object
14411 @param[in,out] result the result object to insert values to
14441 case detail::value_t::object:
14443 if (value.m_value.object->empty())
14445 // flatten empty object as null
14450 // iterate object and use keys as reference string
14451 for (const auto& element : *value.m_value.object)
14482 @throw type_error.314 if value is not an object
14483 @throw type_error.315 if object values are not primitive
14497 // iterate the JSON object values
14498 for (const auto& element : *value.m_value.object)
14502 JSON_THROW(detail::type_error::create(315, "values in object must be primitive", &element.second));
14973 @pre j.type() == value_t::object
14979 case value_t::object:
14981 write_bson_object(*j.m_value.object);
14996 JSON_THROW(type_error::create(317, concat("to serialize to BSON, top-level type must be object, but is ", j.type_name()), &j));
15279 case value_t::object:
15281 // step 1: write control byte and the object size
15282 const auto N = j.m_value.object->size();
15311 for (const auto& el : *j.m_value.object)
15610 case value_t::object:
15612 // step 1: write control byte and the object size
15613 const auto N = j.m_value.object->size();
15633 for (const auto& el : *j.m_value.object)
15801 case value_t::object:
15803 if (use_bjdata && j.m_value.object->size() == 3 && j.m_value.object->find("_ArrayType_") != j.m_value.object->end() && j.m_value.object->find("_ArraySize_") != j.m_value.object->end() && j.m_value.object->find("_ArrayData_") != j.m_value.object->end())
15805 if (!write_bjdata_ndarray(*j.m_value.object, use_count, use_type)) // decode bjdata ndarray in the JData format (https://github.com/NeuroJSON/jdata)
15817 if (use_type && !j.m_value.object->empty())
15840 write_number_with_ubjson_prefix(j.m_value.object->size(), true, use_bjdata);
15843 for (const auto& el : *j.m_value.object)
16010 @brief Writes a BSON element with key @a name and object @a value
16015 write_bson_entry_header(name, 0x03); // object
16085 case value_t::object:
16086 return header_size + calc_bson_object_size(*j.m_value.object);
16132 case value_t::object:
16133 return write_bson_object_entry(name, *j.m_value.object);
16170 JSON-object @a j.
16172 @pre value.type() == value_t::object
16187 @pre value.type() == value_t::object
16511 case value_t::object:
16531 @return false if the object is successfully converted to a bjdata ndarray, true if the type or size is invalid
17977 - strings and object keys are escaped using `escape_string()`
17999 case value_t::object:
18001 if (val.m_value.object->empty())
18019 auto i = val.m_value.object->cbegin();
18020 for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
18031 JSON_ASSERT(i != val.m_value.object->cend());
18032 JSON_ASSERT(std::next(i) == val.m_value.object->cend());
18048 auto i = val.m_value.object->cbegin();
18049 for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
18059 JSON_ASSERT(i != val.m_value.object->cend());
18060 JSON_ASSERT(std::next(i) == val.m_value.object->cend());
19260 - If `m_type == value_t::object`, then `m_value.object != nullptr`.
19497 /// @brief default object key comparator type
19498 /// The actual object key comparator type (@ref object_comparator_t) may be
19509 /// @brief a type for an object
19545 /// @brief object key comparator type
19553 /// helper for exception-safe object creation
19585 object | object | pointer to @ref object_t
19603 /// object (stored with pointer to save storage)
19604 object_t* object;
19635 case value_t::object:
19637 object = create<object_t>();
19685 object = nullptr; // silence warning, see #821
19692 object = nullptr; // silence warning, see #821
19709 json_value(const object_t& value) : object(create<object_t>(value)) {}
19712 json_value(object_t&& value) : object(create<object_t>(std::move(value))) {}
19734 if (t == value_t::array || t == value_t::object)
19747 stack.reserve(object->size());
19748 for (auto&& it : *object)
19760 // if current_item is array/object, move
19770 for (auto&& it : *current_item.m_value.object)
19775 current_item.m_value.object->clear();
19785 case value_t::object:
19788 std::allocator_traits<decltype(alloc)>::destroy(alloc, object);
19789 std::allocator_traits<decltype(alloc)>::deallocate(alloc, object, 1);
19842 @a check_parents true and the value is an array or object, then the
19852 JSON_ASSERT(m_type != value_t::object || m_value.object != nullptr);
19885 case value_t::object:
19887 for (auto& element : *m_value.object)
19989 /// @brief create a null object
20045 case value_t::object:
20068 /// @brief create a container (array or object) from an initializer list
20085 // if array is wanted, do not create an object though possible
20091 // if object is wanted but impossible, throw an exception
20092 if (JSON_HEDLEY_UNLIKELY(manual_type == value_t::object && !is_an_object))
20094 JSON_THROW(type_error::create(301, "cannot create object from initializer list", nullptr));
20100 // the initializer list is a list of pairs -> create object
20101 m_type = value_t::object;
20102 m_value = value_t::object;
20107 m_value.object->emplace(
20175 /// @brief explicitly create an object from an initializer list
20176 /// @sa https://json.nlohmann.me/api/basic_json/object/
20178 static basic_json object(initializer_list_t init = {})
20180 return basic_json(init, false, value_t::object);
20230 case value_t::object:
20270 case value_t::object:
20272 m_value.object = create<object_t>(first.m_it.object_iterator,
20320 case value_t::object:
20322 m_value = *other.m_value.object;
20428 // object inspection //
20431 /// @name object inspection
20520 /// @brief return whether value is an object
20524 return m_type == value_t::object;
20580 /// get a pointer to the value (object)
20583 return is_object() ? m_value.object : nullptr;
20586 /// get a pointer to the value (object)
20589 return is_object() ? m_value.object : nullptr;
20760 `std::vector<short>`\, (3) A JSON object can be converted to C++
20927 @warning The pointer becomes invalid if the underlying JSON object
21039 `std::vector<short>`\, (3) A JSON object can be converted to C++
21148 /// @brief access specified object element with bounds checking
21158 auto it = m_value.object->find(key);
21159 if (it == m_value.object->end())
21166 /// @brief access specified object element with bounds checking
21178 auto it = m_value.object->find(std::forward<KeyType>(key));
21179 if (it == m_value.object->end())
21186 /// @brief access specified object element with bounds checking
21196 auto it = m_value.object->find(key);
21197 if (it == m_value.object->end())
21204 /// @brief access specified object element with bounds checking
21216 auto it = m_value.object->find(std::forward<KeyType>(key));
21217 if (it == m_value.object->end())
21283 /// @brief access specified object element
21287 // implicitly convert null value to an empty object
21290 m_type = value_t::object;
21291 m_value.object = create<object_t>();
21298 auto result = m_value.object->emplace(std::move(key), nullptr);
21305 /// @brief access specified object element
21312 auto it = m_value.object->find(key);
21313 JSON_ASSERT(it != m_value.object->end());
21334 /// @brief access specified object element
21340 // implicitly convert null value to an empty object
21343 m_type = value_t::object;
21344 m_value.object = create<object_t>();
21351 auto result = m_value.object->emplace(std::forward<KeyType>(key), nullptr);
21358 /// @brief access specified object element
21367 auto it = m_value.object->find(std::forward<KeyType>(key));
21368 JSON_ASSERT(it != m_value.object->end());
21386 /// @brief access specified object element with default value
21410 /// @brief access specified object element with default value
21435 /// @brief access specified object element with default value
21461 /// @brief access specified object element via JSON Pointer with default value
21488 /// @brief access specified object element via JSON Pointer with default value
21512 /// @brief access specified object element via JSON Pointer with default value
21639 case value_t::object:
21641 result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
21710 case value_t::object:
21712 result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator,
21744 return m_value.object->erase(std::forward<KeyType>(key));
21757 const auto it = m_value.object->find(std::forward<KeyType>(key));
21758 if (it != m_value.object->end())
21760 m_value.object->erase(it);
21768 /// @brief remove element from a JSON object given a key
21777 /// @brief remove element from a JSON object given a key
21816 /// @brief find an element in a JSON object
21824 result.m_it.object_iterator = m_value.object->find(key);
21830 /// @brief find an element in a JSON object
21838 result.m_it.object_iterator = m_value.object->find(key);
21844 /// @brief find an element in a JSON object
21854 result.m_it.object_iterator = m_value.object->find(std::forward<KeyType>(key));
21860 /// @brief find an element in a JSON object
21870 result.m_it.object_iterator = m_value.object->find(std::forward<KeyType>(key));
21876 /// @brief returns the number of occurrences of a key in a JSON object
21881 return is_object() ? m_value.object->count(key) : 0;
21884 /// @brief returns the number of occurrences of a key in a JSON object
21891 return is_object() ? m_value.object->count(std::forward<KeyType>(key)) : 0;
21894 /// @brief check the existence of an element in a JSON object
21898 return is_object() && m_value.object->find(key) != m_value.object->end();
21901 /// @brief check the existence of an element in a JSON object
21907 return is_object() && m_value.object->find(std::forward<KeyType>(key)) != m_value.object->end();
21910 /// @brief check the existence of an element in a JSON object given a JSON pointer
22091 case value_t::object:
22094 return m_value.object->empty();
22130 case value_t::object:
22133 return m_value.object->size();
22163 case value_t::object:
22166 return m_value.object->max_size();
22243 case value_t::object:
22245 m_value.object->clear();
22256 /// @brief add an object to an array
22266 // transform null object into an array
22281 /// @brief add an object to an array
22289 /// @brief add an object to an array
22299 // transform null object into an array
22313 /// @brief add an object to an array
22321 /// @brief add an object to an object
22331 // transform null object into an object
22334 m_type = value_t::object;
22335 m_value = value_t::object;
22339 // add element to object
22340 auto res = m_value.object->insert(val);
22344 /// @brief add an object to an object
22352 /// @brief add an object to an object
22368 /// @brief add an object to an object
22376 /// @brief add an object to an array
22387 // transform null object into an array
22401 /// @brief add an object to an object if key does not exist
22412 // transform null object into an object
22415 m_type = value_t::object;
22416 m_value = value_t::object;
22421 auto res = m_value.object->emplace(std::forward<Args>(args)...);
22516 // check if range iterators belong to the same JSON object
22551 /// @brief inserts range of elements into object
22561 // check if range iterators belong to the same JSON object
22573 m_value.object->insert(first.m_it.object_iterator, last.m_it.object_iterator);
22576 /// @brief updates a JSON object from another object, overwriting existing keys
22583 /// @brief updates a JSON object from another object, overwriting existing keys
22587 // implicitly convert null value to an empty object
22590 m_type = value_t::object;
22591 m_value.object = create<object_t>();
22600 // check if range iterators belong to the same JSON object
22616 auto it2 = m_value.object->find(it.key());
22617 if (it2 != m_value.object->end())
22623 m_value.object->operator[](it.key()) = it.value();
22625 m_value.object->operator[](it.key()).m_parent = this;
22683 swap(*(m_value.object), other);
22761 case value_t::object: \
22762 return (*lhs.m_value.object) op (*rhs.m_value.object); \
23335 case value_t::object:
23336 return "object";
23823 basic_json result(value_t::object);
23844 /// @brief applies a JSON patch in-place without copying the object
23908 case value_t::object:
23994 auto it = val.m_value.object->find(member);
24000 if (JSON_HEDLEY_UNLIKELY(it == val.m_value.object->end()))
24017 // type check: every element of the array must be an object
24115 /// @brief applies a JSON patch to a copy of the current object
24172 result.insert(result.begin() + end_index, object(
24195 case value_t::object:
24197 // first pass: traverse this object's elements
24205 // recursive call to compare object values at key it
24212 result.push_back(object(
24219 // second pass: traverse other object's elements
24275 *this = object();