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

value class. More...

#include <value.hpp>

Inheritance diagram for join::Value:
Collaboration diagram for join::Value:

Public Types

enum  Index : size_t {
  Null = 0 , Boolean = 1 , Integer = 2 , Unsigned = 3 ,
  Integer64 = 4 , Unsigned64 = 5 , Real = 6 , String = 7 ,
  ArrayValue = 8 , ObjectValue = 9
}
 nested value type index. More...
 
using Ptr = Value*
 pointer.
 
- Public Types inherited from join::Variant< std::nullptr_t, bool, int32_t, uint32_t, int64_t, uint64_t, double, std::string, Array, Object >
using Base
 
using DefaultEnabler
 

Public Member Functions

constexpr Value ()=default
 default constructor.
 
constexpr Value (const char *other)
 constructs the value with the copy of the contents of a C-style string.
 
Valueoperator= (const char *other)
 replaces the contents with a copy of a C-style string.
 
constexpr Value (const Value &other)=default
 copy constructor.
 
Valueoperator= (const Value &other)=default
 copy assignment.
 
constexpr Value (Value &&other)=default
 move constructor.
 
Valueoperator= (Value &&other)=default
 move assignment.
 
virtual ~Value ()=default
 destroy the Value instance.
 
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 const std::string & getString () const
 get variable held by value as a string value.
 
constexpr std::string & getString ()
 get variable held by value as a string value.
 
 operator const char * () const
 explicit conversion function for string value.
 
constexpr bool isArray () const
 check if the variable held by value is an array.
 
constexpr const ArraygetArray () const
 get variable held by value as an array.
 
constexpr ArraygetArray ()
 get variable held by value as an array.
 
constexpr bool isObject () const
 check if the variable held by value is an object.
 
constexpr const ObjectgetObject () const
 get variable held by value as an object.
 
constexpr ObjectgetObject ()
 get variable held by value as an object.
 
Valueat (size_t pos)
 returns a reference to the element at specified location pos.
 
const Valueat (size_t pos) const
 returns a reference to the element at specified location pos.
 
Valueat (const std::string &key)
 returns a reference to the value that is mapped to a key.
 
const Valueat (const std::string &key) const
 returns a reference to the value that is mapped to a key.
 
Valueoperator[] (size_t pos)
 returns a reference to the element at specified location pos.
 
Valueoperator[] (const std::string &key)
 returns a reference to the value that is mapped to a 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.
 
Valueinsert (const Member &member)
 insert element in the nested container.
 
Valueinsert (Member &&member)
 insert element in the nested container.
 
size_t erase (const std::string &key)
 removes member with the key equivalent to key.
 
template<typename... Args>
ValueemplaceBack (Args &&... args)
 appends element at the end of the nested container.
 
ValuepushBack (const Value &value)
 appends element at the end of the nested container.
 
ValuepushBack (Value &&value)
 appends element at the end of the nested container.
 
void popBack ()
 removes the last element of the nested container.
 
bool contains (size_t pos) const
 checks if the nested container contains an element at position pos.
 
bool contains (const std::string &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 Reader >
int deserialize (const char *document, size_t length)
 deserialize a document.
 
template<typename Reader >
int deserialize (const char *first, const char *last)
 deserialize a document.
 
template<typename Reader >
int deserialize (const std::string &document)
 deserialize a document.
 
template<typename Reader >
int deserialize (std::stringstream &document)
 deserialize a document.
 
template<typename Reader >
int deserialize (std::istringstream &document)
 deserialize a document.
 
template<typename Reader >
int deserialize (std::fstream &document)
 deserialize a document.
 
template<typename Reader >
int deserialize (std::ifstream &document)
 deserialize a document.
 
template<typename Reader >
int deserialize (std::iostream &document)
 deserialize a document.
 
template<typename Reader >
int deserialize (std::istream &document)
 deserialize a document.
 
template<typename Writer >
int serialize (std::ostream &document) const
 serialize data.
 
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 (const std::string &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)
 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 (const std::string &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.
 
constexpr Variant ()=default
 inherits parent's constructors.
 
constexpr Variant (const Variant &)=default
 inherits parent's constructors.
 
constexpr Variant (Variant &&)=default
 inherits parent's constructors.
 
template<typename T , typename Match = match_t <T&&, Ts...>, typename = std::enable_if_t <is_unique <Match, Ts...>::value && std::is_constructible <Match, T&&>::value>>
constexpr Variant (T &&t) noexcept
 inherits parent's constructors.
 
template<typename T , typename... Args, typename = std::enable_if_t <is_unique <T, Ts...>::value && std::is_constructible <T, Args&&...>::value>>
constexpr Variant (in_place_type_t< T >, Args &&... args)
 inherits parent's constructors.
 
template<typename T , typename Up , typename... Args, typename = std::enable_if_t <is_unique <T, Ts...>::value && std::is_constructible <T, std::initializer_list <Up>&, Args&&...>::value>>
constexpr Variant (in_place_type_t< T >, std::initializer_list< Up > il, Args &&... args)
 inherits parent's constructors.
 
template<std::size_t I, typename... Args, typename = std::enable_if_t <std::is_constructible < find_element_t <I, Ts...>, Args&&...>::value>>
constexpr Variant (in_place_index_t< I >, Args &&... args)
 inherits parent's constructors.
 
template<std::size_t I, typename Up , typename... Args, typename = std::enable_if_t <std::is_constructible < find_element_t <I, Ts...>, std::initializer_list <Up>&, Args&&...>::value>>
constexpr Variant (in_place_index_t< I >, std::initializer_list< Up > il, Args &&... args)
 inherits parent's constructors.
 
constexpr Variantoperator= (const Variant &other)=default
 inherits parent's assignment operators.
 
constexpr Variantoperator= (Variant &&other)=default
 inherits parent's assignment operators.
 
template<typename T , typename Match = match_t <T&&, Ts...>>
constexpr std::enable_if_t< is_unique< Match, Ts... >::value &&std::is_constructible< Match, T && >::value, Variant & > operator= (T &&t) noexcept
 inherits parent's assignment operators.
 
- Public Member Functions inherited from join::Variant< std::nullptr_t, bool, int32_t, uint32_t, int64_t, uint64_t, double, std::string, Array, Object >
constexpr Variant ()=default
 default constructor.
 
constexpr Variant (const Variant &)=default
 copy constructor.
 
constexpr Variant (Variant &&)=default
 move constructor.
 
constexpr Variant (T &&t) noexcept
 constructs a Variant holding the alternative selected by overload resolution.
 
constexpr Variant (in_place_type_t< T >, Args &&... args)
 constructs a Variant with the specified alternative T.
 
constexpr Variant (in_place_type_t< T >, std::initializer_list< Up > il, Args &&... args)
 constructs a Variant with the specified alternative T.
 
constexpr Variant (in_place_index_t< I >, Args &&... args)
 constructs a variant with the alternative T specified by the index I.
 
constexpr Variant (in_place_index_t< I >, std::initializer_list< Up > il, Args &&... args)
 constructs a variant with the alternative T specified by the index I.
 
virtual ~Variant ()=default
 destroy the Variant instance.
 
constexpr Variantoperator= (const Variant &other)=default
 copy assignment.
 
constexpr Variantoperator= (Variant &&other)=default
 move assignment.
 
constexpr std::enable_if_t< is_unique< Match, Ts... >::value &&std::is_constructible< Match, T && >::value, Variant & > operator= (T &&t) noexcept
 assign a Variant holding the alternative selected by overload resolution.
 
constexpr std::enable_if_t< is_unique< T, Ts... >::value, bool > is () const
 check that the member type in use is the same than the one specified.
 
constexpr std::enable_if_t< is_index< I, Ts... >::value, bool > is () const
 check that the index in use is the same than the one specified.
 
constexpr std::enable_if_t< is_unique< T, Ts... >::value &&std::is_constructible< T, Args &&... >::value, T & > set (Args &&...args)
 set the variable type of the object identified by type and assign it a value.
 
constexpr std::enable_if_t< is_unique< T, Ts... >::value &&std::is_constructible< T, std::initializer_list< Up > &, Args &&... >::value, T & > set (std::initializer_list< Up > il, Args &&... args)
 set the variable type of the object identified by type and assign it a value.
 
constexpr std::enable_if_t< std::is_constructible< find_element_t< I, Ts... >, Args &&... >::value, find_element_t< I, Ts... > & > set (Args &&...args)
 set the variable type of the object identified by index and assign it a value.
 
constexpr std::enable_if_t< std::is_constructible< find_element_t< I, Ts... >, std::initializer_list< Up > &, Args &&... >::value, find_element_t< I, Ts... > & > set (std::initializer_list< Up > il, Args &&... args)
 set the variable type of the object identified by index and assign it a value.
 
constexpr std::enable_if_t< is_unique< T, Ts... >::value, T & > get ()
 get the variable value of the object type identified by type.
 
constexpr std::enable_if_t< is_unique< T, Ts... >::value, const T & > get () const
 get the variable value of the object type identified by type.
 
constexpr std::enable_if_t< is_index< I, Ts... >::value, find_element_t< I, Ts... > & > get ()
 get the variable value of the object type identified by index.
 
constexpr std::enable_if_t< is_index< I, Ts... >::value, const find_element_t< I, Ts... > & > get () const
 get the variable value of the object type identified by index.
 
constexpr std::enable_if_t< is_unique< T, Ts... >::value, T * > getIf ()
 get the variable value address of the object type identified by type.
 
constexpr std::enable_if_t< is_unique< T, Ts... >::value, const T * > getIf () const
 get the variable value address of the object type identified by type.
 
constexpr std::enable_if_t< is_index< I, Ts... >::value, find_element_t< I, Ts... > * > getIf ()
 get the variable value address of the object type identified by index.
 
constexpr std::enable_if_t< is_index< I, Ts... >::value, const find_element_t< I, Ts... > * > getIf () const
 get the variable value address of the object type identified by index.
 
constexpr std::size_t index () const noexcept
 return the index of the alternative that is currently held by the variant.
 

Friends

constexpr bool operator== (const Value &lhs, const Value &rhs)
 compare if equal.
 
constexpr bool operator< (const Value &lhs, const Value &rhs)
 compare if lower than.
 

Additional Inherited Members

- Protected Member Functions inherited from join::Variant< std::nullptr_t, bool, int32_t, uint32_t, int64_t, uint64_t, double, std::string, Array, Object >
constexpr bool equal (const Variant &rhs) const
 check if equal.
 
constexpr bool lower (const Variant &rhs) const
 check if lower than.
 

Detailed Description

value class.

Member Typedef Documentation

◆ Ptr

pointer.

Member Enumeration Documentation

◆ Index

enum join::Value::Index : size_t

nested value type index.

Enumerator
Null 

index of the std::nullptr_t alternative that can be held by the Value object.

Boolean 

index of the boolean alternative that can be held by the Value object.

Integer 

index of the 32 bits integer alternative that can be held by the Value object.

Unsigned 

index of the 32 bits unsigned integer alternative that can be held by the Value object.

Integer64 

index of the 64 bits integer alternative that can be held by the Value object.

Unsigned64 

index of the 64 bits unsigned integer alternative that can be held by the Value object.

Real 

index of the real alternative that can be held by the Value object.

String 

index of the std::string alternative that can be held by the Value object.

ArrayValue 

index of the Array alternative that can be held by the Value object.

ObjectValue 

index of the Object alternative that can be held by the Value object.

Constructor & Destructor Documentation

◆ Value() [1/4]

join::Value::Value ( )
constexprdefault

default constructor.

◆ Value() [2/4]

join::Value::Value ( const char * other)
inlineconstexpr

constructs the value with the copy of the contents of a C-style string.

Parameters
otherc-style string to use as data source.

◆ Value() [3/4]

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

copy constructor.

Parameters
otherobject to copy.

◆ Value() [4/4]

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

move constructor.

Parameters
otherobject to move.

◆ ~Value()

virtual join::Value::~Value ( )
virtualdefault

destroy the Value instance.

Member Function Documentation

◆ at() [1/4]

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

returns a reference to the value that is mapped to a key.

Parameters
keythe key of the element to find.
Returns
a reference to the mapped element.
Exceptions
std::bad_cast.

◆ at() [2/4]

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

returns a reference to the value that is mapped to a key.

Parameters
keythe key of the element to find.
Returns
a reference to the mapped element.
Exceptions
std::bad_cast.

◆ at() [3/4]

Value & join::Value::at ( size_t pos)
inline

returns a reference to the element at specified location pos.

Parameters
posPosition of the element to return.
Returns
a reference to the requested element.
Exceptions
std::bad_cast.

◆ at() [4/4]

const Value & join::Value::at ( size_t pos) const
inline

returns a reference to the element at specified location pos.

Parameters
posPosition of the element to return.
Returns
a reference to the requested element.
Exceptions
std::bad_cast.

◆ clear()

void join::Value::clear ( )
inline

erases all elements in the nested container.

Exceptions
std::bad_cast.

◆ contains() [1/2]

bool join::Value::contains ( const std::string & key) const
inline

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

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

◆ contains() [2/2]

bool join::Value::contains ( size_t pos) const
inline

checks if the nested container contains an element at position pos.

Returns
true if the nested container contains an element at position pos, false otherwise.
Exceptions
std::bad_cast.

◆ deserialize() [1/9]

template<typename Reader >
int join::Value::deserialize ( const char * document,
size_t length )
inline

deserialize a document.

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

◆ deserialize() [2/9]

template<typename Reader >
int join::Value::deserialize ( const char * first,
const char * last )
inline

deserialize a document.

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

◆ deserialize() [3/9]

template<typename Reader >
int join::Value::deserialize ( const std::string & document)
inline

deserialize a document.

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

◆ deserialize() [4/9]

template<typename Reader >
int join::Value::deserialize ( std::fstream & document)
inline

deserialize a document.

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

◆ deserialize() [5/9]

template<typename Reader >
int join::Value::deserialize ( std::ifstream & document)
inline

deserialize a document.

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

◆ deserialize() [6/9]

template<typename Reader >
int join::Value::deserialize ( std::iostream & document)
inline

deserialize a document.

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

◆ deserialize() [7/9]

template<typename Reader >
int join::Value::deserialize ( std::istream & document)
inline

deserialize a document.

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

◆ deserialize() [8/9]

template<typename Reader >
int join::Value::deserialize ( std::istringstream & document)
inline

deserialize a document.

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

◆ deserialize() [9/9]

template<typename Reader >
int join::Value::deserialize ( std::stringstream & document)
inline

deserialize a document.

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

◆ emplaceBack()

template<typename... Args>
Value & join::Value::emplaceBack ( Args &&... args)
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.

◆ 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()

size_t join::Value::erase ( const std::string & key)
inline

removes member with the key equivalent to key.

Parameters
keykey value 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() [1/2]

std::string & join::Value::getString ( )
inlineconstexpr

get variable held by value as a string value.

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

◆ getString() [2/2]

const std::string & 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.

◆ 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)

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 ( const std::string & document)

deserialize a json document.

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

◆ jsonRead() [4/9]

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

deserialize a json document.

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

◆ jsonRead() [5/9]

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

deserialize a json document.

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

◆ jsonRead() [6/9]

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

deserialize a json document.

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

◆ jsonRead() [7/9]

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

deserialize a json document.

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

◆ jsonRead() [8/9]

int Value::jsonRead ( std::istringstream & 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.
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 const char *()

join::Value::operator const char * ( ) const
inlineexplicit

explicit conversion function for string value.

Returns
converted string 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 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/6]

Value & join::Value::operator= ( const char * other)
inline

replaces the contents with a copy of a C-style string.

Parameters
otherc-style string to use as data source.
Returns
a reference of the current value.

◆ operator=() [2/6]

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

copy assignment.

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

◆ operator=() [3/6]

Variant & join::Variant< Ts >::operator= ( const Variant & other)
constexprdefault

inherits parent's assignment operators.

◆ operator=() [4/6]

template<typename T , typename Match = match_t <T&&, Ts...>>
std::enable_if_t< is_unique< Match, Ts... >::value &&std::is_constructible< Match, T && >::value, Variant & > join::Variant< Ts >::operator= ( T && t)
inlineconstexprnoexcept

inherits parent's assignment operators.

◆ operator=() [5/6]

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

move assignment.

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

◆ operator=() [6/6]

Variant & join::Variant< Ts >::operator= ( Variant && other)
constexprdefault

inherits parent's assignment operators.

◆ operator[]() [1/2]

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

returns a reference to the value that is mapped to a key.

Parameters
keythe key of the element to find.
Returns
a reference to the mapped element.
Exceptions
std::bad_cast.

◆ operator[]() [2/2]

Value & join::Value::operator[] ( size_t pos)
inline

returns a reference to the element at specified location pos.

Parameters
posPosition of the element to return.
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 ( const std::string & document)

deserialize a msgpack document.

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

◆ packRead() [4/9]

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

deserialize a msgpack document.

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

◆ packRead() [5/9]

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

deserialize a msgpack document.

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

◆ packRead() [6/9]

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

deserialize a msgpack document.

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

◆ packRead() [7/9]

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

deserialize a msgpack document.

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

◆ packRead() [8/9]

int Value::packRead ( std::istringstream & 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.

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()

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

serialize data.

Parameters
documentDocument where to serialize data.
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.

◆ Variant() [1/8]

join::Variant< Ts >::Variant ( )
constexprdefault

inherits parent's constructors.

◆ Variant() [2/8]

join::Variant< Ts >::Variant ( const Variant & )
constexprdefault

inherits parent's constructors.

◆ Variant() [3/8]

template<std::size_t I, typename... Args, typename = std::enable_if_t <std::is_constructible < find_element_t <I, Ts...>, Args&&...>::value>>
join::Variant< Ts >::Variant ( in_place_index_t< I > ,
Args &&... args )
inlineexplicitconstexpr

inherits parent's constructors.

◆ Variant() [4/8]

template<std::size_t I, typename Up , typename... Args, typename = std::enable_if_t <std::is_constructible < find_element_t <I, Ts...>, std::initializer_list <Up>&, Args&&...>::value>>
join::Variant< Ts >::Variant ( in_place_index_t< I > ,
std::initializer_list< Up > il,
Args &&... args )
inlineexplicitconstexpr

inherits parent's constructors.

◆ Variant() [5/8]

template<typename T , typename... Args, typename = std::enable_if_t <is_unique <T, Ts...>::value && std::is_constructible <T, Args&&...>::value>>
join::Variant< Ts >::Variant ( in_place_type_t< T > ,
Args &&... args )
inlineexplicitconstexpr

inherits parent's constructors.

◆ Variant() [6/8]

template<typename T , typename Up , typename... Args, typename = std::enable_if_t <is_unique <T, Ts...>::value && std::is_constructible <T, std::initializer_list <Up>&, Args&&...>::value>>
join::Variant< Ts >::Variant ( in_place_type_t< T > ,
std::initializer_list< Up > il,
Args &&... args )
inlineexplicitconstexpr

inherits parent's constructors.

◆ Variant() [7/8]

template<typename T , typename Match = match_t <T&&, Ts...>, typename = std::enable_if_t <is_unique <Match, Ts...>::value && std::is_constructible <Match, T&&>::value>>
join::Variant< Ts >::Variant ( T && t)
inlineconstexprnoexcept

inherits parent's constructors.

◆ Variant() [8/8]

join::Variant< Ts >::Variant ( Variant && )
constexprdefault

inherits parent's constructors.

Friends And Related Symbol Documentation

◆ operator<

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

compare if lower than.

Parameters
lhsvalue to compare.
rhsvalue to compare to.
Returns
true if lower than.

◆ 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: