MessagePack for C++
Toggle main menu visibility
Loading...
Searching...
No Matches
msgpack
v1
adaptor
nil.hpp
Go to the documentation of this file.
1
//
2
// MessagePack for C++ static resolution routine
3
//
4
// Copyright (C) 2008-2016 FURUHASHI Sadayuki and KONDO Takatoshi
5
//
6
// Distributed under the Boost Software License, Version 1.0.
7
// (See accompanying file LICENSE_1_0.txt or copy at
8
// http://www.boost.org/LICENSE_1_0.txt)
9
//
10
#ifndef MSGPACK_V1_TYPE_NIL_HPP
11
#define MSGPACK_V1_TYPE_NIL_HPP
12
13
#include "
msgpack/v1/adaptor/nil_decl.hpp
"
14
15
namespace
msgpack
{
16
18
MSGPACK_API_VERSION_NAMESPACE
(v1) {
20
21
namespace
type
{
22
23
struct
nil_t
{ };
24
25
inline
bool
operator<
(
nil_t
const
& lhs,
nil_t
const
& rhs) {
26
return
&lhs < &rhs;
27
}
28
29
inline
bool
operator==
(
nil_t
const
& lhs,
nil_t
const
& rhs) {
30
return
&lhs == &rhs;
31
}
32
33
}
// namespace type
34
35
namespace
adaptor {
36
37
template
<>
38
struct
convert
<
type
::nil_t> {
39
msgpack::object
const
&
operator()
(
msgpack::object
const
& o,
type::nil_t
&)
const
{
40
if
(o.
type
!=
msgpack::type::NIL
) {
throw
msgpack::type_error
(); }
41
return
o;
42
}
43
};
44
45
template
<>
46
struct
pack
<
type
::nil_t> {
47
template
<
typename
Stream>
48
msgpack::packer<Stream>
&
operator()
(
msgpack::packer<Stream>
& o,
const
type::nil_t
&)
const
{
49
o.
pack_nil
();
50
return
o;
51
}
52
};
53
54
template
<>
55
struct
object
<
type
::nil_t> {
56
void
operator()
(
msgpack::object
& o,
type::nil_t
)
const
{
57
o.
type
=
msgpack::type::NIL
;
58
}
59
};
60
61
template
<>
62
struct
object_with_zone
<
type
::nil_t> {
63
void
operator()
(
msgpack::object::with_zone
& o,
type::nil_t
v)
const
{
64
static_cast<
msgpack::object
&
>
(o) << v;
65
}
66
};
67
68
}
// namespace adaptor
69
71
}
// MSGPACK_API_VERSION_NAMESPACE(v1)
73
74
}
// namespace msgpack
75
76
#endif
// MSGPACK_V1_TYPE_NIL_HPP
msgpack::packer
The class template that supports continuous packing.
Definition
pack.hpp:33
msgpack::packer::pack_nil
packer< Stream > & pack_nil()
Packing nil.
Definition
pack.hpp:1170
msgpack::type_error
Definition
object_fwd.hpp:234
msgpack::type
Definition
array_ref.hpp:24
msgpack::type::operator<
bool operator<(basic_variant< STR, BIN, EXT > const &lhs, basic_variant< STR, BIN, EXT > const &rhs)
Definition
msgpack_variant.hpp:256
msgpack::type::NIL
@ NIL
Definition
object_fwd_decl.hpp:28
msgpack::type::operator==
bool operator==(basic_variant< STR, BIN, EXT > const &lhs, basic_variant< STR, BIN, EXT > const &rhs)
Definition
msgpack_variant.hpp:263
msgpack
Definition
adaptor_base.hpp:15
msgpack::adaptor::convert< type::nil_t >::operator()
msgpack::object const & operator()(msgpack::object const &o, type::nil_t &) const
Definition
nil.hpp:39
msgpack::adaptor::convert
Definition
adaptor_base.hpp:27
msgpack::adaptor::object< type::nil_t >::operator()
void operator()(msgpack::object &o, type::nil_t) const
Definition
nil.hpp:56
msgpack::adaptor::object_with_zone< type::nil_t >::operator()
void operator()(msgpack::object::with_zone &o, type::nil_t v) const
Definition
nil.hpp:63
msgpack::adaptor::object_with_zone
Definition
adaptor_base.hpp:43
msgpack::adaptor::object
Definition
adaptor_base.hpp:38
msgpack::adaptor::pack< type::nil_t >::operator()
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, const type::nil_t &) const
Definition
nil.hpp:48
msgpack::adaptor::pack
Definition
adaptor_base.hpp:32
msgpack::object
Object class that corresponding to MessagePack format object.
Definition
object_fwd.hpp:77
msgpack::object::type
msgpack::type::object_type type
Definition
object_fwd.hpp:94
msgpack::object::with_zone
object_with_zone_type with_zone
Definition
object_fwd.hpp:225
msgpack::type::nil_t
Definition
nil.hpp:23
nil_decl.hpp
MSGPACK_API_VERSION_NAMESPACE
#define MSGPACK_API_VERSION_NAMESPACE(ns)
Definition
versioning.hpp:66
Generated by
1.17.0