10#ifndef MSGPACK_V1_TYPE_EXT_HPP
11#define MSGPACK_V1_TYPE_EXT_HPP
28 ext() : m_data(1, 0) {}
30 msgpack::detail::check_container_size_for_ext<sizeof(std::size_t)>(
s);
31 m_data.reserve(
static_cast<std::size_t
>(
s) + 1);
32 m_data.push_back(
static_cast<char>(
t));
33 m_data.insert(m_data.end(),
p,
p +
s);
36 msgpack::detail::check_container_size_for_ext<sizeof(std::size_t)>(
s);
37 m_data.resize(
static_cast<std::size_t
>(
s) + 1);
38 m_data[0] =
static_cast<char>(
t);
42 return static_cast<int8_t>(m_data[0]);
45 return &m_data[0] + 1;
48 return &m_data[0] + 1;
51 return static_cast<uint32_t>(m_data.size()) - 1;
53 bool operator== (
const ext&
x)
const {
54 return m_data ==
x.m_data;
57 bool operator!= (
const ext&
x)
const {
61 bool operator< (
const ext&
x)
const {
62 return m_data <
x.m_data;
66 return m_data >
x.m_data;
69 std::vector<char> m_data;
80 if(o.
type != msgpack::type::EXT) {
90 template <
typename Stream>
101struct object_with_zone<
msgpack::type::ext> {
109 ptr[0] =
static_cast<char>(v.
type());
110 std::memcpy(ptr + 1, v.
data(), size);
128 m_size(
s == 0 ? 0 :
s - 1) {
129 msgpack::detail::check_container_size_for_ext<sizeof(std::size_t)>(
s);
144 return static_cast<int8_t>(m_ptr[0]);
148 return std::string(m_ptr + 1, m_size);
152 return m_size ==
x.m_size && std::memcmp(m_ptr,
x.m_ptr, m_size) == 0;
156 return !(*
this ==
x);
160 if (m_size <
x.m_size)
return true;
161 if (m_size >
x.m_size)
return false;
162 return std::memcmp(m_ptr,
x.m_ptr, m_size) < 0;
166 if (m_size >
x.m_size)
return true;
167 if (m_size <
x.m_size)
return false;
168 return std::memcmp(m_ptr,
x.m_ptr, m_size) > 0;
179 m_data.reserve(x.size() + 1);
181 m_data.push_back(
static_cast<char>(x.type()));
182 m_data.insert(m_data.end(), x.data(), x.data() + x.size());
200 template <
typename Stream>
211struct object<
msgpack::type::ext_ref> {
222struct object_with_zone<
msgpack::type::ext_ref> {
The class template that supports continuous packing.
Definition pack.hpp:33
packer< Stream > & pack_ext(size_t l, int8_t type)
Packing ext header, type, and length.
Definition pack.hpp:1338
packer< Stream > & pack_ext_body(const char *b, uint32_t l)
Packing ext body.
Definition pack.hpp:1397
const char * data() const
Definition ext.hpp:135
ext_ref(ext const &x)
Definition ext.hpp:133
int8_t type() const
Definition ext.hpp:143
std::string str() const
Definition ext.hpp:147
uint32_t size() const
Definition ext.hpp:139
bool operator>(const ext_ref &x) const
Definition ext.hpp:165
ext_ref(const char *p, uint32_t s)
Definition ext.hpp:126
ext_ref()
Definition ext.hpp:125
ext(int8_t t, uint32_t s)
Definition ext.hpp:35
bool operator>(const ext &x) const
Definition ext.hpp:65
const char * data() const
Definition ext.hpp:44
uint32_t size() const
Definition ext.hpp:50
ext()
Definition ext.hpp:28
int8_t type() const
Definition ext.hpp:41
char * data()
Definition ext.hpp:47
ext(int8_t t, const char *p, uint32_t s)
Definition ext.hpp:29
Definition object_fwd.hpp:231
void * allocate_align(size_t size, size_t align=MSGPACK_ZONE_ALIGN)
Definition cpp03_zone.hpp:255
std::size_t size(T const &t)
Definition size_equal_only.hpp:24
@ EXT
Definition object_fwd_decl.hpp:42
Definition adaptor_base.hpp:15
void pack(msgpack::packer< Stream > &o, const T &v)
Definition object.hpp:1185
void convert(T &v, msgpack::object const &o)
Definition object.hpp:1178
msgpack::object const & operator()(msgpack::object const &o, T &v) const
Definition object.hpp:646
void operator()(msgpack::object::with_zone &o, T const &v) const
Definition object.hpp:662
Definition adaptor_base.hpp:38
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, T const &v) const
Definition object.hpp:655
msgpack::zone & zone
Definition object.hpp:37
int8_t type() const
Definition object_fwd.hpp:43
const char * ptr
Definition object_fwd.hpp:46
const char * data() const
Definition object_fwd.hpp:44
uint32_t size
Definition object_fwd.hpp:45
Object class that corresponding to MessagePack format object.
Definition object_fwd.hpp:75
union_type via
Definition object_fwd.hpp:93
msgpack::type::object_type type
Definition object_fwd.hpp:92
msgpack::object_ext ext
Definition object_fwd.hpp:89
#define MSGPACK_ZONE_ALIGNOF(type)
Definition cpp03_zone_decl.hpp:30
#define MSGPACK_API_VERSION_NAMESPACE(ns)
Definition versioning.hpp:66