xentara-workbench-plugin v1.0.1
The Xentara Workbench Plugin Framework
Loading...
Searching...
No Matches
xentara::workbench::json::Array Class Referencefinal

A generic JSON array. More...

#include <xentara/workbench/json/Array_stage1.hpp>

Public Member Functions

 Array ()
 Default constructor.
 
 Array (const Array &)
 Copy constructor.
 
 Array (Array &&) noexcept
 Move constructor.
 
 ~Array ()
 Destructor.
 
auto operator= (const Array &) -> Array &
 Copy-assignment operator.
 
auto operator= (Array &&) noexcept -> Array &
 Move-assignment operator.
 
constexpr auto empty () const noexcept -> bool
 Checks if the array is empty.
 
auto decode (utils::json::decoder::Array &encodedArray, DecodingOptions options={}) -> void
 Reads the array from a JSON array.
 
auto decode (utils::json::decoder::Value &encodedValue, DecodingOptions options={}) -> void
 Reads the array from a generic JSON value.
 
auto encode (utils::json::encoder::Array &encodedArray) const -> void
 Write the array to a JSON array.
 
auto encode (utils::json::encoder::Value &encodedValue) const -> void
 Write the array to a generic JSON value.
 
auto toString (utils::json::encoder::Document::Format format=utils::json::encoder::Document::Format::Regular) const -> std::string
 Converts the JSON array to a string.
 
auto operator== (const Array &) const -> bool
 Equality comparison operator.
 

Static Public Member Functions

static auto fromString (std::string_view string, DecodingOptions options={}) -> utils::eh::expected< Array, ui::String >
 Creates a JSON array from a string.
 

Detailed Description

A generic JSON array.

Constructor & Destructor Documentation

◆ Array() [1/3]

xentara::workbench::json::Array::Array ( )
default

Default constructor.

◆ Array() [2/3]

xentara::workbench::json::Array::Array ( const Array )
default

Copy constructor.

◆ Array() [3/3]

xentara::workbench::json::Array::Array ( Array &&  )
defaultnoexcept

Move constructor.

◆ ~Array()

xentara::workbench::json::Array::~Array ( )
default

Destructor.

Member Function Documentation

◆ decode() [1/2]

auto xentara::workbench::json::Array::decode ( utils::json::decoder::Array encodedArray,
DecodingOptions  options = {} 
) -> void

Reads the array from a JSON array.

Parameters
encodedArrayThe encoded JSON array
optionsDecoding opotions.
Exceptions
std::runtime_errorAn error occurred

◆ decode() [2/2]

auto xentara::workbench::json::Array::decode ( utils::json::decoder::Value encodedValue,
DecodingOptions  options = {} 
) -> void

Reads the array from a generic JSON value.

Parameters
encodedValueThe encoded JSON value
optionsDecoding opotions.
Exceptions
std::runtime_errorAn error occurred

◆ empty()

constexpr auto xentara::workbench::json::Array::empty ( ) const -> bool
constexprnoexcept

Checks if the array is empty.

Returns
Returns true if the array is empty, *false if it contains any elements.

◆ encode() [1/2]

auto xentara::workbench::json::Array::encode ( utils::json::encoder::Array encodedArray) const -> void

Write the array to a JSON array.

Parameters
encodedArrayThe JSON array to encode to
Exceptions
std::runtime_errorAn error occurred

◆ encode() [2/2]

auto xentara::workbench::json::Array::encode ( utils::json::encoder::Value encodedValue) const -> void

Write the array to a generic JSON value.

Parameters
encodedValueThe JSON value to encode to
Exceptions
std::runtime_errorAn error occurred

◆ fromString()

static auto xentara::workbench::json::Array::fromString ( std::string_view  string,
DecodingOptions  options = {} 
) -> utils::eh::expected< Array, ui::String >
static

Creates a JSON array from a string.

Parameters
stringThe string to decode
optionsDecoding options.
Returns
The object, or an error message on error.

◆ operator=() [1/2]

auto xentara::workbench::json::Array::operator= ( Array &&  ) -> Array &
defaultnoexcept

Move-assignment operator.

◆ operator=() [2/2]

auto xentara::workbench::json::Array::operator= ( const Array ) -> Array &
default

Copy-assignment operator.

◆ operator==()

auto xentara::workbench::json::Array::operator== ( const Array ) const -> bool
default

Equality comparison operator.

◆ toString()

auto xentara::workbench::json::Array::toString ( utils::json::encoder::Document::Format  format = utils::json::encoder::Document::Format::Regular) const -> std::string

Converts the JSON array to a string.

Parameters
formatThe format to use for the document
Returns
The JSON text.