join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::Value Class Reference

value class. More...

#include <value.hpp>

Public Types

enum  Index : size_t {
  NullValue = 0 , BooleanValue = 1 , IntegerValue = 2 , UnsignedValue = 3 ,
  Integer64Value = 4 , Unsigned64Value = 5 , RealValue = 6 , StringValue = 7 ,
  ArrayValue = 8 , ObjectValue = 9
}
 nested value type index. More...
 

Public Member Functions

constexpr Value ()=default
 default constructor.
 
constexpr Value (std::nullptr_t value)
 constructs a null value.
 
constexpr Value (bool value)
 constructs a boolean value.
 
constexpr Value (int32_t value)
 constructs an integer value.
 
constexpr Value (uint32_t value)
 constructs an unsigned integer value.
 
constexpr Value (int64_t value)
 constructs a 64 bits integer value.
 
constexpr Value (uint64_t value)
 constructs a 64 bits unsigned integer value.
 
constexpr Value (double value)
 constructs a real value.
 
 Value (const char *value)
 constructs a string value from a C-style string.
 
 Value (std::string_view value)
 constructs a string value from a string view.
 
 Value (const std::string &value)
 constructs a string value.
 
 Value (std::string &&value)
 constructs a string value.
 
 Value (const Array &value)
 constructs an array value.
 
 Value (Array &&value)
 constructs an array value.
 
 Value (const Object &value)
 constructs an object value.
 
 Value (Object &&value)
 constructs an object value.
 
constexpr Value (const Value &other)=default
 copy constructor.
 
Value & operator= (const Value &other)=default
 copy assignment.
 
constexpr Value (Value &&other)=default
 move constructor.
 
Value & operator= (Value &&other)=default
 move assignment.
 
 ~Value ()=default
 destroy the Value instance.
 
constexpr std::size_t index () const noexcept
 get the index of the alternative in use.
 
constexpr bool isNull () const
 check if the variable held by value is a null value.
 
constexpr bool isBool () const
 check if the variable held by value is a boolean value.
 
constexpr bool getBool () const
 get variable held by value as a boolean value.
 
 operator bool () const
 explicit conversion function for boolean value.
 
constexpr bool isTrue () const
 check if the content of the value is true.
 
constexpr bool isFalse () const
 check if the content of the value is false.
 
constexpr bool isNumber () const
 check if the variable held by value is a number value.
 
constexpr bool isInt8 () const
 check if the variable held by value is a 8 bits integer value.
 
constexpr int8_t getInt8 () const
 get variable held by value as a 8 bits integer.
 
 operator int8_t () const
 explicit conversion function for 8 bits integer value.
 
constexpr bool isUint8 () const
 check if the variable held by value is a 8 bits unsigned integer value.
 
constexpr uint8_t getUint8 () const
 get variable held by value as a 8 bits unsigned integer.
 
 operator uint8_t () const
 explicit conversion function for 8 bits unsigned integer value.
 
constexpr bool isInt16 () const
 check if the variable held by value is a 16 bits integer value.
 
constexpr int16_t getInt16 () const
 get variable held by value as a 16 bits integer.
 
 operator int16_t () const
 explicit conversion function for 16 bits integer value.
 
constexpr bool isUint16 () const
 check if the variable held by value is a 16 bits unsigned integer value.
 
constexpr uint16_t getUint16 () const
 get variable held by value as a 16 bits unsigned integer.
 
 operator uint16_t () const
 explicit conversion function for 16 bits unsigned integer value.
 
constexpr bool isInt () const
 check if the variable held by value is a 32 bits integer value.
 
constexpr int32_t getInt () const
 get variable held by value as a 32 bits integer.
 
 operator int32_t () const
 explicit conversion function for 32 bits integer value.
 
constexpr bool isUint () const
 check if the variable held by value is a 32 bits unsigned integer value.
 
constexpr uint32_t getUint () const
 get variable held by value as a 32 bits unsigned integer value.
 
 operator uint32_t () const
 explicit conversion function for 32 bits unsigned integer value.
 
constexpr bool isInt64 () const
 check if the variable held by value is a 64 bits integer value.
 
constexpr int64_t getInt64 () const
 get variable held by value as a 64 bits integer value.
 
 operator int64_t () const
 explicit conversion function for 64 bits integer value.
 
constexpr bool isUint64 () const
 check if the variable held by value is a 64 bits unsigned integer value.
 
constexpr uint64_t getUint64 () const
 get variable held by value as a 64 bits unsigned integer value.
 
 operator uint64_t () const
 explicit conversion function for 64 bits unsigned integer value.
 
constexpr bool isFloat () const
 check if the variable held by value is a float value.
 
constexpr float getFloat () const
 get variable held by value as a float value.
 
 operator float () const
 explicit conversion function for float value.
 
constexpr bool isDouble () const
 check if the variable held by value is a double value.
 
constexpr double getDouble () const
 get variable held by value as a double value.
 
 operator double () const
 explicit conversion function for double value.
 
constexpr bool isString () const
 check if the variable held by value is a string value.
 
constexpr std::string_view getString () const
 get variable held by value as a string value.
 
 operator std::string_view () const
 explicit conversion function for string value.
 
constexpr bool isArray () const
 check if the variable held by value is an array.
 
constexpr const Array & getArray () const
 get variable held by value as an array.
 
constexpr Array & getArray ()
 get variable held by value as an array.
 
constexpr bool isObject () const
 check if the variable held by value is an object.
 
constexpr const Object & getObject () const
 get variable held by value as an object.
 
constexpr Object & getObject ()
 get variable held by value as an object.
 
Value & at (std::nullptr_t key)
 returns a reference to the value mapped to key.
 
Value & at (bool key)
 returns a reference to the value mapped to key.
 
Value & at (int32_t key)
 returns a reference to the value at position pos or mapped to key.
 
Value & at (uint32_t key)
 returns a reference to the value at position pos or mapped to key.
 
Value & at (int64_t key)
 returns a reference to the value at position pos or mapped to key.
 
Value & at (uint64_t key)
 returns a reference to the value at position pos or mapped to key.
 
Value & at (double key)
 returns a reference to the value mapped to key.
 
Value & at (std::string_view key)
 returns a reference to the value mapped to key.
 
Value & at (const char *key)
 returns a reference to the value mapped to key.
 
const Value & at (std::nullptr_t key) const
 returns a reference to the value mapped to key.
 
const Value & at (bool key) const
 returns a reference to the value mapped to key.
 
const Value & at (int32_t key) const
 returns a reference to the value at position pos or mapped to key.
 
const Value & at (uint32_t key) const
 returns a reference to the value at position pos or mapped to key.
 
const Value & at (int64_t key) const
 returns a reference to the value at position pos or mapped to key.
 
const Value & at (uint64_t key) const
 returns a reference to the value at position pos or mapped to key.
 
const Value & at (double key) const
 returns a reference to the value mapped to key.
 
const Value & at (std::string_view key) const
 returns a reference to the value mapped to key.
 
const Value & at (const char *key) const
 returns a reference to the value mapped to key.
 
Value & operator[] (std::nullptr_t key)
 returns a reference to the value mapped to key.
 
Value & operator[] (bool key)
 returns a reference to the value mapped to key.
 
Value & operator[] (int32_t key)
 returns a reference to the value at position pos or mapped to key.
 
Value & operator[] (uint32_t key)
 returns a reference to the value at position pos or mapped to key.
 
Value & operator[] (int64_t key)
 returns a reference to the value at position pos or mapped to key.
 
Value & operator[] (uint64_t key)
 returns a reference to the value at position pos or mapped to key.
 
Value & operator[] (double key)
 returns a reference to the value mapped to key.
 
Value & operator[] (std::string_view key)
 returns a reference to the value mapped to key.
 
Value & operator[] (const char *key)
 returns a reference to the value mapped to key.
 
bool empty () const
 check if the nested container is empty.
 
size_t size () const
 returns the number of elements in the nested container.
 
void reserve (size_t cap)
 increase the capacity of the nested container.
 
void clear ()
 erases all elements in the nested container.
 
Value & insert (const Member &member)
 insert element in the nested container.
 
Value & insert (Member &&member)
 insert element in the nested container.
 
size_t erase (std::nullptr_t key)
 removes member with the key equivalent to key.
 
size_t erase (bool key)
 removes member with the key equivalent to key.
 
size_t erase (int32_t key)
 removes member with the key equivalent to key.
 
size_t erase (uint32_t key)
 removes member with the key equivalent to key.
 
size_t erase (int64_t key)
 removes member with the key equivalent to key.
 
size_t erase (uint64_t key)
 removes member with the key equivalent to key.
 
size_t erase (double key)
 removes member with the key equivalent to key.
 
size_t erase (std::string_view key)
 removes member with the key equivalent to key.
 
size_t erase (const char *key)
 removes member with the key equivalent to key.
 
template<typename... Args>
Value & emplaceBack (Args &&... args)
 constructs an element in place at the end of the nested container.
 
Value & pushBack (const Value &value)
 appends element at the end of the nested container.
 
Value & pushBack (Value &&value)
 appends element at the end of the nested container.
 
void popBack ()
 removes the last element of the nested container.
 
bool contains (std::nullptr_t key) const
 checks if the nested container contains an element that is mapped to key.
 
bool contains (bool key) const
 checks if the nested container contains an element that is mapped to key.
 
bool contains (int32_t key) const
 checks if the nested container contains an element that is mapped to key.
 
bool contains (uint32_t key) const
 checks if the nested container contains an element that is mapped to key.
 
bool contains (int64_t key) const
 checks if the nested container contains an element that is mapped to key.
 
bool contains (uint64_t key) const
 checks if the nested container contains an element that is mapped to key.
 
bool contains (double key) const
 checks if the nested container contains an element that is mapped to key.
 
bool contains (std::string_view key) const
 checks if the nested container contains an element that is mapped to key.
 
bool contains (const char *key) const
 checks if the nested container contains an element that is mapped to key.
 
void swap (Value &other)
 exchanges the contents of the value with those of other.
 
template<typename Handler >
int serialize (Handler &handler) const
 serialize the value, resetting the handler on failure.
 
template<typename Reader , typename... Args>
int deserialize (Args &&... args)
 deserialize a document into the value.
 
template<typename Writer , typename... Args>
int serialize (std::ostream &document, Args &&... args) const
 serialize the value to a stream.
 
int jsonRead (const char *document, size_t length)
 deserialize a json document.
 
int jsonRead (const char *first, const char *last)
 deserialize a json document.
 
int jsonRead (std::string_view document)
 deserialize a json document.
 
int jsonRead (std::stringstream &document)
 deserialize a json document.
 
int jsonRead (std::istringstream &document)
 deserialize a json document.
 
int jsonRead (std::fstream &document)
 deserialize a json document.
 
int jsonRead (std::ifstream &document)
 deserialize a json document.
 
int jsonRead (std::iostream &document)
 deserialize a json document.
 
int jsonRead (std::istream &document)
 deserialize a json document.
 
int jsonWrite (std::ostream &document, size_t indentation=0) const
 serialize json data.
 
int jsonCanonicalize (std::ostream &document) const
 serialize canonicalized json data.
 
int packRead (const char *document, size_t length)
 deserialize a msgpack document.
 
int packRead (const char *first, const char *last)
 deserialize a msgpack document.
 
int packRead (std::string_view document)
 deserialize a msgpack document.
 
int packRead (std::stringstream &document)
 deserialize a msgpack document.
 
int packRead (std::istringstream &document)
 deserialize a msgpack document.
 
int packRead (std::fstream &document)
 deserialize a msgpack document.
 
int packRead (std::ifstream &document)
 deserialize a msgpack document.
 
int packRead (std::iostream &document)
 deserialize a msgpack document.
 
int packRead (std::istream &document)
 deserialize a msgpack document.
 
int packWrite (std::ostream &document) const
 serialize msgpack data.
 

Friends

constexpr bool operator== (const Value &lhs, const Value &rhs)
 compare if equal.
 
constexpr std::partial_ordering operator<=> (const Value &lhs, const Value &rhs)
 three-way compare values.
 

Detailed Description

value class.

Member Enumeration Documentation

◆ Index

enum join::Value::Index : size_t

nested value type index.

Enumerator
NullValue 

index of the null alternative.

BooleanValue 

index of the boolean alternative.

IntegerValue 

index of the 32 bits integer alternative.

UnsignedValue 

index of the 32 bits unsigned integer alternative.

Integer64Value 

index of the 64 bits integer alternative.

Unsigned64Value 

index of the 64 bits unsigned integer alternative.

RealValue 

index of the real alternative.

StringValue 

index of the string alternative.

ArrayValue 

index of the array alternative.

ObjectValue 

index of the object alternative.

Constructor & Destructor Documentation

◆ Value() [1/18]

join::Value::Value ( )
constexprdefault

default constructor.

◆ Value() [2/18]

join::Value::Value ( std::nullptr_t value)
inlineconstexpr

constructs a null value.

Parameters
valuenull value.

◆ Value() [3/18]

join::Value::Value ( bool value)
inlineconstexpr

constructs a boolean value.

Parameters
valueboolean value.

◆ Value() [4/18]

join::Value::Value ( int32_t value)
inlineconstexpr

constructs an integer value.

Parameters
valueinteger value.

◆ Value() [5/18]

join::Value::Value ( uint32_t value)
inlineconstexpr

constructs an unsigned integer value.

Parameters
valueunsigned integer value.

◆ Value() [6/18]

join::Value::Value ( int64_t value)
inlineconstexpr

constructs a 64 bits integer value.

Parameters
value64 bits integer value.

◆ Value() [7/18]

join::Value::Value ( uint64_t value)
inlineconstexpr

constructs a 64 bits unsigned integer value.

Parameters
value64 bits unsigned integer value.

◆ Value() [8/18]

join::Value::Value ( double value)
inlineconstexpr

constructs a real value.

Parameters
valuereal value.

◆ Value() [9/18]

join::Value::Value ( const char * value)
inline

constructs a string value from a C-style string.

Parameters
valuestring value.

◆ Value() [10/18]

join::Value::Value ( std::string_view value)
inline

constructs a string value from a string view.

Parameters
valuestring value.

◆ Value() [11/18]

join::Value::Value ( const std::string & value)
inline

constructs a string value.

Parameters
valuestring value.

◆ Value() [12/18]

join::Value::Value ( std::string && value)
inline

constructs a string value.

Parameters
valuestring value.

◆ Value() [13/18]

join::Value::Value ( const Array & value)
inline

constructs an array value.

Parameters
valuearray value.

◆ Value() [14/18]

join::Value::Value ( Array && value)
inline

constructs an array value.

Parameters
valuearray value.

◆ Value() [15/18]

join::Value::Value ( const Object & value)
inline

constructs an object value.

Parameters
valueobject value.

◆ Value() [16/18]

join::Value::Value ( Object && value)
inline

constructs an object value.

Parameters
valueobject value.

◆ Value() [17/18]

join::Value::Value ( const Value & other)
constexprdefault

copy constructor.

Parameters
otherobject to copy.

◆ Value() [18/18]

join::Value::Value ( Value && other)
constexprdefault

move constructor.

Parameters
otherobject to move.

◆ ~Value()

join::Value::~Value ( )
default

destroy the Value instance.

Member Function Documentation

◆ at() [1/18]

Value & join::Value::at ( bool key)
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [2/18]

const Value & join::Value::at ( bool key) const
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [3/18]

Value & join::Value::at ( const char * key)
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [4/18]

const Value & join::Value::at ( const char * key) const
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [5/18]

Value & join::Value::at ( double key)
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [6/18]

const Value & join::Value::at ( double key) const
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [7/18]

Value & join::Value::at ( int32_t key)
inline

returns a reference to the value at position pos or mapped to key.

Parameters
keyposition or key of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [8/18]

const Value & join::Value::at ( int32_t key) const
inline

returns a reference to the value at position pos or mapped to key.

Parameters
keyposition or key of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [9/18]

Value & join::Value::at ( int64_t key)
inline

returns a reference to the value at position pos or mapped to key.

Parameters
keyposition or key of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [10/18]

const Value & join::Value::at ( int64_t key) const
inline

returns a reference to the value at position pos or mapped to key.

Parameters
keyposition or key of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [11/18]

Value & join::Value::at ( std::nullptr_t key)
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [12/18]

const Value & join::Value::at ( std::nullptr_t key) const
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [13/18]

Value & join::Value::at ( std::string_view key)
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [14/18]

const Value & join::Value::at ( std::string_view key) const
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [15/18]

Value & join::Value::at ( uint32_t key)
inline

returns a reference to the value at position pos or mapped to key.

Parameters
keyposition or key of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [16/18]

const Value & join::Value::at ( uint32_t key) const
inline

returns a reference to the value at position pos or mapped to key.

Parameters
keyposition or key of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [17/18]

Value & join::Value::at ( uint64_t key)
inline

returns a reference to the value at position pos or mapped to key.

Parameters
keyposition or key of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ at() [18/18]

const Value & join::Value::at ( uint64_t key) const
inline

returns a reference to the value at position pos or mapped to key.

Parameters
keyposition or key of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast,std::out_of_range.

◆ clear()

void join::Value::clear ( )
inline

erases all elements in the nested container.

Exceptions
std::bad_cast.

◆ contains() [1/9]

bool join::Value::contains ( bool key) const
inline

checks if the nested container contains an element that is mapped to key.

Parameters
keykey of the element to find.
Returns
true if the nested container contains an element mapped to key, false otherwise.
Exceptions
std::bad_cast.

◆ contains() [2/9]

bool join::Value::contains ( const char * key) const
inline

checks if the nested container contains an element that is mapped to key.

Parameters
keykey of the element to find.
Returns
true if the nested container contains an element mapped to key, false otherwise.
Exceptions
std::bad_cast.

◆ contains() [3/9]

bool join::Value::contains ( double key) const
inline

checks if the nested container contains an element that is mapped to key.

Parameters
keykey of the element to find.
Returns
true if the nested container contains an element mapped to key, false otherwise.
Exceptions
std::bad_cast.

◆ contains() [4/9]

bool join::Value::contains ( int32_t key) const
inline

checks if the nested container contains an element that is mapped to key.

Parameters
keyposition or key of the element to find.
Returns
true if the nested container contains an element mapped to key, false otherwise.
Exceptions
std::bad_cast.

◆ contains() [5/9]

bool join::Value::contains ( int64_t key) const
inline

checks if the nested container contains an element that is mapped to key.

Parameters
keyposition or key of the element to find.
Returns
true if the nested container contains an element mapped to key, false otherwise.
Exceptions
std::bad_cast.

◆ contains() [6/9]

bool join::Value::contains ( std::nullptr_t key) const
inline

checks if the nested container contains an element that is mapped to key.

Parameters
keykey of the element to find.
Returns
true if the nested container contains an element mapped to key, false otherwise.
Exceptions
std::bad_cast.

◆ contains() [7/9]

bool join::Value::contains ( std::string_view key) const
inline

checks if the nested container contains an element that is mapped to key.

Parameters
keykey of the element to find.
Returns
true if the nested container contains an element mapped to key, false otherwise.
Exceptions
std::bad_cast.

◆ contains() [8/9]

bool join::Value::contains ( uint32_t key) const
inline

checks if the nested container contains an element that is mapped to key.

Parameters
keyposition or key of the element to find.
Returns
true if the nested container contains an element mapped to key, false otherwise.
Exceptions
std::bad_cast.

◆ contains() [9/9]

bool join::Value::contains ( uint64_t key) const
inline

checks if the nested container contains an element that is mapped to key.

Parameters
keyposition or key of the element to find.
Returns
true if the nested container contains an element mapped to key, false otherwise.
Exceptions
std::bad_cast.

◆ deserialize()

template<typename Reader , typename... Args>
int join::Value::deserialize ( Args &&... args)
inline

deserialize a document into the value.

Parameters
argsdocument to deserialize, followed by any reader argument.
Returns
0 on success, -1 otherwise.

◆ emplaceBack()

template<typename... Args>
Value & join::Value::emplaceBack ( Args &&... args)
inline

constructs an element in place at the end of the nested container.

Parameters
argsarguments forwarded to the element constructor.
Returns
a reference to the constructed object.
Exceptions
std::bad_cast.

◆ empty()

bool join::Value::empty ( ) const
inline

check if the nested container is empty.

Returns
true if empty, false otherwise.
Exceptions
std::bad_cast.

◆ erase() [1/9]

size_t join::Value::erase ( bool key)
inline

removes member with the key equivalent to key.

Parameters
keykey of the member to remove.
Returns
number of elements removed.
Exceptions
std::bad_cast.

◆ erase() [2/9]

size_t join::Value::erase ( const char * key)
inline

removes member with the key equivalent to key.

Parameters
keykey of the member to remove.
Returns
number of elements removed.
Exceptions
std::bad_cast.

◆ erase() [3/9]

size_t join::Value::erase ( double key)
inline

removes member with the key equivalent to key.

Parameters
keykey of the member to remove.
Returns
number of elements removed.
Exceptions
std::bad_cast.

◆ erase() [4/9]

size_t join::Value::erase ( int32_t key)
inline

removes member with the key equivalent to key.

Parameters
keykey of the member to remove.
Returns
number of elements removed.
Exceptions
std::bad_cast.

◆ erase() [5/9]

size_t join::Value::erase ( int64_t key)
inline

removes member with the key equivalent to key.

Parameters
keykey of the member to remove.
Returns
number of elements removed.
Exceptions
std::bad_cast.

◆ erase() [6/9]

size_t join::Value::erase ( std::nullptr_t key)
inline

removes member with the key equivalent to key.

Parameters
keykey of the member to remove.
Returns
number of elements removed.
Exceptions
std::bad_cast.

◆ erase() [7/9]

size_t join::Value::erase ( std::string_view key)
inline

removes member with the key equivalent to key.

Parameters
keykey of the member to remove.
Returns
number of elements removed.
Exceptions
std::bad_cast.

◆ erase() [8/9]

size_t join::Value::erase ( uint32_t key)
inline

removes member with the key equivalent to key.

Parameters
keykey of the member to remove.
Returns
number of elements removed.
Exceptions
std::bad_cast.

◆ erase() [9/9]

size_t join::Value::erase ( uint64_t key)
inline

removes member with the key equivalent to key.

Parameters
keykey of the member to remove.
Returns
number of elements removed.
Exceptions
std::bad_cast.

◆ getArray() [1/2]

Array & join::Value::getArray ( )
inlineconstexpr

get variable held by value as an array.

Returns
variable held by value as an array.
Exceptions
std::bad_cast.

◆ getArray() [2/2]

const Array & join::Value::getArray ( ) const
inlineconstexpr

get variable held by value as an array.

Returns
variable held by value as an array.
Exceptions
std::bad_cast.

◆ getBool()

bool join::Value::getBool ( ) const
inlineconstexpr

get variable held by value as a boolean value.

Returns
variable held by value as a boolean value.
Exceptions
std::bad_cast.

◆ getDouble()

double join::Value::getDouble ( ) const
inlineconstexpr

get variable held by value as a double value.

Returns
variable held by value as a double value.
Exceptions
std::bad_cast.

◆ getFloat()

float join::Value::getFloat ( ) const
inlineconstexpr

get variable held by value as a float value.

Returns
variable held by value as a float value.
Exceptions
std::bad_cast.

◆ getInt()

int32_t join::Value::getInt ( ) const
inlineconstexpr

get variable held by value as a 32 bits integer.

Returns
variable held by value as a 32 bits integer.
Exceptions
std::bad_cast.

◆ getInt16()

int16_t join::Value::getInt16 ( ) const
inlineconstexpr

get variable held by value as a 16 bits integer.

Returns
variable held by value as a 16 bits integer.
Exceptions
std::bad_cast.

◆ getInt64()

int64_t join::Value::getInt64 ( ) const
inlineconstexpr

get variable held by value as a 64 bits integer value.

Returns
variable held by value as a 64 bits integer value.
Exceptions
std::bad_cast.

◆ getInt8()

int8_t join::Value::getInt8 ( ) const
inlineconstexpr

get variable held by value as a 8 bits integer.

Returns
variable held by value as a 8 bits integer.
Exceptions
std::bad_cast.

◆ getObject() [1/2]

Object & join::Value::getObject ( )
inlineconstexpr

get variable held by value as an object.

Returns
variable held by value as an object.
Exceptions
std::bad_cast.

◆ getObject() [2/2]

const Object & join::Value::getObject ( ) const
inlineconstexpr

get variable held by value as an object.

Returns
variable held by value as an object.
Exceptions
std::bad_cast.

◆ getString()

std::string_view join::Value::getString ( ) const
inlineconstexpr

get variable held by value as a string value.

Returns
variable held by value as a string value.
Exceptions
std::bad_cast.

◆ getUint()

uint32_t join::Value::getUint ( ) const
inlineconstexpr

get variable held by value as a 32 bits unsigned integer value.

Returns
variable held by value as a 32 bits unsigned integer value.
Exceptions
std::bad_cast.

◆ getUint16()

uint16_t join::Value::getUint16 ( ) const
inlineconstexpr

get variable held by value as a 16 bits unsigned integer.

Returns
variable held by value as a 16 bits unsigned integer.
Exceptions
std::bad_cast.

◆ getUint64()

uint64_t join::Value::getUint64 ( ) const
inlineconstexpr

get variable held by value as a 64 bits unsigned integer value.

Returns
variable held by value as a 64 bits unsigned integer value.
Exceptions
std::bad_cast.

◆ getUint8()

uint8_t join::Value::getUint8 ( ) const
inlineconstexpr

get variable held by value as a 8 bits unsigned integer.

Returns
variable held by value as a 8 bits unsigned integer.
Exceptions
std::bad_cast.

◆ index()

std::size_t join::Value::index ( ) const
inlineconstexprnoexcept

get the index of the alternative in use.

Returns
index of the alternative in use.

◆ insert() [1/2]

Value & join::Value::insert ( const Member & member)
inline

insert element in the nested container.

Parameters
memberthe element to insert in the nested container.
Returns
a reference to the inserted element.
Exceptions
std::bad_cast.

◆ insert() [2/2]

Value & join::Value::insert ( Member && member)
inline

insert element in the nested container.

Parameters
memberthe element to insert in the nested container.
Returns
a reference to the inserted element.
Exceptions
std::bad_cast.

◆ isArray()

bool join::Value::isArray ( ) const
inlineconstexpr

check if the variable held by value is an array.

Returns
true if the variable held by value is an array, false otherwise.

◆ isBool()

bool join::Value::isBool ( ) const
inlineconstexpr

check if the variable held by value is a boolean value.

Returns
true if the variable held by value is a boolean value, false otherwise.

◆ isDouble()

bool join::Value::isDouble ( ) const
inlineconstexpr

check if the variable held by value is a double value.

Returns
true if the variable held by value is a double value, false otherwise.

◆ isFalse()

bool join::Value::isFalse ( ) const
inlineconstexpr

check if the content of the value is false.

Returns
true if the content of the value is false, false otherwise.
Exceptions
std::bad_cast.

◆ isFloat()

bool join::Value::isFloat ( ) const
inlineconstexpr

check if the variable held by value is a float value.

Returns
true if the variable held by value is a float value, false otherwise.

◆ isInt()

bool join::Value::isInt ( ) const
inlineconstexpr

check if the variable held by value is a 32 bits integer value.

Returns
true if the variable held by value is a 32 bits integer value, false otherwise.

◆ isInt16()

bool join::Value::isInt16 ( ) const
inlineconstexpr

check if the variable held by value is a 16 bits integer value.

Returns
true if the variable held by value is a 16 bits integer value, false otherwise.

◆ isInt64()

bool join::Value::isInt64 ( ) const
inlineconstexpr

check if the variable held by value is a 64 bits integer value.

Returns
true if the variable held by value is a 64 bits integer value, false otherwise.

◆ isInt8()

bool join::Value::isInt8 ( ) const
inlineconstexpr

check if the variable held by value is a 8 bits integer value.

Returns
true if the variable held by value is a 8 bits integer value, false otherwise.

◆ isNull()

bool join::Value::isNull ( ) const
inlineconstexpr

check if the variable held by value is a null value.

Returns
true if the variable held by value is null, false otherwise.

◆ isNumber()

bool join::Value::isNumber ( ) const
inlineconstexpr

check if the variable held by value is a number value.

Returns
true if the variable held by value is a number, false otherwise.

◆ isObject()

bool join::Value::isObject ( ) const
inlineconstexpr

check if the variable held by value is an object.

Returns
true if the variable held by value is an object, false otherwise.

◆ isString()

bool join::Value::isString ( ) const
inlineconstexpr

check if the variable held by value is a string value.

Returns
true if the variable held by value is a string value, false otherwise.

◆ isTrue()

bool join::Value::isTrue ( ) const
inlineconstexpr

check if the content of the value is true.

Returns
true if the content of the value is true, false otherwise.
Exceptions
std::bad_cast.

◆ isUint()

bool join::Value::isUint ( ) const
inlineconstexpr

check if the variable held by value is a 32 bits unsigned integer value.

Returns
true if the variable held by value is a 32 bits unsigned integer value, false otherwise.

◆ isUint16()

bool join::Value::isUint16 ( ) const
inlineconstexpr

check if the variable held by value is a 16 bits unsigned integer value.

Returns
true if the variable held by value is a 16 bits unsigned integer value, false otherwise.

◆ isUint64()

bool join::Value::isUint64 ( ) const
inlineconstexpr

check if the variable held by value is a 64 bits unsigned integer value.

Returns
true if the variable held by value is a 64 bits unsigned integer value, false otherwise.

◆ isUint8()

bool join::Value::isUint8 ( ) const
inlineconstexpr

check if the variable held by value is a 8 bits unsigned integer value.

Returns
true if the variable held by value is a 8 bits unsigned integer value, false otherwise.

◆ jsonCanonicalize()

int Value::jsonCanonicalize ( std::ostream & document) const

serialize canonicalized json data.

Parameters
documentDocument where to serialize canonicalized json data.
Returns
0 on success, -1 otherwise.

◆ jsonRead() [1/9]

int Value::jsonRead ( const char * document,
size_t length )

deserialize a json document.

Parameters
documentjson document to deserialize.
lengththe length of the json document to deserialize.
Returns
0 on success, -1 otherwise.

◆ jsonRead() [2/9]

int Value::jsonRead ( const char * first,
const char * last )

deserialize a json document.

Parameters
firstthe first character of the json document to deserialize.
lastthe last character of the document to deserialize.
Returns
0 on success, -1 otherwise.

◆ jsonRead() [3/9]

int Value::jsonRead ( std::fstream & document)

deserialize a json document.

Parameters
documentjson document to deserialize.
Returns
0 on success, -1 otherwise.

◆ jsonRead() [4/9]

int Value::jsonRead ( std::ifstream & document)

deserialize a json document.

Parameters
documentjson document to deserialize.
Returns
0 on success, -1 otherwise.

◆ jsonRead() [5/9]

int Value::jsonRead ( std::iostream & document)

deserialize a json document.

Parameters
documentjson document to deserialize.
Returns
0 on success, -1 otherwise.

◆ jsonRead() [6/9]

int Value::jsonRead ( std::istream & document)

deserialize a json document.

Parameters
documentjson document to deserialize.
Returns
0 on success, -1 otherwise.

◆ jsonRead() [7/9]

int Value::jsonRead ( std::istringstream & document)

deserialize a json document.

Parameters
documentjson document to deserialize.
Returns
0 on success, -1 otherwise.

◆ jsonRead() [8/9]

int Value::jsonRead ( std::string_view document)

deserialize a json document.

Parameters
documentjson document to deserialize.
Returns
0 on success, -1 otherwise.

◆ jsonRead() [9/9]

int Value::jsonRead ( std::stringstream & document)

deserialize a json document.

Parameters
documentjson document to deserialize.
Returns
0 on success, -1 otherwise.

◆ jsonWrite()

int Value::jsonWrite ( std::ostream & document,
size_t indentation = 0 ) const

serialize json data.

Parameters
documentDocument where to serialize json data.
indentationnumber of spaces per indentation level.
Returns
0 on success, -1 otherwise.

◆ operator bool()

join::Value::operator bool ( ) const
inlineexplicit

explicit conversion function for boolean value.

Returns
converted boolean value.
Exceptions
std::bad_cast.

◆ operator double()

join::Value::operator double ( ) const
inlineexplicit

explicit conversion function for double value.

Returns
converted double value.
Exceptions
std::bad_cast.

◆ operator float()

join::Value::operator float ( ) const
inlineexplicit

explicit conversion function for float value.

Returns
converted float value.
Exceptions
std::bad_cast.

◆ operator int16_t()

join::Value::operator int16_t ( ) const
inlineexplicit

explicit conversion function for 16 bits integer value.

Returns
converted short value.
Exceptions
std::bad_cast.

◆ operator int32_t()

join::Value::operator int32_t ( ) const
inlineexplicit

explicit conversion function for 32 bits integer value.

Returns
converted integer value.
Exceptions
std::bad_cast.

◆ operator int64_t()

join::Value::operator int64_t ( ) const
inlineexplicit

explicit conversion function for 64 bits integer value.

Returns
converted integer 64 bits value.
Exceptions
std::bad_cast.

◆ operator int8_t()

join::Value::operator int8_t ( ) const
inlineexplicit

explicit conversion function for 8 bits integer value.

Returns
converted char value.
Exceptions
std::bad_cast.

◆ operator std::string_view()

join::Value::operator std::string_view ( ) const
inlineexplicit

explicit conversion function for string value.

Returns
converted string value.
Exceptions
std::bad_cast.

◆ operator uint16_t()

join::Value::operator uint16_t ( ) const
inlineexplicit

explicit conversion function for 16 bits unsigned integer value.

Returns
converted unsigned short value.
Exceptions
std::bad_cast.

◆ operator uint32_t()

join::Value::operator uint32_t ( ) const
inlineexplicit

explicit conversion function for 32 bits unsigned integer value.

Returns
converted unsigned integer value.
Exceptions
std::bad_cast.

◆ operator uint64_t()

join::Value::operator uint64_t ( ) const
inlineexplicit

explicit conversion function for 64 bits unsigned integer value.

Returns
converted 64 bits unsigned integer value.
Exceptions
std::bad_cast.

◆ operator uint8_t()

join::Value::operator uint8_t ( ) const
inlineexplicit

explicit conversion function for 8 bits unsigned integer value.

Returns
converted unsihed char value.
Exceptions
std::bad_cast.

◆ operator=() [1/2]

Value & join::Value::operator= ( const Value & other)
default

copy assignment.

Parameters
otherobject to copy.
Returns
a reference of the current object.

◆ operator=() [2/2]

Value & join::Value::operator= ( Value && other)
default

move assignment.

Parameters
otherobject to move.
Returns
a reference of the current object.

◆ operator[]() [1/9]

Value & join::Value::operator[] ( bool key)
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast.

◆ operator[]() [2/9]

Value & join::Value::operator[] ( const char * key)
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast.

◆ operator[]() [3/9]

Value & join::Value::operator[] ( double key)
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast.

◆ operator[]() [4/9]

Value & join::Value::operator[] ( int32_t key)
inline

returns a reference to the value at position pos or mapped to key.

Parameters
keyposition or key of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast.

◆ operator[]() [5/9]

Value & join::Value::operator[] ( int64_t key)
inline

returns a reference to the value at position pos or mapped to key.

Parameters
keyposition or key of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast.

◆ operator[]() [6/9]

Value & join::Value::operator[] ( std::nullptr_t key)
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast.

◆ operator[]() [7/9]

Value & join::Value::operator[] ( std::string_view key)
inline

returns a reference to the value mapped to key.

Parameters
keykey of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast.

◆ operator[]() [8/9]

Value & join::Value::operator[] ( uint32_t key)
inline

returns a reference to the value at position pos or mapped to key.

Parameters
keyposition or key of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast.

◆ operator[]() [9/9]

Value & join::Value::operator[] ( uint64_t key)
inline

returns a reference to the value at position pos or mapped to key.

Parameters
keyposition or key of the element to find.
Returns
a reference to the requested element.
Exceptions
std::bad_cast.

◆ packRead() [1/9]

int Value::packRead ( const char * document,
size_t length )

deserialize a msgpack document.

Parameters
documentmsgpack document to deserialize.
lengththe length of the msgpack document to deserialize.
Returns
0 on success, -1 otherwise.

◆ packRead() [2/9]

int Value::packRead ( const char * first,
const char * last )

deserialize a msgpack document.

Parameters
firstthe first character of the msgpack document to deserialize.
lastthe last character of the document to deserialize.
Returns
0 on success, -1 otherwise.

◆ packRead() [3/9]

int Value::packRead ( std::fstream & document)

deserialize a msgpack document.

Parameters
documentmsgpack document to deserialize.
Returns
0 on success, -1 otherwise.

◆ packRead() [4/9]

int Value::packRead ( std::ifstream & document)

deserialize a msgpack document.

Parameters
documentmsgpack document to deserialize.
Returns
0 on success, -1 otherwise.

◆ packRead() [5/9]

int Value::packRead ( std::iostream & document)

deserialize a msgpack document.

Parameters
documentmsgpack document to deserialize.
Returns
0 on success, -1 otherwise.

◆ packRead() [6/9]

int Value::packRead ( std::istream & document)

deserialize a msgpack document.

Parameters
documentmsgpack document to deserialize.
Returns
0 on success, -1 otherwise.

◆ packRead() [7/9]

int Value::packRead ( std::istringstream & document)

deserialize a msgpack document.

Parameters
documentmsgpack document to deserialize.
Returns
0 on success, -1 otherwise.

◆ packRead() [8/9]

int Value::packRead ( std::string_view document)

deserialize a msgpack document.

Parameters
documentmsgpack document to deserialize.
Returns
0 on success, -1 otherwise.

◆ packRead() [9/9]

int Value::packRead ( std::stringstream & document)

deserialize a msgpack document.

Parameters
documentmsgpack document to deserialize.
Returns
0 on success, -1 otherwise.

◆ packWrite()

int Value::packWrite ( std::ostream & document) const

serialize msgpack data.

Parameters
documentDocument where to serialize msgpack data.
Returns
0 on success, -1 otherwise.

◆ popBack()

void join::Value::popBack ( )
inline

removes the last element of the nested container.

Exceptions
std::bad_cast.

◆ pushBack() [1/2]

Value & join::Value::pushBack ( const Value & value)
inline

appends element at the end of the nested container.

Parameters
valuethe element to append.
Returns
a reference to the pushed object.
Exceptions
std::bad_cast.

◆ pushBack() [2/2]

Value & join::Value::pushBack ( Value && value)
inline

appends element at the end of the nested container.

Parameters
valuethe element to append.
Returns
a reference to the pushed object.
Exceptions
std::bad_cast.

◆ reserve()

void join::Value::reserve ( size_t cap)
inline

increase the capacity of the nested container.

Parameters
capnew capacity.
Exceptions
std::bad_cast.

◆ serialize() [1/2]

template<typename Handler >
int join::Value::serialize ( Handler & handler) const
inline

serialize the value, resetting the handler on failure.

Parameters
handlerhandler receiving the value.
Returns
0 on success, -1 otherwise.

◆ serialize() [2/2]

template<typename Writer , typename... Args>
int join::Value::serialize ( std::ostream & document,
Args &&... args ) const
inline

serialize the value to a stream.

Parameters
documentstream receiving the value.
argswriter arguments.
Returns
0 on success, -1 otherwise.

◆ size()

size_t join::Value::size ( ) const
inline

returns the number of elements in the nested container.

Returns
the number of elements in the nested container.
Exceptions
std::bad_cast.

◆ swap()

void join::Value::swap ( Value & other)
inline

exchanges the contents of the value with those of other.

Parameters
othervalue to exchange the contents with.

Friends And Related Symbol Documentation

◆ operator<=>

std::partial_ordering operator<=> ( const Value & lhs,
const Value & rhs )
friend

three-way compare values.

Parameters
lhsvalue to compare.
rhsvalue to compare to.
Returns
ordering of lhs relative to rhs.

◆ operator==

bool operator== ( const Value & lhs,
const Value & rhs )
friend

compare if equal.

Parameters
lhsvalue to compare.
rhsvalue to compare to.
Returns
true if equal.

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