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

#include <JsonObject.h>

Public Member Functions

 JsonView ()
 
 JsonView (const JsonObject &val)
 
JsonViewoperator= (const JsonObject &val)
 
String GetString (const String &key) const
 
String GetString (const char *key) const
 
String AsString () const
 
bool GetBool (const String &key) const
 
bool GetBool (const char *key) const
 
bool AsBool () const
 
int GetInteger (const String &key) const
 
int GetInteger (const char *key) const
 
int AsInteger () const
 
int64_t GetInt64 (const String &key) const
 
int64_t GetInt64 (const char *key) const
 
int64_t AsInt64 () const
 
double GetDouble (const String &key) const
 
double GetDouble (const char *key) const
 
double AsDouble () const
 
Vector< JsonViewGetArray (const String &key) const
 
Vector< JsonViewGetArray (const char *key) const
 
Vector< JsonViewAsArray () const
 
JsonView GetJsonObject (const String &key) const
 
JsonView GetJsonObject (const char *key) const
 
JsonObject GetJsonObjectCopy (const String &key) const
 
JsonObject GetJsonObjectCopy (const char *key) const
 
JsonView AsObject () const
 
Map< String, JsonViewGetAllObjects () const
 
bool ValueExists (const String &key) const
 
bool ValueExists (const char *key) const
 
bool KeyExists (const String &key) const
 
bool KeyExists (const char *key) const
 
bool IsObject () const
 
bool IsBool () const
 
bool IsString () const
 
bool IsNumber () const
 
bool IsIntegerType () const
 
bool IsFloatingPointType () const
 
bool IsListType () const
 
bool IsNull () const
 
String WriteCompact (bool treatAsObject=true) const
 
String WriteReadable (bool treatAsObject=true) const
 
JsonObject Materialize () const
 

Detailed Description

Provides read-only view to an existing JsonObject. This allows lightweight copying without making deep copies of the JsonObject. Note: This class does not extend the lifetime of the given JsonObject. It's your responsibility to ensure the lifetime of the JsonObject is extended beyond the lifetime of its view.

Constructor & Destructor Documentation

◆ JsonView() [1/2]

Aws::Crt::JsonView::JsonView ( )

◆ JsonView() [2/2]

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

Member Function Documentation

◆ AsArray()

Vector< JsonView > Aws::Crt::JsonView::AsArray ( ) const

Returns the value of this node as an array of JsonView objects.

◆ AsBool()

bool Aws::Crt::JsonView::AsBool ( ) const

Returns the value of this node as a boolean.

◆ AsDouble()

double Aws::Crt::JsonView::AsDouble ( ) const

Returns the value of this node as a double precision floating-point.

◆ AsInt64()

int64_t Aws::Crt::JsonView::AsInt64 ( ) const

Returns the value of this node as 64-bit integer.

◆ AsInteger()

int Aws::Crt::JsonView::AsInteger ( ) const

Returns the value of this node as an int.

◆ AsObject()

JsonView Aws::Crt::JsonView::AsObject ( ) const

Returns the value of this node as a JsonView object.

◆ AsString()

String Aws::Crt::JsonView::AsString ( ) const

Returns the value of this node as a string. The behavior is undefined if the node is not of type string.

◆ GetAllObjects()

Map< String, JsonView > Aws::Crt::JsonView::GetAllObjects ( ) const

Reads all json objects at the top level of this node (does not traverse the tree any further) along with their keys.

◆ GetArray() [1/2]

Vector< JsonView > Aws::Crt::JsonView::GetArray ( const char *  key) const

Gets an array of JsonView objects from this node by its key.

◆ GetArray() [2/2]

Vector< JsonView > Aws::Crt::JsonView::GetArray ( const String key) const

Gets an array of JsonView objects from this node by its key.

◆ GetBool() [1/2]

bool Aws::Crt::JsonView::GetBool ( const char *  key) const

Gets a boolean value from this node by its key.

◆ GetBool() [2/2]

bool Aws::Crt::JsonView::GetBool ( const String key) const

Gets a boolean value from this node by its key.

◆ GetDouble() [1/2]

double Aws::Crt::JsonView::GetDouble ( const char *  key) const

Gets a double precision floating-point value from this node by its key.

◆ GetDouble() [2/2]

double Aws::Crt::JsonView::GetDouble ( const String key) const

Gets a double precision floating-point value from this node by its key.

◆ GetInt64() [1/2]

int64_t Aws::Crt::JsonView::GetInt64 ( const char *  key) const

Gets a 64-bit integer value from this node by its key. The value is 64-bit regardless of the platform/machine.

◆ GetInt64() [2/2]

int64_t Aws::Crt::JsonView::GetInt64 ( const String key) const

Gets a 64-bit integer value from this node by its key. The value is 64-bit regardless of the platform/machine.

◆ GetInteger() [1/2]

int Aws::Crt::JsonView::GetInteger ( const char *  key) const

Gets an integer value from this node by its key. The integer is of the same size as an int on the machine.

◆ GetInteger() [2/2]

int Aws::Crt::JsonView::GetInteger ( const String key) const

Gets an integer value from this node by its key. The integer is of the same size as an int on the machine.

◆ GetJsonObject() [1/2]

JsonView Aws::Crt::JsonView::GetJsonObject ( const char *  key) const

Gets a JsonView object from this node by its key.

◆ GetJsonObject() [2/2]

JsonView Aws::Crt::JsonView::GetJsonObject ( const String key) const

Gets a JsonView object from this node by its key.

◆ GetJsonObjectCopy() [1/2]

JsonObject Aws::Crt::JsonView::GetJsonObjectCopy ( const char *  key) const

◆ GetJsonObjectCopy() [2/2]

JsonObject Aws::Crt::JsonView::GetJsonObjectCopy ( const String key) const

◆ GetString() [1/2]

String Aws::Crt::JsonView::GetString ( const char *  key) const

Gets a string from this node by its key.

◆ GetString() [2/2]

String Aws::Crt::JsonView::GetString ( const String key) const

Gets a string from this node by its key.

◆ IsBool()

bool Aws::Crt::JsonView::IsBool ( ) const

Tests whether the current value is a boolean.

◆ IsFloatingPointType()

bool Aws::Crt::JsonView::IsFloatingPointType ( ) const

Tests whether the current value is a number that will lose precision if converted to an int64_t.

◆ IsIntegerType()

bool Aws::Crt::JsonView::IsIntegerType ( ) const

Tests whether the current value is a number that can convert to an int64_t without losing precision.

◆ IsListType()

bool Aws::Crt::JsonView::IsListType ( ) const

Tests whether the current value is a JSON array.

◆ IsNull()

bool Aws::Crt::JsonView::IsNull ( ) const

Tests whether the current value is a JSON null.

◆ IsNumber()

bool Aws::Crt::JsonView::IsNumber ( ) const

Tests whether the current value is a number.

◆ IsObject()

bool Aws::Crt::JsonView::IsObject ( ) const

Tests whether the current value is a JSON object.

◆ IsString()

bool Aws::Crt::JsonView::IsString ( ) const

Tests whether the current value is a string.

◆ KeyExists() [1/2]

bool Aws::Crt::JsonView::KeyExists ( const char *  key) const

Tests whether a key exists at the current node level.

◆ KeyExists() [2/2]

bool Aws::Crt::JsonView::KeyExists ( const String key) const

Tests whether a key exists at the current node level.

◆ Materialize()

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

Creates a deep copy of the JSON value rooted in the current JSON view.

◆ operator=()

JsonView & Aws::Crt::JsonView::operator= ( const JsonObject val)

◆ ValueExists() [1/2]

bool Aws::Crt::JsonView::ValueExists ( const char *  key) const

Tests whether a value exists at the current node level for the given key. Returns true if a value has been found and its value is not null, false otherwise.

◆ ValueExists() [2/2]

bool Aws::Crt::JsonView::ValueExists ( const String key) const

Tests whether a value exists at the current node level for the given key. Returns true if a value has been found and its value is not null, false otherwise.

◆ WriteCompact()

String Aws::Crt::JsonView::WriteCompact ( bool  treatAsObject = true) const

Writes the current JSON view without whitespace characters starting at the current level to a string.

Parameters
treatAsObjectif the current value is empty, writes out '{}' rather than an empty string.

◆ WriteReadable()

String Aws::Crt::JsonView::WriteReadable ( bool  treatAsObject = true) const

Writes the current JSON view to a string in a human friendly format.

Parameters
treatAsObjectif the current value is empty, writes out '{}' rather than an empty string.

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