10 #ifndef MSGPACK_V1_OBJECT_HPP 11 #define MSGPACK_V1_OBJECT_HPP 87 #if defined(MSGPACK_USE_CPP03) 88 struct object_handle_ref {
99 m_obj(ref.m_oh->m_obj),
110 m_obj = ref.m_oh->m_obj;
115 operator object_handle_ref() {
116 return object_handle_ref(
this);
118 #endif // defined(MSGPACK_USE_CPP03) 127 template <std::
size_t N>
150 for (uint32_t i = 0; i < obj.
via.
map.
size; ++i) {
186 template <
typename T>
187 inline object::implicit_type::operator T() {
return obj.as<T>(); }
190 template <
typename Stream,
typename T>
200 template <
typename T,
typename Enabler>
208 template <
typename T,
typename Enabler>
209 template <
typename Stream>
216 template <
typename T,
typename Enabler>
220 v.msgpack_object(static_cast<msgpack::object*>(&o), o.
zone);
236 template <
typename Stream>
319 std::memcpy(&o.
via, &v.
via,
sizeof(v.
via));
388 o << static_cast<msgpack::object const&>(v);
397 template <
typename Type>
403 define(
const msgpack_type& v) : msgpack_type(v) {}
405 template <
typename Packer>
408 msgpack::operator<<(o, static_cast<const msgpack_type&>(*this));
419 template <
typename Stream>
420 template <
typename T>
429 if(x.
type != y.
type) {
return false; }
503 template <
typename T>
512 {
return !(x == y); }
514 template <
typename T>
518 template <
typename T>
520 {
return !(x == y); }
522 template <
typename T>
532 template <
typename T>
544 template <
typename T, std::
size_t N>
551 #if !defined(MSGPACK_DISABLE_LEGACY_CONVERT) 552 template <
typename T>
563 #endif // !defined(MSGPACK_DISABLE_LEGACY_CONVERT) 565 template <
typename T>
575 #if defined(MSGPACK_USE_CPP03) 577 template <
typename T>
585 #else // defined(MSGPACK_USE_CPP03) 587 template <
typename T>
588 inline typename std::enable_if<msgpack::has_as<T>::value, T>::type
object::as()
const {
592 template <
typename T>
593 inline typename std::enable_if<!msgpack::has_as<T>::value, T>::type
object::as()
const {
599 #endif // defined(MSGPACK_USE_CPP03) 606 template <
typename T>
612 template <
typename T>
619 template <
typename T>
628 template <
typename T>
641 std::memcpy(
this, &o,
sizeof(o));
647 std::memcpy(&o, &v,
sizeof(v));
650 inline object::operator msgpack_object()
const 654 std::memcpy(&obj,
this,
sizeof(obj));
660 template <
typename T>
667 template <
typename Stream,
typename T>
674 template <
typename Stream,
typename T>
681 template <
typename Stream>
724 o.
pack_ext(v.via.ext.size, v.via.ext.type());
731 *
const pend(v.via.array.ptr + v.via.array.size);
740 *
const pend(v.via.map.ptr + v.via.map.size);
752 template <
typename Stream>
755 return o << static_cast<msgpack::object>(v);
784 for (uint32_t i = 0; i < o.
via.
str.
size; ++i) {
812 unsigned int code =
static_cast<unsigned int>(c);
813 if (code < 0x20 || code == 0x7f) {
814 std::ios::fmtflags flags(s.flags());
815 s <<
"\\u" << std::hex << std::setw(4) << std::setfill(
'0') << (code & 0xff);
853 s << p->
key <<
':' << p->
val;
857 s <<
", " << p->
key <<
':' << p->
val;
865 s <<
"#<UNKNOWN " <<
static_cast<uint16_t
>(o.
type) <<
">";
876 #endif // MSGPACK_V1_OBJECT_HPP define()
Definition: object.hpp:402
Definition: cpp_config_decl.hpp:71
packer< Stream > & pack_bin(uint32_t l)
Packing bin header and length.
Definition: pack.hpp:1255
Definition: object_fwd_decl.hpp:39
void operator()(msgpack::object::with_zone &o, T const &v) const
Definition: object.hpp:219
const char * data() const
Definition: object_fwd.hpp:44
msgpack::object_kv * ptr
Definition: object_fwd.hpp:29
uint32_t size
Definition: object_fwd.hpp:23
object_handle()
Constructor that creates nil object and null zone.
Definition: object.hpp:46
packer< Stream > & pack_ext(size_t l, int8_t type)
Packing ext header, type, and length.
Definition: pack.hpp:1281
bool operator==(const msgpack::object &x, const msgpack::object &y)
Definition: object.hpp:427
void * allocate_align(size_t size, size_t align=MSGPACK_ZONE_ALIGN)
Definition: cpp03_zone.hpp:236
define(const msgpack_type &v)
Definition: object.hpp:403
void msgpack_pack(Packer &o) const
Definition: object.hpp:406
Definition: object_fwd_decl.hpp:33
Definition: object_fwd_decl.hpp:30
const char * ptr
Definition: object_fwd.hpp:39
Type msgpack_type
Definition: object.hpp:400
Definition: object_fwd_decl.hpp:62
union_type via
Definition: object_fwd.hpp:93
std::enable_if< msgpack::has_as< T >::value, T >::type as() const
Get value as T.
Definition: object.hpp:588
object()
Default constructor. The object is set to nil.
Definition: object.hpp:601
Definition: object_fwd_decl.hpp:40
msgpack::zone & zone
Definition: object.hpp:36
Definition: object.hpp:398
const char * ptr
Definition: object_fwd.hpp:46
msgpack::object * ptr
Definition: object_fwd.hpp:24
packer< Stream > & pack_array(uint32_t n)
Packing array header and size.
Definition: pack.hpp:1160
msgpack::object val
Definition: object.hpp:31
uint32_t size
Definition: object_fwd.hpp:38
packer< Stream > & pack_uint64(uint64_t d)
Packing uint16.
Definition: pack.hpp:717
Definition: adaptor_base.hpp:15
std::size_t aligned_size(std::size_t size, std::size_t align)
Definition: cpp03_zone.hpp:337
void operator()(msgpack::object::with_zone &o, msgpack::object::with_zone const &v) const
Definition: object.hpp:385
packer< Stream > & pack_int64(int64_t d)
Packing int32.
Definition: pack.hpp:733
Definition: object_fwd.hpp:238
const char * ptr
Definition: object_fwd.hpp:34
object_handle(msgpack::object const &obj, msgpack::unique_ptr< msgpack::zone > &&z)
Constructor that creates an object_handle holding object obj and zone z.
Definition: object.hpp:53
Definition: cpp03_zone.hpp:22
msgpack::object const & operator()(msgpack::object const &o, msgpack::object &v) const
Definition: object.hpp:228
packer< Stream > & pack_bin_body(const char *b, uint32_t l)
Packing bin body.
Definition: pack.hpp:1274
packer< Stream > & pack_false()
Packing false.
Definition: pack.hpp:1151
bool boolean
Definition: object_fwd.hpp:77
void convert(T &v, msgpack::object const &o)
Definition: object.hpp:661
Definition: object.hpp:34
packer< Stream > & pack(const T &v)
Packing function template.
packer< Stream > & pack_str_body(const char *b, uint32_t l)
Packing str body.
Definition: pack.hpp:1220
Definition: object.hpp:29
Definition: object_fwd_decl.hpp:29
int64_t i64
Definition: object_fwd.hpp:79
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, msgpack::object const &v) const
Definition: object.hpp:237
Definition: object_fwd_decl.hpp:32
#define MSGPACK_USE_CPP03
Definition: cpp_config_decl.hpp:21
implicit_type convert() const
Definition: object.hpp:527
packer< Stream > & pack_true()
Packing true.
Definition: pack.hpp:1143
Definition: adaptor_base.hpp:43
Definition: cpp_config_decl.hpp:81
uint32_t size
Definition: object_fwd.hpp:45
void pack_copy(msgpack::packer< Stream > &o, T v)
Definition: object.hpp:675
Definition: object_fwd.hpp:236
define< Type > define_type
Definition: object.hpp:401
Definition: adaptor_base.hpp:32
std::size_t size(T const &t)
Definition: size_equal_only.hpp:24
object & operator=(const T &v)
Definition: object.hpp:613
bool convert_if_not_nil(T &v) const
Convert the object if not nil.
Definition: object.hpp:566
std::size_t add_ext_type_size< 4 >(std::size_t size)
Definition: object.hpp:133
msgpack::enable_if< !is_array< T >::value, msgpack::packer< Stream > & >::type operator<<(msgpack::packer< Stream > &o, T const &v)
Definition: adaptor_base.hpp:72
double f64
Definition: object_fwd.hpp:84
Definition: object_fwd_decl.hpp:43
msgpack::object_array array
Definition: object_fwd.hpp:85
void pack(msgpack::packer< Stream > &o, const T &v)
Definition: object.hpp:668
with_zone(msgpack::zone &z)
Definition: object.hpp:35
packer< Stream > & pack_map(uint32_t n)
Packing map header and size.
Definition: pack.hpp:1178
Definition: cpp_config_decl.hpp:56
msgpack::object_map map
Definition: object_fwd.hpp:86
msgpack::object_str str
Definition: object_fwd.hpp:87
void operator()(msgpack::object::with_zone &o, msgpack::object const &v) const
Definition: object.hpp:309
Object class that corresponding to MessagePack format object.
Definition: object_fwd.hpp:75
packer< Stream > & pack_float(float d)
Packing float.
Definition: pack.hpp:1104
Definition: object.hpp:191
packer< Stream > & pack_double(double d)
Packing double.
Definition: pack.hpp:1115
packer< Stream > & pack_ext_body(const char *b, uint32_t l)
Packing ext body.
Definition: pack.hpp:1340
msgpack::type::object_type type
Definition: object_fwd.hpp:92
#define MSGPACK_API_VERSION_NAMESPACE(ns)
Definition: versioning.hpp:58
Definition: object_fwd_decl.hpp:41
msgpack::object key
Definition: object.hpp:30
const msgpack::unique_ptr< msgpack::zone > & zone() const
Get unique_ptr const reference of zone.
Definition: object.hpp:84
uint32_t size
Definition: object_fwd.hpp:28
Definition: object_fwd_decl.hpp:42
msgpack::unique_ptr< msgpack::zone > & zone()
Get unique_ptr reference of zone.
Definition: object.hpp:77
Definition: object_fwd_decl.hpp:34
uint32_t size
Definition: object_fwd.hpp:33
int8_t type() const
Definition: object_fwd.hpp:43
msgpack::enable_if< !msgpack::is_array< T >::value &&!msgpack::is_pointer< T >::value, T &>::type convert(T &v) const
Convert the object.
Definition: object.hpp:538
std::size_t add_ext_type_size(std::size_t size)
Definition: object.hpp:128
Definition: adaptor_base.hpp:38
The class template that supports continuous packing.
Definition: adaptor_base_decl.hpp:24
#define MSGPACK_NULLPTR
Definition: cpp_config_decl.hpp:35
object_handle clone(msgpack::object const &obj)
clone object
Definition: object.hpp:179
msgpack::object_ext ext
Definition: object_fwd.hpp:89
void msgpack_unpack(object const &o)
Definition: object.hpp:411
packer< Stream > & pack_nil()
Packing nil.
Definition: pack.hpp:1135
Definition: adaptor_base.hpp:27
packer< Stream > & pack_str(uint32_t l)
Packing str header and length.
Definition: pack.hpp:1197
static msgpack::packer< Stream > & pack(msgpack::packer< Stream > &o, const T &v)
Definition: object.hpp:192
The class holds object and zone.
Definition: object.hpp:43
std::size_t aligned_zone_size(msgpack::object const &obj)
Definition: object.hpp:139
bool operator!=(const msgpack::object &x, const msgpack::object &y)
Definition: object.hpp:511
msgpack::object const & operator()(msgpack::object const &o, T &v) const
Definition: object.hpp:203
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, T const &v) const
Definition: object.hpp:212
Definition: object_fwd_decl.hpp:31
msgpack::enable_if< !is_array< T >::value, msgpack::object const & >::type operator>>(msgpack::object const &o, T &v)
Definition: adaptor_base.hpp:57
uint64_t u64
Definition: object_fwd.hpp:78
msgpack::object_bin bin
Definition: object_fwd.hpp:88