|
BDE 4.14.0 Production release
|
#include <bdljsn_json.h>
Public Types | |
| typedef Container::value_type | Member |
| typedef Container::const_iterator | ConstIterator |
| typedef Container::iterator | Iterator |
| typedef bsl::pair< Iterator, bool > | IteratorAndStatus |
| typedef Container::value_type | value_type |
| typedef Container::reference | reference |
| typedef Container::const_reference | const_reference |
| typedef Container::iterator | iterator |
| typedef Container::const_iterator | const_iterator |
| typedef Container::difference_type | difference_type |
| typedef Container::size_type | size_type |
Friends | |
| bool | operator== (const JsonObject &, const JsonObject &) |
| bool | operator!= (const JsonObject &, const JsonObject &) |
| template<class HASHALG > | |
| void | hashAppend (HASHALG &, const JsonObject &) |
| void | swap (JsonObject &, JsonObject &) |
This type is designed to replicate much of the standard associative container interface, eliding interfaces that are less relevant for a non-generic container, like hasher and comparator access, emplacement, nodes, capacity management, etc.
See bdljsn_json
| typedef bsl::pair<Iterator, bool> bdljsn::JsonObject::IteratorAndStatus |
|
inline |
|
inlineexplicit |
Create an empty JsonObject. Optionally specify the basicAllocator used to supply memory. If basicAllocator is not specified, the currently installed default allocator is used to supply memory.
|
inline |
Create a JsonObject having the same value as the specified original. Optionally specify the basicAllocator used to supply memory. If basicAllocator is not specified, the currently installed default allocator is used to supply memory.
|
inline |
Create a JsonObject having the same value as the specified original object by moving (in constant time) the contents of original to the new JsonObject. The allocator associated with original is propagated for use in the newly-created JsonObject. original is left in a valid but unspecified state.
|
inline |
Create a JsonObject having the same value as the specified original. Use the specified basicAllocator to supply memory. If basicAllocator == original.allocator() the value of original will be moved (in constant time) to the newly-created JsonObject, and original will be left in a valid but unspecified state. Otherwise, original is copied, and basicAllocator used to supply memory.
|
inline |
Create an empty JsonObject, and then create a Json object for each iterator in the range starting at the specified first iterator and ending immediately before the specified last iterator, by converting from the object referred to by each iterator. Insert into this JsonObject each such object, ignoring those having a key that appears earlier in the sequence. Optionally specify a basicAllocator used to supply memory. If basicAllocator is not supplied, the currently installed default allocator is used to supply memory. The (template parameter) type INPUT_ITERATOR shall meet the requirements of an input iterator defined in the C++11 standard [24.2.3] providing access to values of a type convertible to Member. The behavior is undefined unless first and last refer to a sequence of valid values where first is at a position at or before last, and all keys of all Member objects inserted are valid UTF-8 (see bdlde::Utf8Util::isValid).
|
inline |
|
inline |
Return an iterator providing modifiable access to the first Member object in the sequence of Member objects maintained by this JsonObject, or the end iterator if this JsonObject is empty.
|
inline |
| bdljsn::JsonObject::BSLMF_NESTED_TRAIT_DECLARATION | ( | JsonObject | , |
| bdlb::HasPrintMethod | |||
| ) |
| bdljsn::JsonObject::BSLMF_NESTED_TRAIT_DECLARATION | ( | JsonObject | , |
| bslma::UsesBslmaAllocator | |||
| ) |
| bdljsn::JsonObject::BSLMF_NESTED_TRAIT_DECLARATION | ( | JsonObject | , |
| bslmf::IsBitwiseMoveable | |||
| ) |
|
inline |
Return an iterator providing non-modifiable access to the first Member object in the sequence of Member objects maintained by this JsonObject, or the end iterator if this JsonObject is empty.
|
inline |
Return an iterator providing non-modifiable access to the past-the-end position in the sequence of Member objects maintained by this JsonObject.
|
inline |
Remove all entries from this JsonObject. Note that this JsonObject will be empty after calling this method, but allocated memory may be retained for future use.
|
inline |
Return true if there is a Member object in this JsonObject with a key equivalent to the specified key, and return false otherwise.
|
inline |
Return true if this JsonObject contains no elements, and false otherwise.
|
inline |
Return an iterator providing modifiable access to the past-the-end position in the sequence of Member objects maintained by this JsonObject.
|
inline |
|
inline |
Remove from this JsonObject the Member object having the specified key, if it exists, and return 1; otherwise (there is no object with a key equivalent to key in this JsonObject) return 0 with no other effect. This method invalidates only iterators and references to the removed element and previously saved values of the end() iterator, and preserves the relative order of the elements not removed.
|
inline |
Remove from this unordered map the value_type object at the specified position, and return an iterator referring to the element immediately following the removed element, or to the past-the-end position if the removed element was the last element in the sequence of elements maintained by this unordered map. This method invalidates only iterators and references to the removed element and previously saved values of the end() iterator, and preserves the relative order of the elements not removed. The behavior is undefined unless position refers to a value_type object in this unordered map.
|
inline |
|
inline |
Return an iterator providing modifiable access to the Member object in this JsonObject with a key equivalent to the specified key, if such an entry exists, and the past-the-end iterator (end) otherwise.
|
inline |
Return an iterator providing non-modifiable access to the Member object in this JsonObject with a key equivalent to the specified key, if such an entry exists, and the past-the-end iterator (end) otherwise.
|
inline |
Insert the specified member into this JsonObject if the key (the first element) of the object referred to by member does not already exist in this JsonObject; otherwise, this method has no effect. Return a pair whose first member is an iterator referring to the (possibly newly inserted) member object in this JsonObject whose key is the equivalent to that of the object to be inserted, and whose second member is true if a new value was inserted, and false otherwise. The behavior is undefined unless member.first is valid UTF-8 (see bdlde::Utf8Util::isValid).
| bsl::pair< JsonObject::Iterator, bool > bdljsn::JsonObject::insert | ( | const bsl::string_view & | key, |
| BSLS_COMPILERFEATURES_FORWARD_REF(VALUE) | value | ||
| ) |
Insert into this JsonObject a Member constructed from the specified key and the specified value, respectively, if key does not already exist in this JsonObject; otherwise, this method has no effect. Return a pair whose first member is an iterator referring to the (possibly newly inserted) Member object in this JsonObject whose key is the equivalent to that of the object to be inserted, and whose second member is true if a new value was inserted, and false otherwise. The behavior is undefined unless key is valid UTF-8 (see bdlde::Utf8Util::isValid).
|
inline |
Insert the specified member into this JsonObject if the key (the first element) of the object referred to by value does not already exist in this JsonObject; otherwise, this method has no effect. Return a pair whose first member is an iterator referring to the (possibly newly inserted) value_type object in this JsonObject whose key is equivalent to that of the object to be inserted, and whose second member is true if a new value was inserted, and false if a value having an equivalent key was already present. The behavior is undefined unless member.first is valid UTF-8 (see bdlde::Utf8Util::isValid).
|
inline |
Create a member object for each iterator in the range starting at the specified first iterator and ending immediately before the specified last iterator, by converting from the object referred to by each iterator. Insert into this JsonObject each such object whose key is not already contained. The (template parameter) type INPUT_ITERATOR shall meet the requirements of an input iterator defined in the C++11 standard [24.2.3] providing access to values of a type convertible to Member. The behavior is undefined unless first and last refer to a sequence of value values where first is at a position at or before last. The behavior is undefined unless the keys of all Member objects inserted are valid UTF-8 (see bdlde::Utf8Util::isValid).
|
inline |
Assign to this object the value of the specified rhs object, and return a reference providing modifiable access to this object. The contents of rhs are moved (in constant time) to this JsonObject if allocator() == rhs.allocator(); otherwise, all elements in this container are either destroyed or move-assigned to, and each additional element in rhs, if any, is move-inserted into this JsonObject. rhs is left in a valid but unspecified state.
|
inline |
Assign to this object the value of the specified rhs object, and return a reference providing modifiable access to this object.
|
inline |
Return a reference providing modifiable access to the Json object associated with the specified key in this JsonObject; if this JsonObject does not already contain a Json object associated with key, first insert a new default-constructed Json object associated with key. The behavior is undefined unless key is valid UTF-8 (see bdlde::Utf8Util::isValid).
|
inline |
Return a reference providing non-modifiable access to the Json object associated with the specified key in this JsonObject. The behavior is undefined unless key is valid UTF-8 (see bdlde::Utf8Util::isValid) and this JsonObject already contains a Json object associated with key.
| bsl::ostream & bdljsn::JsonObject::print | ( | bsl::ostream & | stream, |
| int | level = 0, |
||
| int | spacesPerLevel = 4 |
||
| ) | const |
Write the value of this object to the specified output stream in a human-readable format, and return a reference to stream. Optionally specify an initial indentation level, whose absolute value is incremented recursively for nested objects. If level is specified, optionally specify spacesPerLevel, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect. Note that this human-readable format is not fully specified, and can change without notice.
|
inline |
|
inline |
Exchange the value of this object with that of the specified other object. If an exception is thrown, both objects are left in valid but unspecified states. This operation guarantees O[1] complexity. The behavior is undefined unless this object was created with the same allocator as other.
|
friend |
Invoke the specified hashAlg on the attributes of the specified object.
|
friend |
Return false if the specified lhs and rhs objects have the same value, and true otherwise. Two JsonObject objects have the same value if they have the same number of Member objects, and for each Member object that is contained in lhs there is a key-value pair contained in rhs having the same value, and vice versa.
|
friend |
Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two JsonObject objects have the same value if they have the same number of Member objects, and for each Member object that is contained in lhs there is a key-value pair contained in rhs having the same value, and vice versa.
|
friend |
Exchange the value of the specified a JsonObject with that of the specified b JsonObject. This function provides the no-throw exception-safety guarantee. This operation has O[1] complexity if a was created with the same allocator as b; otherwise, it has O[n+m] complexity, where n and m are the number of elements in a and b, respectively.