BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdljsn::Json Class Reference

#include <bdljsn_json.h>

Detailed Description

This type is designed to be a thin wrapper around a variant of the possible JSON types, using a BDE-style variant interface.

See bdljsn_json

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (Json, bslma::UsesBslmaAllocator)
 
 BSLMF_NESTED_TRAIT_DECLARATION (Json, bslmf::IsBitwiseMoveable)
 
 BSLMF_NESTED_TRAIT_DECLARATION (Json, bdlb::HasPrintMethod)
 
 Json ()
 
 Json (bslma::Allocator *basicAllocator)
 
 Json (const Json &original, bslma::Allocator *basicAllocator=0)
 
 Json (bslmf::MovableRef< Json > original)
 
 Json (bslmf::MovableRef< Json > original, bslma::Allocator *basicAllocator)
 
 Json (bool boolean, bslma::Allocator *basicAllocator=0)
 
 Json (const JsonNull &null, bslma::Allocator *basicAllocator=0)
 
 Json (const JsonArray &array, bslma::Allocator *basicAllocator=0)
 
 Json (const JsonObject &object, bslma::Allocator *basicAllocator=0)
 
 Json (const JsonNumber &number, bslma::Allocator *basicAllocator=0)
 
 Json (bslmf::MovableRef< JsonArray > array, bslma::Allocator *basicAllocator=0)
 
 Json (bslmf::MovableRef< JsonObject > object, bslma::Allocator *basicAllocator=0)
 
 Json (bslmf::MovableRef< JsonNumber > number, bslma::Allocator *basicAllocator=0)
 
 Json (int value, bslma::Allocator *basicAllocator=0)
 
 Json (unsigned int value, bslma::Allocator *basicAllocator=0)
 
 Json (long value, bslma::Allocator *basicAllocator=0)
 
 Json (unsigned long value, bslma::Allocator *basicAllocator=0)
 
 Json (long long value, bslma::Allocator *basicAllocator=0)
 
 Json (unsigned long long value, bslma::Allocator *basicAllocator=0)
 
 Json (float value, bslma::Allocator *basicAllocator=0)
 
 Json (double value, bslma::Allocator *basicAllocator=0)
 
 Json (bdldfp::Decimal64 value, bslma::Allocator *basicAllocator=0)
 
 Json (const char *string, bslma::Allocator *basicAllocator=0)
 
 Json (const bsl::string_view &string, bslma::Allocator *basicAllocator=0)
 
template<class t_STRING_TYPE >
 Json (BSLMF_MOVABLEREF_DEDUCE(t_STRING_TYPE) string, bslma::Allocator *basicAllocator=0, typename bsl::enable_if< bsl::is_same< t_STRING_TYPE, bsl::string >::value >::type *=0)
 
Jsonoperator= (const Json &rhs)
 
Jsonoperator= (bslmf::MovableRef< Json > rhs)
 
Jsonoperator= (const JsonNumber &rhs)
 
Jsonoperator= (int rhs)
 
Jsonoperator= (unsigned int rhs)
 
Jsonoperator= (long rhs)
 
Jsonoperator= (unsigned long rhs)
 
Jsonoperator= (long long rhs)
 
Jsonoperator= (unsigned long long rhs)
 
Jsonoperator= (float rhs)
 
Jsonoperator= (double rhs)
 
Jsonoperator= (bdldfp::Decimal64 rhs)
 
Jsonoperator= (bslmf::MovableRef< JsonNumber > rhs)
 
Jsonoperator= (const char *rhs)
 
Jsonoperator= (const bsl::string_view &rhs)
 
template<class t_STRING_TYPE >
bsl::enable_if< bsl::is_same< t_STRING_TYPE, bsl::string >::value, Json >::typeoperator= (BSLMF_MOVABLEREF_DEDUCE(t_STRING_TYPE) rhs)
 
Jsonoperator= (bool rhs)
 
Jsonoperator= (const JsonObject &rhs)
 
Jsonoperator= (bslmf::MovableRef< JsonObject > rhs)
 
Jsonoperator= (const JsonArray &rhs)
 
Jsonoperator= (bslmf::MovableRef< JsonArray > rhs)
 
Jsonoperator= (const JsonNull &)
 
Jsonoperator= (bslmf::MovableRef< JsonNull >)
 
JsonArraymakeArray ()
 
JsonArraymakeArray (const JsonArray &array)
 
JsonArraymakeArray (bslmf::MovableRef< JsonArray > array)
 
bool & makeBoolean ()
 
bool & makeBoolean (bool boolean)
 
void makeNull ()
 
JsonNumbermakeNumber ()
 
JsonNumbermakeNumber (const JsonNumber &number)
 
JsonNumbermakeNumber (bslmf::MovableRef< JsonNumber > number)
 
JsonObjectmakeObject ()
 
JsonObjectmakeObject (const JsonObject &object)
 
JsonObjectmakeObject (bslmf::MovableRef< JsonObject > object)
 
void makeString (const char *string)
 
void makeString (const bsl::string_view &string)
 
template<class t_STRING_TYPE >
bsl::enable_if< bsl::is_same< t_STRING_TYPE, bsl::string >::value >::type makeString (BSLMF_MOVABLEREF_DEDUCE(t_STRING_TYPE) string)
 
JsonArraytheArray ()
 
bool & theBoolean ()
 
JsonNulltheNull ()
 
JsonNumbertheNumber ()
 
JsonObjecttheObject ()
 
Jsonoperator[] (const bsl::string_view &key)
 
Jsonoperator[] (bsl::size_t index)
 
bsl::pair< JsonObject::Iterator, bool > insert (const JsonObject::Member &member)
 
bsl::pair< JsonObject::Iterator, bool > insert (bslmf::MovableRef< JsonObject::Member > member)
 
template<class t_INPUT_ITERATOR >
bsl::enable_if<!bsl::is_convertible< t_INPUT_ITERATOR, bsl::string_view >::value, Json & >::type insert (t_INPUT_ITERATOR first, t_INPUT_ITERATOR last)
 
template<class t_VALUE , class t_STRING_VIEW >
bsl::enable_if<!bsl::is_integral< t_STRING_VIEW >::value &&bsl::is_convertible< t_STRING_VIEW, bsl::string_view >::value, bsl::pair< JsonObject::Iterator, bool > >::type insert (const t_STRING_VIEW &key, BSLS_COMPILERFEATURES_FORWARD_REF(t_VALUE) value)
 
template<class t_INDEX >
bsl::enable_if< bsl::is_integral< t_INDEX >::value &&!bsl::is_same< t_INDEX, bool >::value, JsonArray::Iterator >::type insert (t_INDEX index, const Json &json)
 
template<class t_INDEX >
bsl::enable_if< bsl::is_integral< t_INDEX >::value &&!bsl::is_same< t_INDEX, bool >::value, JsonArray::Iterator >::type insert (t_INDEX index, bslmf::MovableRef< Json > json)
 
template<class t_INDEX , class t_INPUT_ITERATOR >
bsl::enable_if< bsl::is_integral< t_INDEX >::value &&!bsl::is_same< t_INDEX, bool >::value, JsonArray::Iterator >::type insert (t_INDEX index, t_INPUT_ITERATOR first, t_INPUT_ITERATOR last)
 
JsonArray::Iterator insert (JsonArray::ConstIterator position, const Json &json)
 
JsonArray::Iterator insert (JsonArray::ConstIterator position, bslmf::MovableRef< Json > json)
 
template<class t_INPUT_ITERATOR >
JsonArray::Iterator insert (JsonArray::ConstIterator position, t_INPUT_ITERATOR first, t_INPUT_ITERATOR last)
 
JsonpushBack (const Json &json)
 
JsonpushBack (const JsonArray &array)
 
JsonpushBack (const JsonObject &object)
 
JsonpushBack (const JsonNumber &number)
 
JsonpushBack (bslmf::MovableRef< Json > json)
 
JsonpushBack (bslmf::MovableRef< JsonArray > array)
 
JsonpushBack (bslmf::MovableRef< JsonObject > object)
 
JsonpushBack (bslmf::MovableRef< JsonNumber > number)
 
JsonpushBack (const JsonNull &value)
 
JsonpushBack (bool value)
 
JsonpushBack (int value)
 
JsonpushBack (unsigned int value)
 
JsonpushBack (long value)
 
JsonpushBack (unsigned long value)
 
JsonpushBack (long long value)
 
JsonpushBack (unsigned long long value)
 
JsonpushBack (float value)
 
JsonpushBack (double value)
 
JsonpushBack (bdldfp::Decimal64 value)
 
JsonpushBack (const char *string)
 
JsonpushBack (const bsl::string_view &string)
 
template<class t_STRING_TYPE >
bsl::enable_if< bsl::is_same< t_STRING_TYPE, bsl::string >::value, Json & >::type pushBack (BSLMF_MOVABLEREF_DEDUCE(t_STRING_TYPE) string)
 
template<class RETURN_TYPE , class VISITOR >
RETURN_TYPE visit (BSLS_COMPILERFEATURES_FORWARD_REF(VISITOR) visitor)
 
void swap (Json &other)
 
int asShort (short *result) const
 
int asInt (int *result) const
 
int asLong (long *result) const
 
int asLonglong (long long *result) const
 
int asInt64 (bsls::Types::Int64 *result) const
 
int asUshort (unsigned short *result) const
 
int asUint (unsigned int *result) const
 
int asUlong (unsigned long *result) const
 
int asUlonglong (unsigned long long *result) const
 
int asUint64 (bsls::Types::Uint64 *result) const
 
float asFloat () const
 
double asDouble () const
 
bdldfp::Decimal64 asDecimal64 () const
 
int asDecimal64Exact (bdldfp::Decimal64 *result) const
 
bool isArray () const
 
bool isBoolean () const
 
bool isNull () const
 
bool isNumber () const
 
bool isObject () const
 
bool isString () const
 
const JsonArraytheArray () const
 
const bool & theBoolean () const
 
const JsonNulltheNull () const
 
const JsonNumbertheNumber () const
 
const JsonObjecttheObject () const
 
const bsl::stringtheString () const
 
JsonType::Enum type () const BSLS_KEYWORD_NOEXCEPT
 
const Jsonoperator[] (const bsl::string_view &key) const
 
const Jsonoperator[] (bsl::size_t index) const
 
bsl::size_t size () const
 
bool contains (const bsl::string_view &key) const
 
template<class RETURN_TYPE , class VISITOR >
RETURN_TYPE visit (BSLS_COMPILERFEATURES_FORWARD_REF(VISITOR) visitor) const
 
bslma::Allocatorallocator () const BSLS_KEYWORD_NOEXCEPT
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Friends

bool operator== (const Json &, const Json &)
 
bool operator!= (const Json &, const Json &)
 
void swap (Json &, Json &)
 

Constructor & Destructor Documentation

◆ Json() [1/25]

bdljsn::Json::Json ( )
inline

Create a Json object having the type (and the singleton value) of JsonNull. Optionally specify the basicAllocator used to supply memory. If basicAllocator is not specified, the currently installed default allocator is used to supply memory.

◆ Json() [2/25]

bdljsn::Json::Json ( bslma::Allocator basicAllocator)
inlineexplicit

◆ Json() [3/25]

bdljsn::Json::Json ( const Json original,
bslma::Allocator basicAllocator = 0 
)
inline

Create a Json object 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.

◆ Json() [4/25]

bdljsn::Json::Json ( bslmf::MovableRef< Json original)
inline

Create a Json object 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 Json object. original is left in a valid but unspecified state.

◆ Json() [5/25]

bdljsn::Json::Json ( bslmf::MovableRef< Json original,
bslma::Allocator basicAllocator 
)
inline

Create a Json object having the same value as the specified original. Use the specified basicAllocator to supply memory.

◆ Json() [6/25]

bdljsn::Json::Json ( bool  boolean,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

Create a Json object having the type bool and the same value as the specified boolean. Optionally specify the basicAllocator used to supply memory. If basicAllocator is not specified, the currently installed default allocator is used to supply memory.

◆ Json() [7/25]

bdljsn::Json::Json ( const JsonNull null,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

Create a Json object having the type JsonNull and the same value as the specified null. Optionally specify the basicAllocator used to supply memory. If basicAllocator is not specified, the currently installed default allocator is used to supply memory.

◆ Json() [8/25]

bdljsn::Json::Json ( const JsonArray array,
bslma::Allocator basicAllocator = 0 
)
inline

Create a Json object having the type JsonArray/JsonObject/ JsonNumber and the value of the specified array/object/number. Optionally specify basicAllocator used to supply memory. If basicAllocator is not specified, the currently installed default allocator is used to supply memory.

◆ Json() [9/25]

bdljsn::Json::Json ( const JsonObject object,
bslma::Allocator basicAllocator = 0 
)
inline

◆ Json() [10/25]

bdljsn::Json::Json ( const JsonNumber number,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

◆ Json() [11/25]

bdljsn::Json::Json ( bslmf::MovableRef< JsonArray array,
bslma::Allocator basicAllocator = 0 
)
inline

Create a Json object having the type JsonArray/JsonObject/ JsonNumber and the value of the specified array/object/ number object by moving the contents of array/object/number to the new object. Optionally specify basicAllocator used to supply memory. If basicAllocator is not specified, the allocator associated with array/object/number is propagated for use in the newly-created Json object. The allocator or array/object/ number is unchanged and is otherwise left in (valid) unspecified state.

◆ Json() [12/25]

bdljsn::Json::Json ( bslmf::MovableRef< JsonObject object,
bslma::Allocator basicAllocator = 0 
)
inline

◆ Json() [13/25]

bdljsn::Json::Json ( bslmf::MovableRef< JsonNumber number,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

◆ Json() [14/25]

bdljsn::Json::Json ( int  value,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

Create a Json object having the type JsonNumber and the the specified value. Optionally specify the basicAllocator used to supply memory. If basicAllocator is not specified, the currently installed default allocator is used to supply memory.

◆ Json() [15/25]

bdljsn::Json::Json ( unsigned int  value,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

◆ Json() [16/25]

bdljsn::Json::Json ( long  value,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

◆ Json() [17/25]

bdljsn::Json::Json ( unsigned long  value,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

◆ Json() [18/25]

bdljsn::Json::Json ( long long  value,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

◆ Json() [19/25]

bdljsn::Json::Json ( unsigned long long  value,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

◆ Json() [20/25]

bdljsn::Json::Json ( float  value,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

◆ Json() [21/25]

bdljsn::Json::Json ( double  value,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

◆ Json() [22/25]

bdljsn::Json::Json ( bdldfp::Decimal64  value,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

◆ Json() [23/25]

bdljsn::Json::Json ( const char *  string,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

Create a Json object having the type bsl::string and the same value as the specified string. Optionally specify the basicAllocator used to supply memory. If basicAllocator is not specified, the currently installed default allocator is used to supply memory.

Precondition
The behavior is undefined unless string is valid UTF-8 (see bdlde::Utf8Util::isValid).

◆ Json() [24/25]

bdljsn::Json::Json ( const bsl::string_view string,
bslma::Allocator basicAllocator = 0 
)
inlineexplicit

◆ Json() [25/25]

template<class t_STRING_TYPE >
bdljsn::Json::Json ( BSLMF_MOVABLEREF_DEDUCE(t_STRING_TYPE)  string,
bslma::Allocator basicAllocator = 0,
typename bsl::enable_if< bsl::is_same< t_STRING_TYPE, bsl::string >::value >::type = 0 
)
inline

Create a Json object having the type bsl::string and the same value as the specified string by moving (in constant time) the contents of string to the new Json object. Optionally specify the basicAllocator used to supply memory. If basicAllocator is not specified, the allocator associated with string is propagated for use in the newly-created Json object. string is left in a valid but unspecified state. This function does not participate in overload resolution unless the specified t_STRING_TYPE is bsl::string.

Precondition
The behavior is undefined unless string is valid UTF-8 (see bdlde::Utf8Util::isValid).

Member Function Documentation

◆ allocator()

bslma::Allocator * bdljsn::Json::allocator ( ) const
inline

Return the allocator used by this object to allocate memory.

◆ asDecimal64()

bdldfp::Decimal64 bdljsn::Json::asDecimal64 ( ) const
inline

◆ asDecimal64Exact()

int bdljsn::Json::asDecimal64Exact ( bdldfp::Decimal64 result) const
inline

Load the specified result with the closest floating point representation to the value of type JsonNumber held by this object, even if a non-zero status is returned. Return 0 if this number can be represented exactly, and return JsonNumber::k_INEXACT if value cannot be represented exactly. If this number is outside the representable range, load result with +INF or -INF (as appropriate). A number can be represented exactly as a Decimal64 if, for the significand and exponent, abs(significand) <= 9,999,999,999,999,999 and -398 <= exponent <= 369.

Precondition
The behavior is undefined unless isNumber() returns true;

◆ asDouble()

double bdljsn::Json::asDouble ( ) const
inline

◆ asFloat()

float bdljsn::Json::asFloat ( ) const
inline

Return the closest floating point representation to the value of the type JsonNumber held by this object. If this number is outside the representable range, return +INF or -INF (as appropriate).

Precondition
The behavior is undefined unless isNumber() returns true.

◆ asInt()

int bdljsn::Json::asInt ( int *  result) const
inline

◆ asInt64()

int bdljsn::Json::asInt64 ( bsls::Types::Int64 result) const
inline

◆ asLong()

int bdljsn::Json::asLong ( long *  result) const
inline

◆ asLonglong()

int bdljsn::Json::asLonglong ( long long *  result) const
inline

◆ asShort()

int bdljsn::Json::asShort ( short *  result) const
inline

Load into the specified result the integer value of the value of type JsonNumber held by this object. Return 0 on success, JsonNumber::k_OVERFLOW if value is larger than can be represented by result, JsonNumber::k_UNDERFLOW if value is smaller than can be represented by result, and JsonNumber::k_NOT_INTEGRAL if value is not an integral number (i.e., there is a fractional part). For underflow, result will be loaded with the minimum representable value, for overflow, result will be loaded with the maximum representable value, for non-integral values result will be loaded with the integer part of value (truncating the value to the nearest integer). If the result is not an integer and also either overflows or underflows, it is treated as an overflow or underflow (respectively).

Note
Note that this operation returns a status value (unlike similar floating point conversions) because typically it is an error if a conversion to an integer results in an inexact value.
Precondition
The behavior is undefined unless isNumber() returns true. Also note that on all supported platforms bsls::Types::Int64 and bsls::Types::Uint64 are, respectively, aliases for long long and unsigned long long.

◆ asUint()

int bdljsn::Json::asUint ( unsigned int *  result) const
inline

◆ asUint64()

int bdljsn::Json::asUint64 ( bsls::Types::Uint64 result) const
inline

◆ asUlong()

int bdljsn::Json::asUlong ( unsigned long *  result) const
inline

◆ asUlonglong()

int bdljsn::Json::asUlonglong ( unsigned long long *  result) const
inline

◆ asUshort()

int bdljsn::Json::asUshort ( unsigned short *  result) const
inline

◆ BSLMF_NESTED_TRAIT_DECLARATION() [1/3]

bdljsn::Json::BSLMF_NESTED_TRAIT_DECLARATION ( Json  ,
bdlb::HasPrintMethod   
)

◆ BSLMF_NESTED_TRAIT_DECLARATION() [2/3]

bdljsn::Json::BSLMF_NESTED_TRAIT_DECLARATION ( Json  ,
bslma::UsesBslmaAllocator   
)

◆ BSLMF_NESTED_TRAIT_DECLARATION() [3/3]

bdljsn::Json::BSLMF_NESTED_TRAIT_DECLARATION ( Json  ,
bslmf::IsBitwiseMoveable   
)

◆ contains()

bool bdljsn::Json::contains ( const bsl::string_view key) const
inline

Return true if the JsonObject held by this Json object contains a member whose key is equivalent to the specified key, and return false otherwise.

Precondition
The behavior is undefined unless true == isObject().

◆ insert() [1/10]

bsl::pair< JsonObject::Iterator, bool > bdljsn::Json::insert ( bslmf::MovableRef< JsonObject::Member member)
inline

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.

Precondition
The behavior is undefined unless isObject() or isNull(), and unless member.first is valid UTF-8 (see bdlde::Utf8Util::isValid).

◆ insert() [2/10]

bsl::pair< JsonObject::Iterator, bool > bdljsn::Json::insert ( const JsonObject::Member member)
inline

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.

Precondition
The behavior is undefined unless isObject() or isNull(), and unless member.first is valid UTF-8 (see bdlde::Utf8Util::isValid).

◆ insert() [3/10]

template<class t_VALUE , class t_STRING_VIEW >
bsl::enable_if<!bsl::is_integral< t_STRING_VIEW >::value &&bsl::is_convertible< t_STRING_VIEW, bsl::string_view >::value, bsl::pair< JsonObject::Iterator, bool > >::type bdljsn::Json::insert ( const t_STRING_VIEW &  key,
BSLS_COMPILERFEATURES_FORWARD_REF(t_VALUE)  value 
)
inline

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.

Precondition
The behavior is undefined unless isObject() or isNull(), and unless key is valid UTF-8 (see bdlde::Utf8Util::isValid).

◆ insert() [4/10]

JsonArray::Iterator bdljsn::Json::insert ( JsonArray::ConstIterator  position,
bslmf::MovableRef< Json json 
)
inline

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().

Precondition
The behavior is undefined unless isArray() and position is in the range [theArray().begin() .. theArray().end()].

◆ insert() [5/10]

JsonArray::Iterator bdljsn::Json::insert ( JsonArray::ConstIterator  position,
const Json json 
)
inline

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().

Precondition
The behavior is undefined unless isArray() and position is in the range [theArray().begin() .. theArray().end()].

◆ insert() [6/10]

template<class t_INPUT_ITERATOR >
JsonArray::Iterator bdljsn::Json::insert ( JsonArray::ConstIterator  position,
t_INPUT_ITERATOR  first,
t_INPUT_ITERATOR  last 
)
inline

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().

Precondition
The behavior is undefined unless isArray() and position is in the range [theArray().begin() .. theArray().end()].

◆ insert() [7/10]

template<class t_INDEX >
bsl::enable_if< bsl::is_integral< t_INDEX >::value &&!bsl::is_same< t_INDEX, bool >::value, JsonArray::Iterator >::type bdljsn::Json::insert ( t_INDEX  index,
bslmf::MovableRef< Json json 
)
inline

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.

Precondition
The behavior is undefined unless isArray() or isNull(), and unless index is in the range [0 .. size()].

◆ insert() [8/10]

template<class t_INDEX >
bsl::enable_if< bsl::is_integral< t_INDEX >::value &&!bsl::is_same< t_INDEX, bool >::value, JsonArray::Iterator >::type bdljsn::Json::insert ( t_INDEX  index,
const Json json 
)
inline

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.

Precondition
The behavior is undefined unless isArray() or isNull(), and unless index is in the range [0 .. size()].

◆ insert() [9/10]

template<class t_INDEX , class t_INPUT_ITERATOR >
bsl::enable_if< bsl::is_integral< t_INDEX >::value &&!bsl::is_same< t_INDEX, bool >::value, JsonArray::Iterator >::type bdljsn::Json::insert ( t_INDEX  index,
t_INPUT_ITERATOR  first,
t_INPUT_ITERATOR  last 
)
inline

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.

Precondition
The behavior is undefined unless isArray() or isNull(), and unless index is in the range [0 .. size()].

◆ insert() [10/10]

template<class t_INPUT_ITERATOR >
bsl::enable_if<!bsl::is_convertible< t_INPUT_ITERATOR, bsl::string_view >::value, Json & >::type bdljsn::Json::insert ( t_INPUT_ITERATOR  first,
t_INPUT_ITERATOR  last 
)
inline

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.

Precondition
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).

◆ isArray()

bool bdljsn::Json::isArray ( ) const
inline

Return true if the value held by this object is of type JsonArray, and false otherwise.

◆ isBoolean()

bool bdljsn::Json::isBoolean ( ) const
inline

Return true if the value held by this object is of type bool, and false otherwise.

◆ isNull()

bool bdljsn::Json::isNull ( ) const
inline

Return true if the value held by this object is of type JsonNull, and false otherwise.

◆ isNumber()

bool bdljsn::Json::isNumber ( ) const
inline

Return true if the value held by this object is of type JsonNumber, and false otherwise.

◆ isObject()

bool bdljsn::Json::isObject ( ) const
inline

Return true if the value held by this object is of type JsonObject, and false otherwise.

◆ isString()

bool bdljsn::Json::isString ( ) const
inline

Return true if the value held by this object is of type bsl::string, and false otherwise.

◆ makeArray() [1/3]

JsonArray & bdljsn::Json::makeArray ( )
inline

Create an instance of type JsonArray in this object, using the allocator currently held by this object to supply memory, and return a reference providing modifiable access to the created instance. Optionally specify array to initialize the JsonArray created. This method first destroys the current value held by this object (even if the type currently held is JsonArray).

◆ makeArray() [2/3]

JsonArray & bdljsn::Json::makeArray ( bslmf::MovableRef< JsonArray array)
inline

◆ makeArray() [3/3]

JsonArray & bdljsn::Json::makeArray ( const JsonArray array)
inline

◆ makeBoolean() [1/2]

bool & bdljsn::Json::makeBoolean ( )
inline

Create an instance of type bool in this object and return a reference providing modifiable access to the created instance. Optionally specify boolean to initialize the bool created. This method first destroys the current value held by this object.

◆ makeBoolean() [2/2]

bool & bdljsn::Json::makeBoolean ( bool  boolean)
inline

◆ makeNull()

void bdljsn::Json::makeNull ( )
inline

Create an instance of type JsonNull in this object. This method first destroys the current value held by this object.

◆ makeNumber() [1/3]

JsonNumber & bdljsn::Json::makeNumber ( )
inline

Create an instance of type JsonNumber in this object, using the allocator currently held by this object to supply memory, and return a reference providing modifiable access to the created instance. Optionally specify number to initialize the JsonNumber created. This method first destroys the current value held by this object (even if the type currently held is JsonNumber).

◆ makeNumber() [2/3]

JsonNumber & bdljsn::Json::makeNumber ( bslmf::MovableRef< JsonNumber number)
inline

◆ makeNumber() [3/3]

JsonNumber & bdljsn::Json::makeNumber ( const JsonNumber number)
inline

◆ makeObject() [1/3]

JsonObject & bdljsn::Json::makeObject ( )
inline

Create an instance of type JsonObject in this object, using the allocator currently held by this object to supply memory, and return a reference providing modifiable access to the created instance. Optionally specify object to initialize the JsonObject created. This method first destroys the current value held by this object (even if the type currently held is JsonObject).

◆ makeObject() [2/3]

JsonObject & bdljsn::Json::makeObject ( bslmf::MovableRef< JsonObject object)
inline

◆ makeObject() [3/3]

JsonObject & bdljsn::Json::makeObject ( const JsonObject object)
inline

◆ makeString() [1/3]

template<class t_STRING_TYPE >
bsl::enable_if< bsl::is_same< t_STRING_TYPE, bsl::string >::value >::type bdljsn::Json::makeString ( BSLMF_MOVABLEREF_DEDUCE(t_STRING_TYPE)  string)
inline

Create an instance of type bsl::string in this object, using the allocator currently held by this object to supply memory. Optionally specify string to initialize the bsl::string created. This method first destroys the current value held by this object (even if the type currently held is bsl::string). This function does not participate in overload resolution unless the specified t_STRING_TYPE is bsl::string.

Precondition
The behavior is undefined unless string is valid UTF-8 (see bdlde::Utf8Util::isValid).

◆ makeString() [2/3]

void bdljsn::Json::makeString ( const bsl::string_view string)
inline

◆ makeString() [3/3]

void bdljsn::Json::makeString ( const char *  string)
inline

Create an instance of type bsl::string in this object, using the allocator currently held by this object to supply memory. Optionally specify string to initialize the bsl::string created. This method first destroys the current value held by this object (even if the type currently held is bsl::string).

Precondition
The behavior is undefined unless string is valid UTF-8 (see bdlde::Utf8Util::isValid).

◆ operator=() [1/23]

Json & bdljsn::Json::operator= ( bdldfp::Decimal64  rhs)
inline

◆ operator=() [2/23]

Json & bdljsn::Json::operator= ( bool  rhs)
inline

Assign to this object a value of type bool initialized from the specified rhs, and return a reference providing modifiable access to this object. The value currently held by this object (if any) is destroyed if that value's type is not bool.

◆ operator=() [3/23]

Json & bdljsn::Json::operator= ( bslmf::MovableRef< Json rhs)
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 Json object if allocator() == rhs.allocator(); otherwise they are copied. rhs is left in a valid but unspecified state.

◆ operator=() [4/23]

Json & bdljsn::Json::operator= ( bslmf::MovableRef< JsonArray rhs)
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 Json object if allocator() == rhs.allocator(); otherwise, they are copied. rhs is left in a valid but unspecified state. The value currently held by this object (if any) is destroyed if that value's type is not JsonArray.

◆ operator=() [5/23]

Json & bdljsn::Json::operator= ( bslmf::MovableRef< JsonNull )
inline

Assign to this object the singleton value of type JsonNull, and return a reference providing modifiable access to this object. rhs is left in a valid but unspecified state. The value currently held by this object (if any) is destroyed if that value's type is not JsonNull.

◆ operator=() [6/23]

Json & bdljsn::Json::operator= ( bslmf::MovableRef< JsonNumber rhs)
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 Json object if allocator() == rhs.allocator(); otherwise, they are copied. rhs is left in a valid but unspecified state. The value currently held by this object (if any) is destroyed if that value's type is not JsonNumber.

◆ operator=() [7/23]

Json & bdljsn::Json::operator= ( bslmf::MovableRef< JsonObject rhs)
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 Json object if allocator() == rhs.allocator(); otherwise, they are copied. rhs is left in a valid but unspecified state. The value currently held by this object (if any) is destroyed if that value's type is not JsonObject.

◆ operator=() [8/23]

template<class t_STRING_TYPE >
bsl::enable_if< bsl::is_same< t_STRING_TYPE, bsl::string >::value, Json >::type & bdljsn::Json::operator= ( BSLMF_MOVABLEREF_DEDUCE(t_STRING_TYPE)  rhs)

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 Json object if allocator() == rhs.allocator(); otherwise, they are copied. rhs is left in a valid but unspecified state. The value currently held by this object (if any) is destroyed if that value's type is not bsl::string. This function does not participate in overload resolution unless the specified t_STRING_TYPE is bsl::string.

Precondition
The behavior is undefined unless rhs is valid UTF-8 (see bdlde::Utf8Util::isValid).

◆ operator=() [9/23]

Json & bdljsn::Json::operator= ( const bsl::string_view rhs)
inline

◆ operator=() [10/23]

Json & bdljsn::Json::operator= ( const char *  rhs)
inline

Assign to this object a value of type bsl::string initialized from the specified rhs, and return a reference providing modifiable access to this object. The value currently held by this object (if any) is destroyed if that value's type is not bsl::string.

Precondition
The behavior is undefined unless rhs is valid UTF-8 (see bdlde::Utf8Util::isValid).

◆ operator=() [11/23]

Json & bdljsn::Json::operator= ( const Json rhs)
inline

Assign to this object the value of the specified rhs object, and return a reference providing modifiable access to this object. The value currently held by this variant is destroyed if that value's type is not the same as the type held by the rhs object.

◆ operator=() [12/23]

Json & bdljsn::Json::operator= ( const JsonArray rhs)
inline

Assign to this object a value of type JsonArray initialized from the specified rhs, and return a reference providing modifiable access to this object. The value currently held by this object (if any) is destroyed if that value's type is not JsonArray.

◆ operator=() [13/23]

Json & bdljsn::Json::operator= ( const JsonNull )
inline

Assign to this object the singleton value of type JsonNull, and return a reference providing modifiable access to this object. The value currently held by this object (if any) is destroyed if that value's type is not JsonNull.

◆ operator=() [14/23]

Json & bdljsn::Json::operator= ( const JsonNumber rhs)
inline

Assign to this object a value of type JsonNumber initialized from the specified rhs, and return a reference providing modifiable access to this object. The value currently held by this object (if any) is destroyed if that value's type is not JsonNumber.

◆ operator=() [15/23]

Json & bdljsn::Json::operator= ( const JsonObject rhs)
inline

Assign to this object a value of type JsonObject initialized from the specified rhs, and return a reference providing modifiable access to this object. The value currently held by this object (if any) is destroyed if that value's type is not JsonObject.

◆ operator=() [16/23]

Json & bdljsn::Json::operator= ( double  rhs)
inline

◆ operator=() [17/23]

Json & bdljsn::Json::operator= ( float  rhs)
inline

◆ operator=() [18/23]

Json & bdljsn::Json::operator= ( int  rhs)
inline

◆ operator=() [19/23]

Json & bdljsn::Json::operator= ( long long  rhs)
inline

◆ operator=() [20/23]

Json & bdljsn::Json::operator= ( long  rhs)
inline

◆ operator=() [21/23]

Json & bdljsn::Json::operator= ( unsigned int  rhs)
inline

◆ operator=() [22/23]

Json & bdljsn::Json::operator= ( unsigned long long  rhs)
inline

◆ operator=() [23/23]

Json & bdljsn::Json::operator= ( unsigned long  rhs)
inline

◆ operator[]() [1/4]

Json & bdljsn::Json::operator[] ( bsl::size_t  index)
inline

Return a reference providing modifiable access to the element at the specified index in the JsonArray held by this object.

Precondition
The behavior is undefined unless isArray() returns true and index < theArray().size().

◆ operator[]() [2/4]

const Json & bdljsn::Json::operator[] ( bsl::size_t  index) const
inline

Return a reference providing non-modifiable access to the element at the specified index in the JsonArray held by this object.

Precondition
The behavior is undefined unless isArray() returns true and index < theArray().size().

◆ operator[]() [3/4]

Json & bdljsn::Json::operator[] ( const bsl::string_view key)
inline

Return a reference providing modifiable access to the Json object associated with the specified key in the JsonObject held by this object. If isNull(), then type is changed to object. If the JsonObject does not already contain a Json object associated with key, first insert a new default-constructed Json object associated with key.

Precondition
The behavior is undefined unless isObject() or isNull().

◆ operator[]() [4/4]

const Json & bdljsn::Json::operator[] ( const bsl::string_view key) const
inline

Return a reference providing non-modifiable access to the Json object associated with the specified key in this JsonObject.

Precondition
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.

◆ print()

bsl::ostream & bdljsn::Json::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
Note that this human-readable format is not fully specified, and can change without notice.

◆ pushBack() [1/22]

Json & bdljsn::Json::pushBack ( bdldfp::Decimal64  value)
inline

◆ pushBack() [2/22]

Json & bdljsn::Json::pushBack ( bool  value)
inline

◆ pushBack() [3/22]

Json & bdljsn::Json::pushBack ( bslmf::MovableRef< Json json)
inline

Append to the end of this Json object's array the specified move-insertable json/array/object/number and return a non-const reference to this object. json/array/object/number is left in a valid but unspecified state. If isNull, then the type is changed to array. If an exception is thrown, *this is unaffected. Throw bsl::length_error if size() == maxSize().

Precondition
The behavior is undefined unless isArray() or isNull().

◆ pushBack() [4/22]

Json & bdljsn::Json::pushBack ( bslmf::MovableRef< JsonArray array)
inline

◆ pushBack() [5/22]

Json & bdljsn::Json::pushBack ( bslmf::MovableRef< JsonNumber number)
inline

◆ pushBack() [6/22]

Json & bdljsn::Json::pushBack ( bslmf::MovableRef< JsonObject object)
inline

◆ pushBack() [7/22]

template<class t_STRING_TYPE >
bsl::enable_if< bsl::is_same< t_STRING_TYPE, bsl::string >::value, Json & >::type bdljsn::Json::pushBack ( BSLMF_MOVABLEREF_DEDUCE(t_STRING_TYPE)  string)
inline

Append to the end of this Json object's array an element having value of the specified string by moving (in constant time) the contents of string to the new element and return a non-const reference to this object. If isNull(), then the type is changed to array. string is left in a valid but unspecified state. This function does not participate in overload resolution unless the specified t_STRING_TYPE is bsl::string.

Precondition
The behavior is undefined unless string is valid UTF-8 (see bdlde::Utf8Util::isValid).
The behavior is undefined unless isArray() or isNull().

◆ pushBack() [8/22]

Json & bdljsn::Json::pushBack ( const bsl::string_view string)
inline

◆ pushBack() [9/22]

Json & bdljsn::Json::pushBack ( const char *  string)
inline

Append to the end of this Json object's array a copy of the specified string and return a non-const reference to this object. If isNull, then type is changed to array. If an exception is thrown, *this is unaffected. Throw bsl::length_error if size() == maxSize().

Precondition
The behavior is undefined unless isArray() or isNull().

◆ pushBack() [10/22]

Json & bdljsn::Json::pushBack ( const Json json)
inline

Append to the end of this Json object's array a copy of the specified json/array/object/number and return a non-const reference to this object. If isNull(), then the type is changed to array. If an exception is thrown, *this is unaffected. Throw bsl::length_error if size() == maxSize().

Precondition
The behavior is undefined unless isArray() or isNull().

◆ pushBack() [11/22]

Json & bdljsn::Json::pushBack ( const JsonArray array)
inline

◆ pushBack() [12/22]

Json & bdljsn::Json::pushBack ( const JsonNull value)
inline

Append to the end of this Json object's array a copy of the specified value and return a non-const reference to this object. If isNull(), then type is changed to array. If an exception is thrown, *this is unaffected. Throw bsl::length_error if size() == maxSize().

Precondition
The behavior is undefined unless isArray() or isNull().

◆ pushBack() [13/22]

Json & bdljsn::Json::pushBack ( const JsonNumber number)
inline

◆ pushBack() [14/22]

Json & bdljsn::Json::pushBack ( const JsonObject object)
inline

◆ pushBack() [15/22]

Json & bdljsn::Json::pushBack ( double  value)
inline

◆ pushBack() [16/22]

Json & bdljsn::Json::pushBack ( float  value)
inline

◆ pushBack() [17/22]

Json & bdljsn::Json::pushBack ( int  value)
inline

◆ pushBack() [18/22]

Json & bdljsn::Json::pushBack ( long long  value)
inline

◆ pushBack() [19/22]

Json & bdljsn::Json::pushBack ( long  value)
inline

◆ pushBack() [20/22]

Json & bdljsn::Json::pushBack ( unsigned int  value)
inline

◆ pushBack() [21/22]

Json & bdljsn::Json::pushBack ( unsigned long long  value)
inline

◆ pushBack() [22/22]

Json & bdljsn::Json::pushBack ( unsigned long  value)
inline

◆ size()

bsl::size_t bdljsn::Json::size ( ) const
inline

Return the number of elements in the JsonObject or JsonArray held by this object.

Precondition
The behavior is undefined unless isArray() || isObject() evaluates to true.

◆ swap()

void bdljsn::Json::swap ( Json other)
inline

Exchange the value of this with that of the specified other. If an exception is thrown, both objects are left in valid but unspecified states. This operation guarantees O[1] complexity.

Precondition
The behavior is undefined unless this object was created with the same allocator as other.

◆ theArray() [1/2]

JsonArray & bdljsn::Json::theArray ( )
inline

Return a reference providing modifiable access to the value of type JsonArray held by this object.

Precondition
The behavior is undefined unless isArray() returns true.

◆ theArray() [2/2]

const JsonArray & bdljsn::Json::theArray ( ) const
inline

Return a reference providing non-modifiable access to the value of type JsonArray held by this object.

Precondition
The behavior is undefined unless isArray() returns true.

◆ theBoolean() [1/2]

bool & bdljsn::Json::theBoolean ( )
inline

Return a reference providing modifiable access to the value of type boolean held by this object.

Precondition
The behavior is undefined unless isBoolean() returns true.

◆ theBoolean() [2/2]

const bool & bdljsn::Json::theBoolean ( ) const
inline

Return a reference providing non-modifiable access to the value of type boolean held by this object.

Precondition
The behavior is undefined unless isBoolean() returns true.

◆ theNull() [1/2]

JsonNull & bdljsn::Json::theNull ( )
inline

Return a reference providing modifiable access to the value of type JsonNull held by this object.

Precondition
The behavior is undefined unless isNull() returns true.

◆ theNull() [2/2]

const JsonNull & bdljsn::Json::theNull ( ) const
inline

Return a reference providing non-modifiable access to the value of type JsonNull held by this object.

Precondition
The behavior is undefined unless isNull() returns true.

◆ theNumber() [1/2]

JsonNumber & bdljsn::Json::theNumber ( )
inline

Return a reference providing modifiable access to the value of type JsonNumber held by this object.

Precondition
The behavior is undefined unless isNumber() returns true.

◆ theNumber() [2/2]

const JsonNumber & bdljsn::Json::theNumber ( ) const
inline

Return a reference providing non-modifiable access to the value of type JsonNumber held by this object.

Precondition
The behavior is undefined unless isNumber() returns true.

◆ theObject() [1/2]

JsonObject & bdljsn::Json::theObject ( )
inline

Return a reference providing modifiable access to the value of type JsonObject held by this object.

Precondition
The behavior is undefined unless isObject() returns true.

◆ theObject() [2/2]

const JsonObject & bdljsn::Json::theObject ( ) const
inline

Return a reference providing non-modifiable access to the value of type JsonObject held by this object.

Precondition
The behavior is undefined unless isObject() returns true.

◆ theString()

const bsl::string & bdljsn::Json::theString ( ) const
inline

Return a reference providing non-modifiable access to the value of type JsonString held by this object.

Precondition
The behavior is undefined unless isString() returns true.

◆ type()

JsonType::Enum bdljsn::Json::type ( ) const
inline

Return the type of this Json value.

◆ visit() [1/2]

template<class RETURN_TYPE , class VISITOR >
RETURN_TYPE bdljsn::Json::visit ( BSLS_COMPILERFEATURES_FORWARD_REF(VISITOR)  visitor)

Return the result (having RETURN_TYPE) of invoking the specified visitor (callable) object on this Json object. visitor must be callable as if it provides the following overloads of operator():

RETURN_TYPE operator()(JsonObject *object );
RETURN_TYPE operator()(JsonArray *array );
RETURN_TYPE operator()(bsl::string *string );
RETURN_TYPE operator()(JsonNumber *number );
RETURN_TYPE operator()(bool *boolean);
RETURN_TYPE operator()(JsonNull *null );
Definition bdljsn_json.h:551
Definition bdljsn_jsonnull.h:121
Definition bdljsn_jsonnumber.h:412
Definition bdljsn_json.h:1080
Definition bslstl_string.h:1252

The overload corresponding to the current type() of this Json object is invoked. For C++03 visitor must be const qualified.

Precondition
The behavior is undefined unless all of these six overloads are defined.
The behavior is undefined if the string overload leaves this Json object with a string that is not valid UTF-8.
Note
Note that overloads that are not applicable in a given application need not do anything other than return. Also note that if visitor is const qualified then each of its operator() overloads must also be const qualified.

◆ visit() [2/2]

template<class RETURN_TYPE , class VISITOR >
RETURN_TYPE bdljsn::Json::visit ( BSLS_COMPILERFEATURES_FORWARD_REF(VISITOR)  visitor) const

Return the result (having RETURN_TYPE) of invoking the specified visitor (callable) object on this Json object. visitor must be callable as if it provides the following overloads of operator():

RETURN_TYPE operator()(const JsonObject& object );
RETURN_TYPE operator()(const JsonArray& array );
RETURN_TYPE operator()(const bsl::string& string );
RETURN_TYPE operator()(const JsonNumber& number );
RETURN_TYPE operator()(const bool& boolean);
RETURN_TYPE operator()(const JsonNull& null );

The overload corresponding to the current type() of this Json object is invoked. For C++03 visitor must be const-qualified.

Precondition
The behavior is undefined unless all of these six overloads are defined.
Note
Note that overloads that are not applicable in a given application need not do anything other than return. Also note that if visitor is const qualified then each of its operator() overloads must also be const qualified.

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const Json ,
const Json  
)
friend

Return false if the specified lhs and rhs objects have the same value, and true otherwise. Two Json objects lhs and rhs have the same value if they hold objects of the same type, and those objects have the same value.

◆ operator==

bool operator== ( const Json ,
const Json  
)
friend

Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two Json objects lhs and rhs have the same value if they hold objects of the same type, and those objects have the same value.

◆ swap

void swap ( Json ,
Json  
)
friend

Exchange the value of the specified a Json object with that of the specified b Json object. If an exception is thrown, both objects are left in valid but unspecified states. This operation guarantees O[1] complexity.

Precondition
The behavior is undefined unless a was created with the same allocator as b.

The documentation for this class was generated from the following file: