This type is designed to replicate much of the standard sequence container interface, eliding interfaces that are less relevant for a non‐generic container. Note that a bsl::vector is chosen for the implementation because our implementation permits the element type to be incomplete (when just spelling the type name).

Synopsis

Declared in <bdljsn_json.h>

class JsonArray;

Type Aliases

Name

Description

ConstIterator

This typedef is an alias for ConstIterator.

Iterator

This typedef is an alias to Elements::iterator.

const_iterator

This typedef is an alias to Elements::const_iterator.

const_reference

This typedef is an alias for const_reference.

difference_type

This typedef is an alias to Elements::difference_type.

iterator

This typedef is an alias to Elements::iterator.

reference

This typedef is an alias for reference.

size_type

This typedef is an alias to Elements::size_type.

value_type

This typedef is an alias for value_type.

Member Functions

Name

Description

JsonArray [constructor]

Constructors

operator=

Assignment operators

allocator

Return the allocator used by this object to allocate memory.

assign

assign overloads

back

back overloads

begin

begin overloads

cbegin

Return an iterator providing non‐modifiable access to the first element in this JsonArray, and the past‐the‐end iterator if this JsonArray is empty.

cend

Return the past‐the‐end iterator providing non‐modifiable access to this JsonArray.

clear

Remove all elements from this JsonArray making its size 0. Note that although this JsonArray is empty after this method returns, it preserves the same capacity it had before the method was called.

empty

Return true if this JsonArray has size 0, and false otherwise.

end

end overloads

erase

erase overloads

front

front overloads

insert

insert overloads

maxSize

Return a theoretical upper bound on the largest number of elements that this JsonArray could possibly hold. Requests to create a JsonArray longer than this number of elements are guaranteed to raise a bsl::length_error exception. Note that there is no guarantee that the JsonArray can successfully grow to the returned size, or even close to that size, without running out of resources.

operator[]

Subscript operators

popBack

Erase the last element from this JsonArray. The behavior is undefined if this JsonArray is empty.

print

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.

pushBack

pushBack overloads

resize

resize overloads

size

Return the number of elements in this JsonArray.

swap

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.

operator BloombergLP::bslmf::NestedTraitDeclaration<JsonArray, HasPrintMethod>

Process the specified array during visitation of a bdljsn::Json object.

Friends

Name

Description

BloombergLP::bdljsn::swap

Exchange the value of the specified a JsonArray with that of the specified b JsonArray. 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.

BloombergLP::bdljsn::operator!=

Return false if the specified lhs and rhs objects have the same value, and true otherwise. Two JsonArray objects lhs and rhs have the same value if they have the same number of elements, and each element in the ordered sequence of elements of lhs has the same value as the corresponding element in the ordered sequence of elements of rhs.

BloombergLP::bdljsn::operator==

Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two JsonArray objects lhs and rhs have the same value if they have the same number of elements, and each element in the ordered sequence of elements of lhs has the same value as the corresponding element in the ordered sequence of elements of rhs.

Non-Member Functions

Name

Description

operator!=

Return true if the specified lhs and rhs arguments do not have the same value, and false otherwise. Two arguments do not have the same value if the Json object does not have the same value as a Json object constructed from the other argument.

operator==

Return true if the specified lhs and rhs arguments have the same value, and false otherwise. Two arguments have the same value if the Json object has the same value as a Json object constructed from the other argument.

Created with MrDocs