MessagePack for C++
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | List of all members
msgpack::object Struct Reference

Object class that corresponding to MessagePack format object. More...

#include <object_fwd.hpp>

Inheritance diagram for msgpack::object:
Inheritance graph
[legend]
Collaboration diagram for msgpack::object:
Collaboration graph
[legend]

Classes

struct  implicit_type
 
union  union_type
 

Public Member Functions

bool is_nil () const
 Cheking nil.
 
template<typename T >
std::enable_if< msgpack::has_as< T >::value, T >::type as () const
 Get value as T.
 
template<typename T >
std::enable_if<!msgpack::has_as< T >::value, T >::type as () const
 Get value as T.
 
template<typename T >
msgpack::enable_if<!msgpack::is_array< T >::value &&!msgpack::is_pointer< T >::value, T & >::type convert (T &v) const
 Convert the object.
 
template<typename T , std::size_t N>
T(& convert (T(&v)[N]) const)[N]
 
template<typename T >
msgpack::enable_if< msgpack::is_pointer< T >::value, T >::type convert (T v) const
 Convert the object (obsolete)
 
template<typename T >
bool convert_if_not_nil (T &v) const
 Convert the object if not nil.
 
 object ()
 Default constructor. The object is set to nil.
 
template<typename T >
 object (const T &v)
 Construct object from T.
 
template<typename T >
 object (const T &v, msgpack::zone &z)
 Construct object from T.
 
template<typename T >
 object (const T &v, msgpack::zone *z)
 Construct object from T (obsolete)
 
template<typename T >
objectoperator= (const T &v)
 
implicit_type convert () const
 
 object ()
 
 object (v1::object const &o)
 
template<typename T >
 object (const T &v)
 Construct object from T.
 
template<typename T >
 object (const T &v, msgpack::zone &z)
 Construct object from T.
 
template<typename T >
T & convert (T &v) const
 Convert the object.
 
implicit_type convert () const
 

Public Attributes

msgpack::type::object_type type
 
union_type via
 

Detailed Description

Object class that corresponding to MessagePack format object.

See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object

Constructor & Destructor Documentation

◆ object() [1/8]

msgpack::object::object ( )
inline

Default constructor. The object is set to nil.

◆ object() [2/8]

template<typename T >
msgpack::object::object ( const T v)
inlineexplicit

Construct object from T.

If v is the type that is corresponding to MessegePack format str, bin, ext, array, or map, you need to call object(const T& v, msgpack::zone& z) instead of this constructor.

Template Parameters
TThe type of v.
Parameters
vThe value you want to convert.

◆ object() [3/8]

template<typename T >
msgpack::object::object ( const T v,
msgpack::zone z 
)
inline

Construct object from T.

The object is constructed on the zone z. See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object

Template Parameters
TThe type of v.
Parameters
vThe value you want to convert.
zThe zone that is used by the object.

References msgpack::operator<<().

◆ object() [4/8]

template<typename T >
msgpack::object::object ( const T v,
msgpack::zone z 
)
inline

Construct object from T (obsolete)

The object is constructed on the zone z. Use object(const T& v, msgpack::zone& z) instead of this constructor. See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object

Template Parameters
TThe type of v.
Parameters
vThe value you want to convert.
zThe pointer to the zone that is used by the object.

References msgpack::operator<<().

◆ object() [5/8]

msgpack::object::object ( )
inline

◆ object() [6/8]

msgpack::object::object ( v1::object const o)
inline

◆ object() [7/8]

template<typename T >
msgpack::object::object ( const T v)
inlineexplicit

Construct object from T.

If v is the type that is corresponding to MessegePack format str, bin, ext, array, or map, you need to call object(const T& v, msgpack::zone& z) instead of this constructor.

Template Parameters
TThe type of v.
Parameters
vThe value you want to convert.

References convert().

◆ object() [8/8]

template<typename T >
msgpack::object::object ( const T v,
msgpack::zone z 
)
inline

Construct object from T.

The object is constructed on the zone z. See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object

Template Parameters
TThe type of v.
Parameters
vThe value you want to convert.
zThe zone that is used by the object.

Member Function Documentation

◆ as() [1/2]

template<typename T >
std::enable_if<!msgpack::has_as< T >::value, T >::type msgpack::object::as ( ) const
inline

Get value as T.

If the object can't be converted to T, msgpack::type_error would be thrown.

Template Parameters
TThe type you want to get.
Returns
The converted object.

◆ as() [2/2]

template<typename T >
std::enable_if<!msgpack::has_as< T >::value, T >::type msgpack::object::as ( ) const

Get value as T.

If the object can't be converted to T, msgpack::type_error would be thrown.

Template Parameters
TThe type you want to get.
Returns
The converted object.

◆ convert() [1/6]

object::implicit_type msgpack::object::convert ( ) const
inline

Referenced by convert(), and object().

◆ convert() [2/6]

implicit_type msgpack::object::convert ( ) const

◆ convert() [3/6]

template<typename T >
msgpack::enable_if<!msgpack::is_array< T >::value &&!msgpack::is_pointer< T >::value, T & >::type msgpack::object::convert ( T &  v) const
inline

Convert the object.

If the object can't be converted to T, msgpack::type_error would be thrown.

Template Parameters
TThe type of v.
Parameters
vThe value you want to get. v is output parameter. v is overwritten by converted value from the object.
Returns
The reference of v.

References msgpack::operator>>().

Referenced by msgpack::convert().

◆ convert() [4/6]

template<typename T >
T & msgpack::object::convert ( T &  v) const
inline

Convert the object.

If the object can't be converted to T, msgpack::type_error would be thrown.

Template Parameters
TThe type of v.
Parameters
vThe value you want to get. v is output parameter. v is overwritten by converted value from the object.
Returns
The reference of v.

References convert().

◆ convert() [5/6]

template<typename T >
msgpack::enable_if< msgpack::is_pointer< T >::value, T >::type msgpack::object::convert ( v) const
inline

Convert the object (obsolete)

If the object can't be converted to T, msgpack::type_error would be thrown.

Template Parameters
TThe type of v.
Parameters
vThe pointer of the value you want to get. v is output parameter. *v is overwritten by converted value from the object.
Returns
The pointer of v.

References msgpack::convert().

◆ convert() [6/6]

template<typename T , std::size_t N>
T(& msgpack::object::convert ( T(&)  v[N]) )[N]
inline

References msgpack::operator>>().

◆ convert_if_not_nil()

template<typename T >
bool msgpack::object::convert_if_not_nil ( T v) const
inline

Convert the object if not nil.

If the object is not nil and can't be converted to T, msgpack::type_error would be thrown.

Template Parameters
TThe type of v.
Parameters
vThe value you want to get. v is output parameter. v is overwritten by converted value from the object if the object is not nil.
Returns
If the object is nil, then return false, else return true.

References msgpack::convert().

◆ is_nil()

bool msgpack::object::is_nil ( ) const
inline

Cheking nil.

Returns
If the object is nil, then return true, else return false.

◆ operator=()

template<typename T >
object & msgpack::object::operator= ( const T v)
inline

Member Data Documentation

◆ type

msgpack::type::object_type msgpack::object::type

◆ via

union_type msgpack::object::via

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