AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
AJson Class Reference

Json atom. More...

Detailed Description

Public Types

using Array = aui::impl::JsonArray
 
using Object = aui::impl::JsonObject
 

Public Member Functions

 AJson (std::initializer_list< std::pair< AString, AJson > > elems)
 
 AJson (const char *name)
 
 AJson (const AJson &json)=default
 
 AJson (AJson &&) noexcept=default
 
AJsonoperator= (const AJson &)=default
 
AJsonoperator= (AJson &&) noexcept=default
 
bool isInt () const noexcept
 
bool isLongInt () const noexcept
 
bool isEmpty () const noexcept
 
bool isNumber () const noexcept
 
bool isBool () const noexcept
 
bool isNull () const noexcept
 
bool isString () const noexcept
 
bool isArray () const noexcept
 
bool isObject () const noexcept
 
int asInt () const
 
int64_t asLongInt () const
 
double asNumber () const
 
bool asBool () const
 
const AStringasString () const
 
const aui::impl::JsonArrayasArray () const
 
const aui::impl::JsonObjectasObject () const
 
aui::impl::JsonArrayasArray ()
 
aui::impl::JsonObjectasObject ()
 
bool contains (const AString &mapKey) const
 
AOptional< AJsoncontainsOpt (const AString &mapKey) const
 
AJsonoperator[] (const AString &mapKey)
 
const AJsonoperator[] (const AString &mapKey) const
 
AJsonoperator[] (int arrayIndex)
 
const AJsonoperator[] (int arrayIndex) const
 
void push_back (AJson elem)
 
API_AUI_JSON AJson mergedWith (const AJson &other)
 Merges other json object into this object. More...
 

Static Public Member Functions

static API_AUI_JSON AString toString (const AJson &json)
 
static API_AUI_JSON AJson fromString (const AString &json)
 
static AJson fromStream (aui::no_escape< IInputStream > stream)
 
static API_AUI_JSON AJson fromBuffer (AByteBufferView buffer)
 

Member Function Documentation

◆ mergedWith()

AJson AJson::mergedWith ( const AJson other)

Merges other json object into this object.

Let's say this json is:

{
"key0": "val1",
"key1": "val1",
}

And other json is:

{
"key1": "val2",
"key2": "val2",
}

Then the result is:

{
"key0": "val1",
"key1": "val2",
"key2": "val2"
}

#include <AUI/Json/AJson.h>


The documentation for this class was generated from the following files:
Inheritance diagram for AJson:
Collaboration diagram for AJson: