object.hpp
Go to the documentation of this file.
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2008-2014 FURUHASHI Sadayuki and KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_V1_OBJECT_HPP
#define MSGPACK_V1_OBJECT_HPP
#include "msgpack/object_decl.hpp"
#include <cstring>
#include <stdexcept>
#include <typeinfo>
#include <limits>
#include <ostream>
#include <typeinfo>
#include <iomanip>
namespace msgpack {
MSGPACK_API_VERSION_NAMESPACE(v1) {
struct object_kv {
msgpack::object key;
msgpack::object val;
};
struct object::with_zone : msgpack::object {
with_zone(msgpack::zone& z) : zone(z) { }
msgpack::zone& zone;
private:
with_zone();
};
class object_handle {
public:
object_handle() {}
object_handle(
msgpack::object const& obj,
#if defined(MSGPACK_USE_CPP03)
msgpack::unique_ptr<msgpack::zone> z
#else // defined(MSGPACK_USE_CPP03)
msgpack::unique_ptr<msgpack::zone>&& z
#endif // defined(MSGPACK_USE_CPP03)
) :
m_obj(obj), m_zone(msgpack::move(z)) { }
void set(msgpack::object const& obj)
{ m_obj = obj; }
const msgpack::object& get() const
{ return m_obj; }
msgpack::unique_ptr<msgpack::zone>& zone()
{ return m_zone; }
const msgpack::unique_ptr<msgpack::zone>& zone() const
{ return m_zone; }
#if defined(MSGPACK_USE_CPP03)
struct object_handle_ref {
object_handle_ref(object_handle* oh):m_oh(oh) {}
object_handle* m_oh;
};
object_handle(object_handle& other):
m_obj(other.m_obj),
m_zone(msgpack::move(other.m_zone)) {
}
object_handle(object_handle_ref ref):
m_obj(ref.m_oh->m_obj),
m_zone(msgpack::move(ref.m_oh->m_zone)) {
}
object_handle& operator=(object_handle& other) {
m_obj = other.m_obj;
m_zone = msgpack::move(other.m_zone);
return *this;
}
object_handle& operator=(object_handle_ref ref) {
m_obj = ref.m_oh->m_obj;
m_zone = msgpack::move(ref.m_oh->m_zone);
return *this;
}
operator object_handle_ref() {
return object_handle_ref(this);
}
#endif // defined(MSGPACK_USE_CPP03)
private:
msgpack::object m_obj;
msgpack::unique_ptr<msgpack::zone> m_zone;
};
namespace detail {
template <std::size_t N>
inline std::size_t add_ext_type_size(std::size_t size) {
return size + 1;
}
template <>
inline std::size_t add_ext_type_size<4>(std::size_t size) {
return size == 0xffffffff ? size : size + 1;
}
} // namespace detail
inline std::size_t aligned_zone_size(msgpack::object const& obj) {
std::size_t s = 0;
switch (obj.type) {
case msgpack::type::ARRAY:
s += msgpack::aligned_size(
sizeof(msgpack::object) * obj.via.array.size,
MSGPACK_ZONE_ALIGNOF(msgpack::object));
for (uint32_t i = 0; i < obj.via.array.size; ++i) {
s += msgpack::aligned_zone_size(obj.via.array.ptr[i]);
}
break;
case msgpack::type::MAP:
s += msgpack::aligned_size(
sizeof(msgpack::object_kv) * obj.via.map.size,
MSGPACK_ZONE_ALIGNOF(msgpack::object_kv));
for (uint32_t i = 0; i < obj.via.map.size; ++i) {
s += msgpack::aligned_zone_size(obj.via.map.ptr[i].key);
s += msgpack::aligned_zone_size(obj.via.map.ptr[i].val);
}
break;
case msgpack::type::EXT:
s += msgpack::aligned_size(
detail::add_ext_type_size<sizeof(std::size_t)>(obj.via.ext.size),
MSGPACK_ZONE_ALIGNOF(char));
break;
case msgpack::type::STR:
s += msgpack::aligned_size(obj.via.str.size, MSGPACK_ZONE_ALIGNOF(char));
break;
case msgpack::type::BIN:
s += msgpack::aligned_size(obj.via.bin.size, MSGPACK_ZONE_ALIGNOF(char));
break;
default:
break;
}
return s;
}
inline object_handle clone(msgpack::object const& obj) {
std::size_t size = msgpack::aligned_zone_size(obj);
msgpack::unique_ptr<msgpack::zone> z(size == 0 ? MSGPACK_NULLPTR : new msgpack::zone(size));
msgpack::object newobj = z.get() ? msgpack::object(obj, *z) : obj;
return object_handle(newobj, msgpack::move(z));
}
template <typename T>
inline object::implicit_type::operator T() { return obj.as<T>(); }
namespace detail {
template <typename Stream, typename T>
struct packer_serializer {
static msgpack::packer<Stream>& pack(msgpack::packer<Stream>& o, const T& v) {
v.msgpack_pack(o);
return o;
}
};
} // namespace detail
// Adaptor functors' member functions definitions.
template <typename T, typename Enabler>
inline
msgpack::object const&
adaptor::convert<T, Enabler>::operator()(msgpack::object const& o, T& v) const {
v.msgpack_unpack(o.convert());
return o;
}
template <typename T, typename Enabler>
template <typename Stream>
inline
msgpack::packer<Stream>&
adaptor::pack<T, Enabler>::operator()(msgpack::packer<Stream>& o, T const& v) const {
return msgpack::detail::packer_serializer<Stream, T>::pack(o, v);
}
template <typename T, typename Enabler>
inline
void
adaptor::object_with_zone<T, Enabler>::operator()(msgpack::object::with_zone& o, T const& v) const {
v.msgpack_object(static_cast<msgpack::object*>(&o), o.zone);
}
// Adaptor functor specialization to object
namespace adaptor {
template <>
struct convert<msgpack::object> {
msgpack::object const& operator()(msgpack::object const& o, msgpack::object& v) const {
v = o;
return o;
}
};
template <>
struct pack<msgpack::object> {
template <typename Stream>
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, msgpack::object const& v) const {
switch(v.type) {
case msgpack::type::NIL:
o.pack_nil();
return o;
case msgpack::type::BOOLEAN:
if(v.via.boolean) {
o.pack_true();
} else {
o.pack_false();
}
return o;
case msgpack::type::POSITIVE_INTEGER:
o.pack_uint64(v.via.u64);
return o;
case msgpack::type::NEGATIVE_INTEGER:
o.pack_int64(v.via.i64);
return o;
case msgpack::type::FLOAT32:
o.pack_float(static_cast<float>(v.via.f64));
return o;
case msgpack::type::FLOAT64:
o.pack_double(v.via.f64);
return o;
case msgpack::type::STR:
o.pack_str(v.via.str.size);
o.pack_str_body(v.via.str.ptr, v.via.str.size);
return o;
case msgpack::type::BIN:
o.pack_bin(v.via.bin.size);
o.pack_bin_body(v.via.bin.ptr, v.via.bin.size);
return o;
case msgpack::type::EXT:
o.pack_ext(v.via.ext.size, v.via.ext.type());
o.pack_ext_body(v.via.ext.data(), v.via.ext.size);
return o;
case msgpack::type::ARRAY:
o.pack_array(v.via.array.size);
for(msgpack::object* p(v.via.array.ptr),
* const pend(v.via.array.ptr + v.via.array.size);
p < pend; ++p) {
msgpack::operator<<(o, *p);
}
return o;
case msgpack::type::MAP:
o.pack_map(v.via.map.size);
for(msgpack::object_kv* p(v.via.map.ptr),
* const pend(v.via.map.ptr + v.via.map.size);
p < pend; ++p) {
msgpack::operator<<(o, p->key);
msgpack::operator<<(o, p->val);
}
return o;
default:
throw msgpack::type_error();
}
}
};
template <>
struct object_with_zone<msgpack::object> {
void operator()(msgpack::object::with_zone& o, msgpack::object const& v) const {
o.type = v.type;
switch(v.type) {
case msgpack::type::NIL:
case msgpack::type::BOOLEAN:
case msgpack::type::POSITIVE_INTEGER:
case msgpack::type::NEGATIVE_INTEGER:
case msgpack::type::FLOAT32:
case msgpack::type::FLOAT64:
std::memcpy(&o.via, &v.via, sizeof(v.via));
return;
case msgpack::type::STR: {
char* ptr = static_cast<char*>(o.zone.allocate_align(v.via.str.size, MSGPACK_ZONE_ALIGNOF(char)));
o.via.str.ptr = ptr;
o.via.str.size = v.via.str.size;
std::memcpy(ptr, v.via.str.ptr, v.via.str.size);
return;
}
case msgpack::type::BIN: {
char* ptr = static_cast<char*>(o.zone.allocate_align(v.via.bin.size, MSGPACK_ZONE_ALIGNOF(char)));
o.via.bin.ptr = ptr;
o.via.bin.size = v.via.bin.size;
std::memcpy(ptr, v.via.bin.ptr, v.via.bin.size);
return;
}
case msgpack::type::EXT: {
char* ptr = static_cast<char*>(o.zone.allocate_align(v.via.ext.size + 1, MSGPACK_ZONE_ALIGNOF(char)));
o.via.ext.ptr = ptr;
o.via.ext.size = v.via.ext.size;
std::memcpy(ptr, v.via.ext.ptr, v.via.ext.size + 1);
return;
}
case msgpack::type::ARRAY:
o.via.array.ptr = static_cast<msgpack::object*>(o.zone.allocate_align(sizeof(msgpack::object) * v.via.array.size, MSGPACK_ZONE_ALIGNOF(msgpack::object)));
o.via.array.size = v.via.array.size;
for (msgpack::object
* po(o.via.array.ptr),
* pv(v.via.array.ptr),
* const pvend(v.via.array.ptr + v.via.array.size);
pv < pvend;
++po, ++pv) {
new (po) msgpack::object(*pv, o.zone);
}
return;
case msgpack::type::MAP:
o.via.map.ptr = (msgpack::object_kv*)o.zone.allocate_align(sizeof(msgpack::object_kv) * v.via.map.size, MSGPACK_ZONE_ALIGNOF(msgpack::object_kv));
o.via.map.size = v.via.map.size;
for(msgpack::object_kv
* po(o.via.map.ptr),
* pv(v.via.map.ptr),
* const pvend(v.via.map.ptr + v.via.map.size);
pv < pvend;
++po, ++pv) {
msgpack::object_kv* kv = new (po) msgpack::object_kv;
new (&kv->key) msgpack::object(pv->key, o.zone);
new (&kv->val) msgpack::object(pv->val, o.zone);
}
return;
default:
throw msgpack::type_error();
}
}
};
// Adaptor functor specialization to object::with_zone
template <>
struct object_with_zone<msgpack::object::with_zone> {
void operator()(
msgpack::object::with_zone& o,
msgpack::object::with_zone const& v) const {
o << static_cast<msgpack::object const&>(v);
}
};
} // namespace adaptor
// obsolete
template <typename Type>
class define : public Type {
public:
typedef Type msgpack_type;
typedef define<Type> define_type;
define() {}
define(const msgpack_type& v) : msgpack_type(v) {}
template <typename Packer>
void msgpack_pack(Packer& o) const
{
msgpack::operator<<(o, static_cast<const msgpack_type&>(*this));
}
void msgpack_unpack(object const& o)
{
msgpack::operator>>(o, static_cast<msgpack_type&>(*this));
}
};
// deconvert operator
template <typename Stream>
template <typename T>
inline msgpack::packer<Stream>& packer<Stream>::pack(const T& v)
{
msgpack::operator<<(*this, v);
return *this;
}
inline bool operator==(const msgpack::object& x, const msgpack::object& y)
{
if(x.type != y.type) { return false; }
switch(x.type) {
case msgpack::type::NIL:
return true;
case msgpack::type::BOOLEAN:
return x.via.boolean == y.via.boolean;
case msgpack::type::POSITIVE_INTEGER:
return x.via.u64 == y.via.u64;
case msgpack::type::NEGATIVE_INTEGER:
return x.via.i64 == y.via.i64;
case msgpack::type::FLOAT32:
case msgpack::type::FLOAT64:
return x.via.f64 == y.via.f64;
case msgpack::type::STR:
return x.via.str.size == y.via.str.size &&
std::memcmp(x.via.str.ptr, y.via.str.ptr, x.via.str.size) == 0;
case msgpack::type::BIN:
return x.via.bin.size == y.via.bin.size &&
std::memcmp(x.via.bin.ptr, y.via.bin.ptr, x.via.bin.size) == 0;
case msgpack::type::EXT:
return x.via.ext.size == y.via.ext.size &&
std::memcmp(x.via.ext.ptr, y.via.ext.ptr, x.via.ext.size) == 0;
case msgpack::type::ARRAY:
if(x.via.array.size != y.via.array.size) {
return false;
} else if(x.via.array.size == 0) {
return true;
} else {
msgpack::object* px = x.via.array.ptr;
msgpack::object* const pxend = x.via.array.ptr + x.via.array.size;
msgpack::object* py = y.via.array.ptr;
do {
if(!(*px == *py)) {
return false;
}
++px;
++py;
} while(px < pxend);
return true;
}
case msgpack::type::MAP:
if(x.via.map.size != y.via.map.size) {
return false;
} else if(x.via.map.size == 0) {
return true;
} else {
msgpack::object_kv* px = x.via.map.ptr;
msgpack::object_kv* const pxend = x.via.map.ptr + x.via.map.size;
msgpack::object_kv* py = y.via.map.ptr;
do {
if(!(px->key == py->key) || !(px->val == py->val)) {
return false;
}
++px;
++py;
} while(px < pxend);
return true;
}
default:
return false;
}
}
template <typename T>
inline bool operator==(const msgpack::object& x, const T& y)
try {
return x == msgpack::object(y);
} catch (msgpack::type_error&) {
return false;
}
inline bool operator!=(const msgpack::object& x, const msgpack::object& y)
{ return !(x == y); }
template <typename T>
inline bool operator==(const T& y, const msgpack::object& x)
{ return x == y; }
template <typename T>
inline bool operator!=(const msgpack::object& x, const T& y)
{ return !(x == y); }
template <typename T>
inline bool operator!=(const T& y, const msgpack::object& x)
{ return x != y; }
inline object::implicit_type object::convert() const
{
return object::implicit_type(*this);
}
template <typename T>
inline
typename msgpack::enable_if<
!msgpack::is_array<T>::value && !msgpack::is_pointer<T>::value,
T&
>::type
object::convert(T& v) const
{
msgpack::operator>>(*this, v);
return v;
}
template <typename T, std::size_t N>
inline T(&object::convert(T(&v)[N]) const)[N]
{
msgpack::operator>>(*this, v);
return v;
}
#if !defined(MSGPACK_DISABLE_LEGACY_CONVERT)
template <typename T>
inline
typename msgpack::enable_if<
msgpack::is_pointer<T>::value,
T
>::type
object::convert(T v) const
{
convert(*v);
return v;
}
#endif // !defined(MSGPACK_DISABLE_LEGACY_CONVERT)
template <typename T>
inline bool object::convert_if_not_nil(T& v) const
{
if (is_nil()) {
return false;
}
convert(v);
return true;
}
#if defined(MSGPACK_USE_CPP03)
template <typename T>
inline T object::as() const
{
T v;
convert(v);
return v;
}
#else // defined(MSGPACK_USE_CPP03)
template <typename T>
inline typename std::enable_if<msgpack::has_as<T>::value, T>::type object::as() const {
return msgpack::adaptor::as<T>()(*this);
}
template <typename T>
inline typename std::enable_if<!msgpack::has_as<T>::value, T>::type object::as() const {
T v;
convert(v);
return v;
}
#endif // defined(MSGPACK_USE_CPP03)
inline object::object()
{
type = msgpack::type::NIL;
}
template <typename T>
inline object::object(const T& v)
{
*this << v;
}
template <typename T>
inline object& object::operator=(const T& v)
{
*this = object(v);
return *this;
}
template <typename T>
inline object::object(const T& v, msgpack::zone& z)
{
with_zone oz(z);
msgpack::operator<<(oz, v);
type = oz.type;
via = oz.via;
}
template <typename T>
inline object::object(const T& v, msgpack::zone* z)
{
with_zone oz(*z);
msgpack::operator<<(oz, v);
type = oz.type;
via = oz.via;
}
inline object::object(const msgpack_object& o)
{
// FIXME beter way?
std::memcpy(this, &o, sizeof(o));
}
inline void operator<< (msgpack::object& o, const msgpack_object& v)
{
// FIXME beter way?
std::memcpy(&o, &v, sizeof(v));
}
inline object::operator msgpack_object() const
{
// FIXME beter way?
msgpack_object obj;
std::memcpy(&obj, this, sizeof(obj));
return obj;
}
// obsolete
template <typename T>
inline void convert(T& v, msgpack::object const& o)
{
o.convert(v);
}
// obsolete
template <typename Stream, typename T>
inline void pack(msgpack::packer<Stream>& o, const T& v)
{
o.pack(v);
}
// obsolete
template <typename Stream, typename T>
inline void pack_copy(msgpack::packer<Stream>& o, T v)
{
pack(o, v);
}
template <typename Stream>
inline msgpack::packer<Stream>& operator<< (msgpack::packer<Stream>& o, const msgpack::object& v)
{
switch(v.type) {
case msgpack::type::NIL:
o.pack_nil();
return o;
case msgpack::type::BOOLEAN:
if(v.via.boolean) {
o.pack_true();
} else {
o.pack_false();
}
return o;
case msgpack::type::POSITIVE_INTEGER:
o.pack_uint64(v.via.u64);
return o;
case msgpack::type::NEGATIVE_INTEGER:
o.pack_int64(v.via.i64);
return o;
case msgpack::type::FLOAT32:
o.pack_float(v.via.f64);
return o;
case msgpack::type::FLOAT64:
o.pack_double(v.via.f64);
return o;
case msgpack::type::STR:
o.pack_str(v.via.str.size);
o.pack_str_body(v.via.str.ptr, v.via.str.size);
return o;
case msgpack::type::BIN:
o.pack_bin(v.via.bin.size);
o.pack_bin_body(v.via.bin.ptr, v.via.bin.size);
return o;
case msgpack::type::EXT:
o.pack_ext(v.via.ext.size, v.via.ext.type());
o.pack_ext_body(v.via.ext.data(), v.via.ext.size);
return o;
case msgpack::type::ARRAY:
o.pack_array(v.via.array.size);
for(msgpack::object* p(v.via.array.ptr),
* const pend(v.via.array.ptr + v.via.array.size);
p < pend; ++p) {
msgpack::operator<<(o, *p);
}
return o;
case msgpack::type::MAP:
o.pack_map(v.via.map.size);
for(msgpack::object_kv* p(v.via.map.ptr),
* const pend(v.via.map.ptr + v.via.map.size);
p < pend; ++p) {
msgpack::operator<<(o, p->key);
msgpack::operator<<(o, p->val);
}
return o;
default:
throw msgpack::type_error();
}
}
template <typename Stream>
inline msgpack::packer<Stream>& operator<< (msgpack::packer<Stream>& o, const msgpack::object::with_zone& v)
{
return o << static_cast<msgpack::object>(v);
}
inline std::ostream& operator<< (std::ostream& s, const msgpack::object& o)
{
switch(o.type) {
case msgpack::type::NIL:
s << "null";
break;
case msgpack::type::BOOLEAN:
s << (o.via.boolean ? "true" : "false");
break;
case msgpack::type::POSITIVE_INTEGER:
s << o.via.u64;
break;
case msgpack::type::NEGATIVE_INTEGER:
s << o.via.i64;
break;
case msgpack::type::FLOAT32:
case msgpack::type::FLOAT64:
s << o.via.f64;
break;
case msgpack::type::STR:
s << '"';
for (uint32_t i = 0; i < o.via.str.size; ++i) {
char c = o.via.str.ptr[i];
switch (c) {
case '\\':
s << "\\\\";
break;
case '"':
s << "\\\"";
break;
case '/':
s << "\\/";
break;
case '\b':
s << "\\b";
break;
case '\f':
s << "\\f";
break;
case '\n':
s << "\\n";
break;
case '\r':
s << "\\r";
break;
case '\t':
s << "\\t";
break;
default: {
unsigned int code = static_cast<unsigned int>(c);
if (code < 0x20 || code == 0x7f) {
std::ios::fmtflags flags(s.flags());
s << "\\u" << std::hex << std::setw(4) << std::setfill('0') << (code & 0xff);
s.flags(flags);
}
else {
s << c;
}
} break;
}
}
s << '"';
break;
case msgpack::type::BIN:
(s << '"').write(o.via.bin.ptr, o.via.bin.size) << '"';
break;
case msgpack::type::EXT:
s << "EXT";
break;
case msgpack::type::ARRAY:
s << "[";
if(o.via.array.size != 0) {
msgpack::object* p(o.via.array.ptr);
s << *p;
++p;
for(msgpack::object* const pend(o.via.array.ptr + o.via.array.size);
p < pend; ++p) {
s << ", " << *p;
}
}
s << "]";
break;
case msgpack::type::MAP:
s << "{";
if(o.via.map.size != 0) {
msgpack::object_kv* p(o.via.map.ptr);
s << p->key << ':' << p->val;
++p;
for(msgpack::object_kv* const pend(o.via.map.ptr + o.via.map.size);
p < pend; ++p) {
s << ", " << p->key << ':' << p->val;
}
}
s << "}";
break;
default:
// FIXME
s << "#<UNKNOWN " << static_cast<uint16_t>(o.type) << ">";
}
return s;
}
} // MSGPACK_API_VERSION_NAMESPACE(v1)
} // namespace msgpack
#endif // MSGPACK_V1_OBJECT_HPP
msgpack::define::define
define()
Definition: object.hpp:407
msgpack::is_array
Definition: cpp_config_decl.hpp:71
msgpack::packer::pack_bin
packer< Stream > & pack_bin(uint32_t l)
Packing bin header and length.
Definition: pack.hpp:1255
msgpack::type::STR
Definition: object_fwd_decl.hpp:39
msgpack::adaptor::object_with_zone::operator()
void operator()(msgpack::object::with_zone &o, T const &v) const
Definition: object.hpp:224
msgpack::object_ext::data
const char * data() const
Definition: object_fwd.hpp:44
msgpack::object_map::ptr
msgpack::object_kv * ptr
Definition: object_fwd.hpp:29
msgpack::object_array::size
uint32_t size
Definition: object_fwd.hpp:23
msgpack::object_handle::object_handle
object_handle()
Constructor that creates nil object and null zone.
Definition: object.hpp:46
msgpack::packer::pack_ext
packer< Stream > & pack_ext(size_t l, int8_t type)
Packing ext header, type, and length.
Definition: pack.hpp:1281
msgpack::operator==
bool operator==(const msgpack::object &x, const msgpack::object &y)
Definition: object.hpp:432
msgpack::zone::allocate_align
void * allocate_align(size_t size, size_t align=MSGPACK_ZONE_ALIGN)
Definition: cpp03_zone.hpp:246
msgpack::define::define
define(const msgpack_type &v)
Definition: object.hpp:408
msgpack::define::msgpack_pack
void msgpack_pack(Packer &o) const
Definition: object.hpp:411
msgpack::type::FLOAT32
Definition: object_fwd_decl.hpp:33
msgpack::type::BOOLEAN
Definition: object_fwd_decl.hpp:30
msgpack::object_bin::ptr
const char * ptr
Definition: object_fwd.hpp:39
msgpack::define::msgpack_type
Type msgpack_type
Definition: object.hpp:405
msgpack::adaptor::as
Definition: object_fwd_decl.hpp:62
msgpack::object::via
union_type via
Definition: object_fwd.hpp:93
msgpack::object::as
std::enable_if< msgpack::has_as< T >::value, T >::type as() const
Get value as T.
Definition: object.hpp:593
msgpack::object::object
object()
Default constructor. The object is set to nil.
Definition: object.hpp:606
msgpack::type::BIN
Definition: object_fwd_decl.hpp:40
msgpack::object::with_zone::zone
msgpack::zone & zone
Definition: object.hpp:36
object_decl.hpp
msgpack::define
Definition: object.hpp:403
msgpack::object_ext::ptr
const char * ptr
Definition: object_fwd.hpp:46
msgpack::object_array::ptr
msgpack::object * ptr
Definition: object_fwd.hpp:24
msgpack::packer::pack_array
packer< Stream > & pack_array(uint32_t n)
Packing array header and size.
Definition: pack.hpp:1160
msgpack::object_kv::val
msgpack::object val
Definition: object.hpp:31
msgpack::object_bin::size
uint32_t size
Definition: object_fwd.hpp:38
msgpack::packer::pack_uint64
packer< Stream > & pack_uint64(uint64_t d)
Packing uint16.
Definition: pack.hpp:717
msgpack
Definition: adaptor_base.hpp:15
msgpack::aligned_size
std::size_t aligned_size(std::size_t size, std::size_t align)
Definition: cpp03_zone.hpp:344
msgpack::adaptor::object_with_zone< msgpack::object::with_zone >::operator()
void operator()(msgpack::object::with_zone &o, msgpack::object::with_zone const &v) const
Definition: object.hpp:390
msgpack::packer::pack_int64
packer< Stream > & pack_int64(int64_t d)
Packing int32.
Definition: pack.hpp:733
msgpack::object::implicit_type
Definition: object_fwd.hpp:238
msgpack::object_str::ptr
const char * ptr
Definition: object_fwd.hpp:34
msgpack::object_handle::object_handle
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
msgpack::zone
Definition: cpp03_zone.hpp:22
msgpack::adaptor::convert< msgpack::object >::operator()
msgpack::object const & operator()(msgpack::object const &o, msgpack::object &v) const
Definition: object.hpp:233
msgpack::packer::pack_bin_body
packer< Stream > & pack_bin_body(const char *b, uint32_t l)
Packing bin body.
Definition: pack.hpp:1274
msgpack::packer::pack_false
packer< Stream > & pack_false()
Packing false.
Definition: pack.hpp:1151
msgpack::object::union_type::boolean
bool boolean
Definition: object_fwd.hpp:77
msgpack::convert
void convert(T &v, msgpack::object const &o)
Definition: object.hpp:666
msgpack::object::with_zone
Definition: object.hpp:34
msgpack::packer::pack
packer< Stream > & pack(const T &v)
Packing function template.
msgpack::packer::pack_str_body
packer< Stream > & pack_str_body(const char *b, uint32_t l)
Packing str body.
Definition: pack.hpp:1220
msgpack::object_kv
Definition: object.hpp:29
msgpack::unique_ptr< msgpack::zone >
msgpack::type::NIL
Definition: object_fwd_decl.hpp:29
msgpack::object::union_type::i64
int64_t i64
Definition: object_fwd.hpp:79
msgpack::adaptor::pack< msgpack::object >::operator()
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, msgpack::object const &v) const
Definition: object.hpp:242
msgpack::type::NEGATIVE_INTEGER
Definition: object_fwd_decl.hpp:32
MSGPACK_USE_CPP03
#define MSGPACK_USE_CPP03
Definition: cpp_config_decl.hpp:21
msgpack::object::convert
implicit_type convert() const
Definition: object.hpp:532
msgpack::packer::pack_true
packer< Stream > & pack_true()
Packing true.
Definition: pack.hpp:1143
msgpack::adaptor::object_with_zone
Definition: adaptor_base.hpp:43
msgpack::is_pointer
Definition: cpp_config_decl.hpp:81
msgpack::object_ext::size
uint32_t size
Definition: object_fwd.hpp:45
msgpack::pack_copy
void pack_copy(msgpack::packer< Stream > &o, T v)
Definition: object.hpp:680
msgpack::type_error
Definition: object_fwd.hpp:236
msgpack::define::define_type
define< Type > define_type
Definition: object.hpp:406
msgpack::adaptor::pack
Definition: adaptor_base.hpp:32
msgpack::type::size
std::size_t size(T const &t)
Definition: size_equal_only.hpp:24
msgpack::object::operator=
object & operator=(const T &v)
Definition: object.hpp:618
msgpack::object::convert_if_not_nil
bool convert_if_not_nil(T &v) const
Convert the object if not nil.
Definition: object.hpp:571
msgpack::detail::add_ext_type_size< 4 >
std::size_t add_ext_type_size< 4 >(std::size_t size)
Definition: object.hpp:133
msgpack::operator<<
msgpack::enable_if< !is_array< T >::value, msgpack::packer< Stream > & >::type operator<<(msgpack::packer< Stream > &o, T const &v)
Definition: adaptor_base.hpp:72
msgpack::object::union_type::f64
double f64
Definition: object_fwd.hpp:84
msgpack::type::EXT
Definition: object_fwd_decl.hpp:43
msgpack::object::union_type::array
msgpack::object_array array
Definition: object_fwd.hpp:85
msgpack::pack
void pack(msgpack::packer< Stream > &o, const T &v)
Definition: object.hpp:673
msgpack::object::with_zone::with_zone
with_zone(msgpack::zone &z)
Definition: object.hpp:35
msgpack::packer::pack_map
packer< Stream > & pack_map(uint32_t n)
Packing map header and size.
Definition: pack.hpp:1178
msgpack::enable_if
Definition: cpp_config_decl.hpp:56
msgpack::object::union_type::map
msgpack::object_map map
Definition: object_fwd.hpp:86
msgpack::object::union_type::str
msgpack::object_str str
Definition: object_fwd.hpp:87
msgpack::adaptor::object_with_zone< msgpack::object >::operator()
void operator()(msgpack::object::with_zone &o, msgpack::object const &v) const
Definition: object.hpp:314
msgpack::object
Object class that corresponding to MessagePack format object.
Definition: object_fwd.hpp:75
msgpack::packer::pack_float
packer< Stream > & pack_float(float d)
Packing float.
Definition: pack.hpp:1104
msgpack::detail::packer_serializer
Definition: object.hpp:196
msgpack::packer::pack_double
packer< Stream > & pack_double(double d)
Packing double.
Definition: pack.hpp:1115
msgpack::packer::pack_ext_body
packer< Stream > & pack_ext_body(const char *b, uint32_t l)
Packing ext body.
Definition: pack.hpp:1340
msgpack::object::type
msgpack::type::object_type type
Definition: object_fwd.hpp:92
MSGPACK_API_VERSION_NAMESPACE
#define MSGPACK_API_VERSION_NAMESPACE(ns)
Definition: versioning.hpp:58
msgpack::type::ARRAY
Definition: object_fwd_decl.hpp:41
msgpack::object_kv::key
msgpack::object key
Definition: object.hpp:30
msgpack::object_handle::zone
const msgpack::unique_ptr< msgpack::zone > & zone() const
Get unique_ptr const reference of zone.
Definition: object.hpp:84
msgpack::object_map::size
uint32_t size
Definition: object_fwd.hpp:28
msgpack::type::MAP
Definition: object_fwd_decl.hpp:42
msgpack::object_handle::zone
msgpack::unique_ptr< msgpack::zone > & zone()
Get unique_ptr reference of zone.
Definition: object.hpp:77
msgpack::type::FLOAT64
Definition: object_fwd_decl.hpp:34
msgpack::object_str::size
uint32_t size
Definition: object_fwd.hpp:33
MSGPACK_ZONE_ALIGNOF
#define MSGPACK_ZONE_ALIGNOF(type)
Definition: cpp03_zone_decl.hpp:30
msgpack::object_ext::type
int8_t type() const
Definition: object_fwd.hpp:43
msgpack::object::convert
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
msgpack::detail::add_ext_type_size
std::size_t add_ext_type_size(std::size_t size)
Definition: object.hpp:128
msgpack::adaptor::object
Definition: adaptor_base.hpp:38
msgpack::packer
The class template that supports continuous packing.
Definition: adaptor_base_decl.hpp:24
MSGPACK_NULLPTR
#define MSGPACK_NULLPTR
Definition: cpp_config_decl.hpp:35
msgpack::move
T & move(T &t)
msgpack::clone
object_handle clone(msgpack::object const &obj)
clone object
Definition: object.hpp:184
msgpack::object::union_type::ext
msgpack::object_ext ext
Definition: object_fwd.hpp:89
msgpack::define::msgpack_unpack
void msgpack_unpack(object const &o)
Definition: object.hpp:416
msgpack::packer::pack_nil
packer< Stream > & pack_nil()
Packing nil.
Definition: pack.hpp:1135
msgpack::adaptor::convert
Definition: adaptor_base.hpp:27
msgpack::packer::pack_str
packer< Stream > & pack_str(uint32_t l)
Packing str header and length.
Definition: pack.hpp:1197
msgpack::detail::packer_serializer::pack
static msgpack::packer< Stream > & pack(msgpack::packer< Stream > &o, const T &v)
Definition: object.hpp:197
msgpack::object_handle
The class holds object and zone.
Definition: object.hpp:43
msgpack::aligned_zone_size
std::size_t aligned_zone_size(msgpack::object const &obj)
Definition: object.hpp:139
msgpack::operator!=
bool operator!=(const msgpack::object &x, const msgpack::object &y)
Definition: object.hpp:516
msgpack::adaptor::convert::operator()
msgpack::object const & operator()(msgpack::object const &o, T &v) const
Definition: object.hpp:208
msgpack::adaptor::pack::operator()
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, T const &v) const
Definition: object.hpp:217
msgpack::type::POSITIVE_INTEGER
Definition: object_fwd_decl.hpp:31
msgpack::operator>>
msgpack::enable_if< !is_array< T >::value, msgpack::object const & >::type operator>>(msgpack::object const &o, T &v)
Definition: adaptor_base.hpp:57
msgpack::object::union_type::u64
uint64_t u64
Definition: object_fwd.hpp:78
msgpack::object::union_type::bin
msgpack::object_bin bin
Definition: object_fwd.hpp:88