messagepack implementation for embedded systems (mbed / arduino)
Dependents: hello_message_pack
object Struct Reference
Object class that corresponding to MessagePack format object. More...
#include <object_fwd.hpp>
Inherited by object::with_zone.
Public Member Functions | |
bool | is_nil () const |
Cheking nil. | |
template<typename T > | |
T | 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 > | |
std::enable_if <!msgpack::has_as< T >::value, T >::type | as () const |
Get value as T. | |
template<typename T > | |
T & | convert (T &v) const |
Convert the object. | |
template<typename T > | |
T * | 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. | |
object (const msgpack_object &o) | |
Copy constructor. Object is shallow copied. | |
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) |
Detailed Description
Object class that corresponding to MessagePack format object.
See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object
Definition at line 106 of file object_fwd.hpp.
Constructor & Destructor Documentation
object | ( | ) |
Default constructor. The object is set to nil.
Definition at line 572 of file object.hpp.
object | ( | const msgpack_object & | o ) |
Copy constructor. Object is shallow copied.
Definition at line 609 of file object.hpp.
object | ( | const T & | v ) | [explicit] |
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:
-
T The type of `v`.
- Parameters:
-
v The value you want to convert.
Definition at line 578 of file object.hpp.
object | ( | const T & | v, |
msgpack::zone & | z | ||
) |
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:
-
T The type of `v`.
- Parameters:
-
v The value you want to convert. z The zone that is used by the object.
Definition at line 591 of file object.hpp.
object | ( | const T & | v, |
msgpack::zone * | z | ||
) |
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:
-
T The type of `v`.
- Parameters:
-
v The value you want to convert. z The pointer to the zone that is used by the object.
Definition at line 600 of file object.hpp.
Member Function Documentation
std::enable_if<!msgpack::has_as< T >::value, T >::type as | ( | ) | const |
std::enable_if<!msgpack::has_as<T>::value, T>::type as | ( | ) | const |
Get value as T.
If the object can't be converted to T, msgpack::type_error would be thrown.
- Template Parameters:
-
T The type you want to get.
- Returns:
- The converted object.
std::enable_if<msgpack::has_as<T>::value, T>::type as | ( | ) | const |
Get value as T.
If the object can't be converted to T, msgpack::type_error would be thrown.
- Template Parameters:
-
T The type you want to get.
- Returns:
- The converted object.
T & convert | ( | T & | v ) | const |
Convert the object.
If the object can't be converted to T, msgpack::type_error would be thrown.
- Template Parameters:
-
T The type of v.
- Parameters:
-
v The value you want to get. `v` is output parameter. `v` is overwritten by converted value from the object.
- Returns:
- The reference of `v`.
Definition at line 521 of file object.hpp.
T * convert | ( | T * | v ) | const |
Convert the object (obsolete)
If the object can't be converted to T, msgpack::type_error would be thrown.
- Template Parameters:
-
T The type of v.
- Parameters:
-
v The 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`.
Definition at line 529 of file object.hpp.
bool convert_if_not_nil | ( | T & | v ) | const |
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:
-
T The type of v.
- Parameters:
-
v The 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.
Definition at line 537 of file object.hpp.
bool is_nil | ( | ) | const |
Cheking nil.
- Returns:
- If the object is nil, then return true, else return false.
Definition at line 129 of file object_fwd.hpp.
Generated on Tue Jul 12 2022 22:51:46 by 1.7.2