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>
154 for (uint32_t i = 0; i < obj.
via.
map.
size; ++i) {
191 template <
typename T>
192 inline object::implicit_type::operator T() {
return obj.as<T>(); }
195 template <
typename Stream,
typename T>
205 template <
typename T,
typename Enabler>
213 template <
typename T,
typename Enabler>
214 template <
typename Stream>
221 template <
typename T,
typename Enabler>
225 v.msgpack_object(static_cast<msgpack::object*>(&o), o.
zone);
241 template <
typename Stream>
324 std::memcpy(&o.
via, &v.
via,
sizeof(v.
via));
393 o << static_cast<msgpack::object const&>(v);
402 template <
typename Type>
408 define(
const msgpack_type& v) : msgpack_type(v) {}
410 template <
typename Packer>
413 msgpack::operator<<(o, static_cast<const msgpack_type&>(*this));
424 template <
typename Stream>
425 template <
typename T>
434 if(x.
type != y.
type) {
return false; }
508 template <
typename T>
517 {
return !(x == y); }
519 template <
typename T>
523 template <
typename T>
525 {
return !(x == y); }
527 template <
typename T>
537 template <
typename T>
549 template <
typename T, std::
size_t N>
556 #if !defined(MSGPACK_DISABLE_LEGACY_CONVERT) 557 template <
typename T>
568 #endif // !defined(MSGPACK_DISABLE_LEGACY_CONVERT) 570 template <
typename T>
580 #if defined(MSGPACK_USE_CPP03) 582 template <
typename T>
590 #else // defined(MSGPACK_USE_CPP03) 592 template <
typename T>
593 inline typename std::enable_if<msgpack::has_as<T>::value, T>::type
object::as()
const {
597 template <
typename T>
598 inline typename std::enable_if<!msgpack::has_as<T>::value, T>::type
object::as()
const {
604 #endif // defined(MSGPACK_USE_CPP03) 611 template <
typename T>
617 template <
typename T>
624 template <
typename T>
633 template <
typename T>
646 std::memcpy(
this, &o,
sizeof(o));
652 std::memcpy(&o, &v,
sizeof(v));
655 inline object::operator msgpack_object()
const 659 std::memcpy(&obj,
this,
sizeof(obj));
665 template <
typename T>
672 template <
typename Stream,
typename T>
679 template <
typename Stream,
typename T>
686 template <
typename Stream>
729 o.
pack_ext(v.via.ext.size, v.via.ext.type());
736 *
const pend(v.via.array.ptr + v.via.array.size);
745 *
const pend(v.via.map.ptr + v.via.map.size);
757 template <
typename Stream>
760 return o << static_cast<msgpack::object>(v);
789 for (uint32_t i = 0; i < o.
via.
str.
size; ++i) {
817 unsigned int code =
static_cast<unsigned int>(c);
818 if (code < 0x20 || code == 0x7f) {
819 std::ios::fmtflags flags(s.flags());
820 s <<
"\\u" << std::hex << std::setw(4) << std::setfill(
'0') << (code & 0xff);
858 s << p->
key <<
':' << p->
val;
862 s <<
", " << p->
key <<
':' << p->
val;
870 s <<
"#<UNKNOWN " <<
static_cast<uint16_t
>(o.
type) <<
">";
881 #endif // MSGPACK_V1_OBJECT_HPP define()
Definition: object.hpp:407
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:224
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:432
void * allocate_align(size_t size, size_t align=MSGPACK_ZONE_ALIGN)
Definition: cpp03_zone.hpp:246
define(const msgpack_type &v)
Definition: object.hpp:408
void msgpack_pack(Packer &o) const
Definition: object.hpp:411
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:405
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:593
object()
Default constructor. The object is set to nil.
Definition: object.hpp:606
Definition: object_fwd_decl.hpp:40
msgpack::zone & zone
Definition: object.hpp:36
Definition: object.hpp:403
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:344
void operator()(msgpack::object::with_zone &o, msgpack::object::with_zone const &v) const
Definition: object.hpp:390
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:233
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:666
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:242
Definition: object_fwd_decl.hpp:32
#define MSGPACK_USE_CPP03
Definition: cpp_config_decl.hpp:21
implicit_type convert() const
Definition: object.hpp:532
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:680
Definition: object_fwd.hpp:236
define< Type > define_type
Definition: object.hpp:406
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:618
bool convert_if_not_nil(T &v) const
Convert the object if not nil.
Definition: object.hpp:571
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:673
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:314
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:196
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
#define MSGPACK_ZONE_ALIGNOF(type)
Definition: cpp03_zone_decl.hpp:30
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:543
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:184
msgpack::object_ext ext
Definition: object_fwd.hpp:89
void msgpack_unpack(object const &o)
Definition: object.hpp:416
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:197
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:516
msgpack::object const & operator()(msgpack::object const &o, T &v) const
Definition: object.hpp:208
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, T const &v) const
Definition: object.hpp:217
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