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

A generic JSON value. More...

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

Public Member Functions

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

Static Public Member Functions

static auto fromString (std::string_view string, DecodingOptions options={}) -> utils::eh::expected< Value, ui::String >
 Creates a JSON value from a string, applying a filter to the JSON object.
 

Detailed Description

A generic JSON value.

Constructor & Destructor Documentation

◆ Value() [1/3]

xentara::workbench::json::Value::Value ( )
default

Default constructor.

◆ Value() [2/3]

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

Copy constructor.

◆ Value() [3/3]

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

Move constructor.

◆ ~Value()

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

Destructor.

Member Function Documentation

◆ decode()

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

Reads the value from a JSON value.

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

◆ encode()

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

Write the value to a JSON value.

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

◆ fromString()

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

Creates a JSON value from a string, applying a filter to the JSON object.

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

◆ operator=() [1/2]

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

Copy-assignment operator.

◆ operator=() [2/2]

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

Move-assignment operator.

◆ operator==()

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

Equality comparison operator.

◆ toString()

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

Converts the JSON value to a string.

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