insert overloads
Synopses
Declared in <bdljsn_json.h>
Insert the specified move‐insertable member into the JsonObject held by this object if the key of member does not already exist; otherwise, this method has no effect. Return a pair whose first member is an iterator referring to the (possibly newly inserted) Member object whose key matches, and whose second member is true if a new value was inserted, and false otherwise. member is left in a valid but unspecified state. If isNull(), then the type is changed to object. The behavior is undefined unless isObject() or isNull(), and unless member.first is valid UTF‐8 (see bdlde::Utf8Util::isValid).
Insert into the JsonObject held by this object members created from the specified memberInitializers, ignoring those whose keys already exist. Return a non‐`const` reference to this object. If isNull(), then the type is changed to object. The behavior is undefined unless isObject() or isNull(), and unless the keys of all members are valid UTF‐8 (see bdlde::Utf8Util::isValid).
Insert the specified member into the JsonObject held by this object if the key of member does not already exist; otherwise, this method has no effect. Return a pair whose first member is an iterator referring to the (possibly newly inserted) Member object whose key matches, and whose second member is true if a new value was inserted, and false otherwise. If isNull(), then the type is changed to object. The behavior is undefined unless isObject() or isNull(), and unless member.first is valid UTF‐8 (see bdlde::Utf8Util::isValid).
bsl::pair<JsonObject::Iterator, bool>
insert(JsonObject::Member const& member);
Insert into the JsonArray held by this object at the specified position the specified move‐insertable json, and return an iterator referring to the newly inserted element. json is left in a valid but unspecified state. If an exception is thrown, *this is unaffected. Throw bsl::length_error if size() == maxSize(). The behavior is undefined unless isArray() and position is in the range [theArray().begin() .. theArray().end()].
JsonArray::Iterator
insert(
JsonArray::ConstIterator position,
bslmf::MovableRef<Json> json);
Insert into the JsonArray held by this object at the specified position a copy of the specified json, and return an iterator referring to the newly inserted element. If an exception is thrown, *this is unaffected. Throw bsl::length_error if size() == maxSize(). The behavior is undefined unless isArray() and position is in the range [theArray().begin() .. theArray().end()].
JsonArray::Iterator
insert(
JsonArray::ConstIterator position,
Json const& json);
Insert into the JsonArray held by this object at the specified index the specified move‐insertable json, and return an iterator referring to the newly inserted element. json is left in a valid but unspecified state. If isNull(), then the type is changed to array and index must be 0. If an exception is thrown, *this is unaffected. Throw bsl::length_error if size() == maxSize(). The (template parameter) type t_INDEX must be a non‐`bool` integral type. The behavior is undefined unless isArray() or isNull(), and unless index is in the range [0 .. size()].
template<class t_INDEX>
JsonArray::Iterator
insert(
t_INDEX index,
bslmf::MovableRef<Json> json)
requires bsl::is_integral<t_INDEX>::value
&& !bsl::is_same<t_INDEX, bool>::value;
Insert into the JsonArray held by this object at the specified index a copy of the specified json, and return an iterator referring to the newly inserted element. If isNull(), then the type is changed to array and index must be 0. If an exception is thrown, *this is unaffected. Throw bsl::length_error if size() == maxSize(). The (template parameter) type t_INDEX must be a non‐`bool` integral type. The behavior is undefined unless isArray() or isNull(), and unless index is in the range [0 .. size()].
template<class t_INDEX>
JsonArray::Iterator
insert(
t_INDEX index,
Json const& json)
requires bsl::is_integral<t_INDEX>::value
&& !bsl::is_same<t_INDEX, bool>::value;
Insert into the JsonObject held by this object each Member in the range [first, last)] whose key is not already present. Return a non‐`const` reference to this object. If isNull(), then the type is changed to object. The behavior is undefined unless isObject() or isNull(), first and last refer to a valid sequence, and the keys of all members are valid UTF‐8 (see bdlde::Utf8Util::isValid).
Insert into the JsonObject held by this object a Member constructed from the specified key and value if key does not already exist; otherwise, this method has no effect. Return a pair whose first member is an iterator referring to the (possibly newly inserted) Member object whose key matches, and whose second member is true if a new value was inserted, and false otherwise. If isNull(), then the type is changed to object. The (template parameter) type t_STRING_VIEW must be convertible to bsl::string_view. The behavior is undefined unless isObject() or isNull(), and unless key is valid UTF‐8 (see bdlde::Utf8Util::isValid).
template<
class t_VALUE,
class t_STRING_VIEW>
bsl::pair<JsonObject::Iterator, bool>
insert(
t_STRING_VIEW const& key,
t_VALUE&& value)
requires !bsl::is_integral <t_STRING_VIEW>::value
&& bsl::is_convertible<t_STRING_VIEW,
bsl::string_view>::value;
Insert into the JsonArray held by this object at the specified position the values in the range [first, last)], and return an iterator referring to the first newly inserted element. If an exception is thrown, *this is unaffected. Throw bsl::length_error if size() + distance(first, last) > maxSize(). The behavior is undefined unless isArray() and position is in the range [theArray().begin() .. theArray().end()].
template<class t_INPUT_ITERATOR>
JsonArray::Iterator
insert(
JsonArray::ConstIterator position,
t_INPUT_ITERATOR first,
t_INPUT_ITERATOR last);
Insert into the JsonArray held by this object at the specified index the values in the range [first, last)], and return an iterator referring to the first newly inserted element. If isNull(), then the type is changed to array and index must be 0. If an exception is thrown, *this is unaffected. Throw bsl::length_error if size() + distance(first, last) > maxSize(). The (template parameter) type t_INDEX must be a non‐`bool` integral type. The behavior is undefined unless isArray() or isNull(), and unless index is in the range [0 .. size()].
template<
class t_INDEX,
class t_INPUT_ITERATOR>
JsonArray::Iterator
insert(
t_INDEX index,
t_INPUT_ITERATOR first,
t_INPUT_ITERATOR last)
requires bsl::is_integral<t_INDEX>::value
&& !bsl::is_same<t_INDEX, bool>::value;
Created with MrDocs