AWS IoT Device SDK C++ v2  1.32.6
AWS IoT Device SDK C++ v2
Public Member Functions | Friends | List of all members
Aws::Crt::JsonObject Class Reference

#include <JsonObject.h>

Public Member Functions

 JsonObject ()
 
 JsonObject (const String &stringToParse)
 
 JsonObject (const JsonObject &other)
 
 JsonObject (JsonObject &&other) noexcept
 
 ~JsonObject ()
 
JsonObjectoperator= (const JsonObject &other)
 
JsonObjectoperator= (JsonObject &&other) noexcept
 
bool operator== (const JsonObject &other) const
 
bool operator!= (const JsonObject &other) const
 
JsonObjectWithString (const String &key, const String &value)
 
JsonObjectWithString (const char *key, const String &value)
 
JsonObjectAsString (const String &value)
 
JsonObjectWithBool (const String &key, bool value)
 
JsonObjectWithBool (const char *key, bool value)
 
JsonObjectAsBool (bool value)
 
JsonObjectWithInteger (const String &key, int value)
 
JsonObjectWithInteger (const char *key, int value)
 
JsonObjectAsInteger (int value)
 
JsonObjectWithInt64 (const String &key, int64_t value)
 
JsonObjectWithInt64 (const char *key, int64_t value)
 
JsonObjectAsInt64 (int64_t value)
 
JsonObjectWithDouble (const String &key, double value)
 
JsonObjectWithDouble (const char *key, double value)
 
JsonObjectAsDouble (double value)
 
JsonObjectWithArray (const String &key, const Vector< String > &array)
 
JsonObjectWithArray (const char *key, const Vector< String > &array)
 
JsonObjectWithArray (const String &key, const Vector< JsonObject > &array)
 
JsonObjectWithArray (const String &key, Vector< JsonObject > &&array)
 
JsonObjectAsArray (const Vector< JsonObject > &array)
 
JsonObjectAsArray (Vector< JsonObject > &&array)
 
JsonObjectAsNull ()
 
JsonObjectWithObject (const String &key, const JsonObject &value)
 
JsonObjectWithObject (const char *key, const JsonObject &value)
 
JsonObjectWithObject (const String &key, JsonObject &&value)
 
JsonObjectWithObject (const char *key, JsonObject &&value)
 
JsonObjectAsObject (const JsonObject &value)
 
JsonObjectAsObject (JsonObject &&value)
 
bool WasParseSuccessful () const
 
const StringGetErrorMessage () const
 
JsonView View () const
 

Friends

class JsonView
 
class ApiHandle
 

Detailed Description

JSON DOM manipulation class. To read or serialize use View function.

Constructor & Destructor Documentation

◆ JsonObject() [1/4]

Aws::Crt::JsonObject::JsonObject ( )

Constructs empty JSON DOM.

◆ JsonObject() [2/4]

Aws::Crt::JsonObject::JsonObject ( const String stringToParse)

Constructs a JSON DOM by parsing the input string. Call WasParseSuccessful() on new object to determine if parse was successful.

◆ JsonObject() [3/4]

Aws::Crt::JsonObject::JsonObject ( const JsonObject other)

Construct a deep copy. Prefer using a JsonView if copying is not needed.

◆ JsonObject() [4/4]

Aws::Crt::JsonObject::JsonObject ( JsonObject &&  other)
noexcept

Move constructor. No copying is performed.

◆ ~JsonObject()

Aws::Crt::JsonObject::~JsonObject ( )

Member Function Documentation

◆ AsArray() [1/2]

JsonObject & Aws::Crt::JsonObject::AsArray ( const Vector< JsonObject > &  array)

Converts the current JSON node to an array whose values are deep-copied from the array parameter.

◆ AsArray() [2/2]

JsonObject & Aws::Crt::JsonObject::AsArray ( Vector< JsonObject > &&  array)

Converts the current JSON node to an array whose values are moved from the array parameter.

◆ AsBool()

JsonObject & Aws::Crt::JsonObject::AsBool ( bool  value)

Converts the current JSON node to a bool.

◆ AsDouble()

JsonObject & Aws::Crt::JsonObject::AsDouble ( double  value)

Converts the current JSON node to a number.

◆ AsInt64()

JsonObject & Aws::Crt::JsonObject::AsInt64 ( int64_t  value)

Converts the current JSON node to a number. Precision may be lost.

◆ AsInteger()

JsonObject & Aws::Crt::JsonObject::AsInteger ( int  value)

Converts the current JSON node to a number. Precision may be lost.

◆ AsNull()

JsonObject & Aws::Crt::JsonObject::AsNull ( )

Sets the current JSON node as null.

◆ AsObject() [1/2]

JsonObject & Aws::Crt::JsonObject::AsObject ( const JsonObject value)

Converts the current JSON node to a JSON object by deep-copying the parameter.

◆ AsObject() [2/2]

JsonObject & Aws::Crt::JsonObject::AsObject ( JsonObject &&  value)

Converts the current JSON node to a JSON object by moving from the parameter.

◆ AsString()

JsonObject & Aws::Crt::JsonObject::AsString ( const String value)

Converts the current JSON node to a string.

◆ GetErrorMessage()

const String & Aws::Crt::JsonObject::GetErrorMessage ( ) const

◆ operator!=()

bool Aws::Crt::JsonObject::operator!= ( const JsonObject other) const

◆ operator=() [1/2]

JsonObject & Aws::Crt::JsonObject::operator= ( const JsonObject other)

Performs a deep copy.

◆ operator=() [2/2]

JsonObject & Aws::Crt::JsonObject::operator= ( JsonObject &&  other)
noexcept

Moves the ownership of the internal JSON DOM of the parameter to the current object. No copying is performed. A DOM currently owned by the object will be freed prior to copying.

Warning
This will result in invalidating any outstanding views of the current DOM. However, views to the moved-from DOM would still valid.

◆ operator==()

bool Aws::Crt::JsonObject::operator== ( const JsonObject other) const

◆ View()

JsonView Aws::Crt::JsonObject::View ( ) const

Creates a view of this JSON node.

◆ WasParseSuccessful()

bool Aws::Crt::JsonObject::WasParseSuccessful ( ) const
inline

Returns true if the last parse request was successful.

◆ WithArray() [1/4]

JsonObject & Aws::Crt::JsonObject::WithArray ( const char *  key,
const Vector< String > &  array 
)

◆ WithArray() [2/4]

JsonObject & Aws::Crt::JsonObject::WithArray ( const String key,
const Vector< JsonObject > &  array 
)

Adds an array of arbitrary JSON objects to the top level of this node at key. The values in the array parameter will be deep-copied.

◆ WithArray() [3/4]

JsonObject & Aws::Crt::JsonObject::WithArray ( const String key,
const Vector< String > &  array 
)

Adds an array of strings to the top level of this node at key.

◆ WithArray() [4/4]

JsonObject & Aws::Crt::JsonObject::WithArray ( const String key,
Vector< JsonObject > &&  array 
)

Adds an array of arbitrary JSON objects to the top level of this node at key. The values in the array parameter will be moved-from.

◆ WithBool() [1/2]

JsonObject & Aws::Crt::JsonObject::WithBool ( const char *  key,
bool  value 
)

◆ WithBool() [2/2]

JsonObject & Aws::Crt::JsonObject::WithBool ( const String key,
bool  value 
)

Adds a bool value with key to the top level of this node.

◆ WithDouble() [1/2]

JsonObject & Aws::Crt::JsonObject::WithDouble ( const char *  key,
double  value 
)

◆ WithDouble() [2/2]

JsonObject & Aws::Crt::JsonObject::WithDouble ( const String key,
double  value 
)

Adds a number value at key at the top level of this node.

◆ WithInt64() [1/2]

JsonObject & Aws::Crt::JsonObject::WithInt64 ( const char *  key,
int64_t  value 
)

◆ WithInt64() [2/2]

JsonObject & Aws::Crt::JsonObject::WithInt64 ( const String key,
int64_t  value 
)

Adds a number value at key to the top level of this node. Precision may be lost.

◆ WithInteger() [1/2]

JsonObject & Aws::Crt::JsonObject::WithInteger ( const char *  key,
int  value 
)

◆ WithInteger() [2/2]

JsonObject & Aws::Crt::JsonObject::WithInteger ( const String key,
int  value 
)

Adds a number value at key at the top level of this node. Precision may be lost.

◆ WithObject() [1/4]

JsonObject & Aws::Crt::JsonObject::WithObject ( const char *  key,
const JsonObject value 
)

◆ WithObject() [2/4]

JsonObject & Aws::Crt::JsonObject::WithObject ( const char *  key,
JsonObject &&  value 
)

◆ WithObject() [3/4]

JsonObject & Aws::Crt::JsonObject::WithObject ( const String key,
const JsonObject value 
)

Adds a JSON object to the top level of this node at key. The object parameter is deep-copied.

◆ WithObject() [4/4]

JsonObject & Aws::Crt::JsonObject::WithObject ( const String key,
JsonObject &&  value 
)

Adds a JSON object to the top level of this node at key.

◆ WithString() [1/2]

JsonObject & Aws::Crt::JsonObject::WithString ( const char *  key,
const String value 
)

◆ WithString() [2/2]

JsonObject & Aws::Crt::JsonObject::WithString ( const String key,
const String value 
)

Adds a string to the top level of this node with key.

Friends And Related Function Documentation

◆ ApiHandle

friend class ApiHandle
friend

◆ JsonView

friend class JsonView
friend

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