bpf::json::Json class

Represents an arbitary Json value

Public types

class Array
class Object
class Type
enum EType { DOUBLE, INTEGER, BOOLEAN, STRING, ARRAY, OBJECT, NONE }

Constructors, destructors, conversion operators

Json()
Json(const Json& other)
Json(Json&& other) noexcept
Json(const double val)
Json(const int64 val)
Json(const bool val)
Json(const String& val)
Json(const char* val)
Json(String&& val)
Json(const Object& val)
Json(Object&& val)
Json(const Array& arr)
Json(Array&& arr)
operator double() const
operator int64() const
operator bool() const
operator const String&() const
operator const Array&() const
operator const Object&() const
operator Array&()
operator Object&()

Public functions

auto operator=(const Json& other) -> Json&
auto operator=(Json&& other) -> Json& noexcept
auto operator=(const double val) -> Json&
auto operator=(const int64 val) -> Json&
auto operator=(const bool val) -> Json&
auto operator=(const String& val) -> Json&
auto operator=(const char* val) -> Json&
auto operator=(const Object& val) -> Json&
auto operator=(const Array& val) -> Json&
auto Type() const -> _bpf_internal_json_type noexcept
auto operator==(double other) const -> bool
auto operator==(int64 other) const -> bool
auto operator==(bool other) const -> bool
auto operator==(const String& other) const -> bool
auto operator==(const char* other) const -> bool
auto ToDouble() const -> double
auto ToInteger() const -> int64
auto ToBoolean() const -> bool
auto ToString() const -> const String&
auto ToArray() const -> const Array&
auto ToObject() const -> const Object&

Enum documentation

enum bpf::json::Json::EType

Enumeration to represent the type of a Json value

Enumerators
DOUBLE

Indicates a Json number that stores doubles

INTEGER

Indicates a Json number that stores integers

BOOLEAN

Indicates a Json boolean

STRING

Indicates a Json string

ARRAY

Indicates a Json array

OBJECT

Indicates a Json object

NONE

Indicates Json null

Function documentation

bpf::json::Json::Json()

Constructs a null Json value

bpf::json::Json::Json(const Json& other)

Copy constructor

bpf::json::Json::Json(Json&& other) noexcept

Move constructor

bpf::json::Json::Json(const double val)

Parameters
val the number to store

Constructs a Json number value

bpf::json::Json::Json(const int64 val)

Parameters
val the number to store

Constructs a Json number value

bpf::json::Json::Json(const bool val)

Parameters
val the boolean to store

Constructs a Json boolean value

bpf::json::Json::Json(const String& val)

Parameters
val the string to store

Constructs a Json string value

bpf::json::Json::Json(const char* val)

Parameters
val the string to store

Constructs a Json string value

bpf::json::Json::Json(String&& val)

Parameters
val the string to store

Constructs a Json string value

bpf::json::Json::Json(const Object& val)

Parameters
val the object to store

Constructs a Json object value

bpf::json::Json::Json(Object&& val)

Parameters
val the object to store

Constructs a Json object value

bpf::json::Json::Json(const Array& arr)

Parameters
arr the array to store

Constructs a Json array value

bpf::json::Json::Json(Array&& arr)

Parameters
arr the array to store

Constructs a Json array value

bpf::json::Json::operator double() const

Returns double
Exceptions
JsonException if the value type is not compatible

Converts this value to a number

bpf::json::Json::operator int64() const

Returns integer 64 bits
Exceptions
JsonException if the value type is not compatible

Converts this value to a number

bpf::json::Json::operator bool() const

Returns bool
Exceptions
JsonException if the value type is not compatible

Converts this value to a boolean

bpf::json::Json::operator const String&() const

Returns immutable high-level string reference
Exceptions
JsonException if the value type is not compatible

Converts this value to a string

bpf::json::Json::operator const Array&() const

Returns immutable Array reference
Exceptions
JsonException if the value type is not compatible

Converts this value to a Json Array

bpf::json::Json::operator const Object&() const

Returns immutable Object reference
Exceptions
JsonException if the value type is not compatible

Converts this value to a Json Object

bpf::json::Json::operator Array&()

Returns mutable Array reference
Exceptions
JsonException if the value type is not compatible

Converts this value to a Json Array

bpf::json::Json::operator Object&()

Returns mutable Object reference
Exceptions
JsonException if the value type is not compatible

Converts this value to a Json Object

Json& bpf::json::Json::operator=(const Json& other)

Copy assignment operator

Json& bpf::json::Json::operator=(Json&& other) noexcept

Move assignment operator

Json& bpf::json::Json::operator=(const double val)

Parameters
val new value
Returns Json&

Assigns this Json value to a number

Json& bpf::json::Json::operator=(const int64 val)

Parameters
val new value
Returns Json&

Assigns this Json value to a number

Json& bpf::json::Json::operator=(const bool val)

Parameters
val new value
Returns Json&

Assigns this Json value to a boolean

Json& bpf::json::Json::operator=(const String& val)

Parameters
val new value
Returns Json&

Assigns this Json value to a string

Json& bpf::json::Json::operator=(const char* val)

Parameters
val new value
Returns Json&

Assigns this Json value to a string

Json& bpf::json::Json::operator=(const Object& val)

Parameters
val new value
Returns Json&

Assigns this Json value to an object

Json& bpf::json::Json::operator=(const Array& val)

Parameters
val new value
Returns Json&

Assigns this Json value to an array

_bpf_internal_json_type bpf::json::Json::Type() const noexcept

Returns Json::Type object

Returns the type of this Json value

bool bpf::json::Json::operator==(double other) const

Parameters
other value to compare with
Returns true if this is equal to other, false otherwise

Compares a Json value with a number

bool bpf::json::Json::operator==(int64 other) const

Parameters
other value to compare with
Returns true if this is equal to other, false otherwise

Compares a Json value with a number

bool bpf::json::Json::operator==(bool other) const

Parameters
other value to compare with
Returns true if this is equal to other, false otherwise

Compares a Json value with a boolean

bool bpf::json::Json::operator==(const String& other) const

Parameters
other value to compare with
Returns true if this is equal to other, false otherwise

Compares a Json value with a string

bool bpf::json::Json::operator==(const char* other) const

Parameters
other value to compare with
Returns true if this is equal to other, false otherwise

Compares a Json value with a string

double bpf::json::Json::ToDouble() const

Returns double
Exceptions
JsonException if the value type is not compatible

Converts this value to a number

int64 bpf::json::Json::ToInteger() const

Returns integer 64 bits
Exceptions
JsonException if the value type is not compatible

Converts this value to a number

bool bpf::json::Json::ToBoolean() const

Returns bool
Exceptions
JsonException if the value type is not compatible

Converts this value to a boolean

const String& bpf::json::Json::ToString() const

Returns immutable high-level string reference
Exceptions
JsonException if the value type is not compatible

Converts this value to a string

const Array& bpf::json::Json::ToArray() const

Returns immutable Array reference
Exceptions
JsonException if the value type is not compatible

Converts this value to a Json Array

const Object& bpf::json::Json::ToObject() const

Returns immutable Object reference
Exceptions
JsonException if the value type is not compatible

Converts this value to a Json Object