aws-crt-cpp
C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
Loading...
Searching...
No Matches
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 ()
 
JsonObject & operator= (const JsonObject &other)
 
JsonObject & operator= (JsonObject &&other) noexcept
 
bool operator== (const JsonObject &other) const
 
bool operator!= (const JsonObject &other) const
 
JsonObject & WithString (const String &key, const String &value)
 
JsonObject & WithString (const char *key, const String &value)
 
JsonObject & AsString (const String &value)
 
JsonObject & WithBool (const String &key, bool value)
 
JsonObject & WithBool (const char *key, bool value)
 
JsonObject & AsBool (bool value)
 
JsonObject & WithInteger (const String &key, int value)
 
JsonObject & WithInteger (const char *key, int value)
 
JsonObject & AsInteger (int value)
 
JsonObject & WithInt64 (const String &key, int64_t value)
 
JsonObject & WithInt64 (const char *key, int64_t value)
 
JsonObject & AsInt64 (int64_t value)
 
JsonObject & WithDouble (const String &key, double value)
 
JsonObject & WithDouble (const char *key, double value)
 
JsonObject & AsDouble (double value)
 
JsonObject & WithArray (const String &key, const Vector< String > &array)
 
JsonObject & WithArray (const char *key, const Vector< String > &array)
 
JsonObject & WithArray (const String &key, const Vector< JsonObject > &array)
 
JsonObject & WithArray (const String &key, Vector< JsonObject > &&array)
 
JsonObject & AsArray (const Vector< JsonObject > &array)
 
JsonObject & AsArray (Vector< JsonObject > &&array)
 
JsonObject & AsNull ()
 
JsonObject & WithObject (const String &key, const JsonObject &value)
 
JsonObject & WithObject (const char *key, const JsonObject &value)
 
JsonObject & WithObject (const String &key, JsonObject &&value)
 
JsonObject & WithObject (const char *key, JsonObject &&value)
 
JsonObject & AsObject (const JsonObject &value)
 
JsonObject & AsObject (JsonObject &&value)
 
bool WasParseSuccessful () const
 
const String & GetErrorMessage () 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 Symbol Documentation

◆ ApiHandle

◆ JsonView


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