MessagePack for C++
Toggle main menu visibility
Loading...
Searching...
No Matches
msgpack
v1
adaptor
adaptor_base.hpp
Go to the documentation of this file.
1
//
2
// MessagePack for C++ static resolution routine
3
//
4
// Copyright (C) 2015-2016 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_ADAPTOR_BASE_HPP
11
#define MSGPACK_V1_ADAPTOR_BASE_HPP
12
13
#include "
msgpack/v1/adaptor/adaptor_base_decl.hpp
"
14
15
namespace
msgpack
{
16
18
MSGPACK_API_VERSION_NAMESPACE
(v1) {
20
21
22
namespace
adaptor
{
23
24
// Adaptor functors
25
26
template
<
typename
T,
typename
Enabler>
27
struct
convert
{
28
msgpack::object
const
&
operator()
(
msgpack::object
const
& o, T& v)
const
;
29
};
30
31
template
<
typename
T,
typename
Enabler>
32
struct
pack
{
33
template
<
typename
Stream>
34
msgpack::packer<Stream>
&
operator()
(
msgpack::packer<Stream>
& o, T
const
& v)
const
;
35
};
36
37
template
<
typename
T,
typename
Enabler>
38
struct
object
{
39
void
operator()
(
msgpack::object
& o, T
const
& v)
const
;
40
};
41
42
template
<
typename
T,
typename
Enabler>
43
struct
object_with_zone
{
44
void
operator()
(
msgpack::object::with_zone
& o, T
const
& v)
const
;
45
};
46
47
}
// namespace adaptor
48
49
// operators
50
51
template
<
typename
T>
52
inline
53
typename
msgpack::enable_if<
54
!is_array<T>::value,
55
msgpack::object
const
&
56
>
::type
57
operator>>
(
msgpack::object
const
& o, T& v) {
58
return
msgpack::adaptor::convert<T>
()(o, v);
59
}
60
template
<
typename
T, std::
size_t
N>
61
inline
62
msgpack::object
const
&
operator>>
(
msgpack::object
const
& o, T(&v)[N]) {
63
return
msgpack::adaptor::convert<T[N]>
()(o, v);
64
}
65
66
template
<
typename
Stream,
typename
T>
67
inline
68
typename
msgpack::enable_if<
69
!is_array<T>::value,
70
msgpack::packer<Stream>
&
71
>
::type
72
operator<<
(
msgpack::packer<Stream>
& o, T
const
& v) {
73
return
msgpack::adaptor::pack<T>
()(o, v);
74
}
75
template
<
typename
Stream,
typename
T, std::
size_t
N>
76
inline
77
msgpack::packer<Stream>
&
operator<<
(
msgpack::packer<Stream>
& o,
const
T(&v)[N]) {
78
return
msgpack::adaptor::pack<T[N]>
()(o, v);
79
}
80
81
template
<
typename
T>
82
inline
83
typename
msgpack::enable_if<
84
!is_array<T>::value
85
>
::type
86
operator<<
(
msgpack::object
& o, T
const
& v) {
87
msgpack::adaptor::object<T>
()(o, v);
88
}
89
template
<
typename
T, std::
size_t
N>
90
inline
91
void
operator<<
(msgpack::v1::object& o,
const
T(&v)[N]) {
92
msgpack::v1::adaptor::object<T[N]>()(o, v);
93
}
94
95
template
<
typename
T>
96
inline
97
typename
msgpack::enable_if<
98
!is_array<T>::value
99
>
::type
100
operator<<
(
msgpack::object::with_zone
& o, T
const
& v) {
101
msgpack::adaptor::object_with_zone<T>
()(o, v);
102
}
103
template
<
typename
T, std::
size_t
N>
104
inline
105
void
operator<<
(
msgpack::object::with_zone
& o,
const
T(&v)[N]) {
106
msgpack::adaptor::object_with_zone<T[N]>
()(o, v);
107
}
108
110
}
// MSGPACK_API_VERSION_NAMESPACE(v1)
112
113
}
// namespace msgpack
114
115
116
#endif
// MSGPACK_V1_ADAPTOR_BASE_HPP
msgpack::packer
The class template that supports continuous packing.
Definition
pack.hpp:33
msgpack::adaptor
Definition
adaptor_base.hpp:22
msgpack::type
Definition
array_ref.hpp:24
msgpack
Definition
adaptor_base.hpp:15
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::operator>>
msgpack::enable_if<!is_array< T >::value, msgpack::objectconst & >::type operator>>(msgpack::object const &o, T &v)
Definition
adaptor_base.hpp:57
msgpack::adaptor::convert
Definition
adaptor_base.hpp:27
msgpack::adaptor::convert::operator()
msgpack::object const & operator()(msgpack::object const &o, T &v) const
Definition
object.hpp:646
msgpack::adaptor::object_with_zone
Definition
adaptor_base.hpp:43
msgpack::adaptor::object_with_zone::operator()
void operator()(msgpack::object::with_zone &o, T const &v) const
Definition
object.hpp:662
msgpack::adaptor::object
Definition
adaptor_base.hpp:38
msgpack::adaptor::object::operator()
void operator()(msgpack::object &o, T const &v) const
msgpack::adaptor::pack
Definition
adaptor_base.hpp:32
msgpack::adaptor::pack::operator()
msgpack::packer< Stream > & operator()(msgpack::packer< Stream > &o, T const &v) const
Definition
object.hpp:655
msgpack::object
Object class that corresponding to MessagePack format object.
Definition
object_fwd.hpp:77
msgpack::object::with_zone
object_with_zone_type with_zone
Definition
object_fwd.hpp:225
adaptor_base_decl.hpp
MSGPACK_API_VERSION_NAMESPACE
#define MSGPACK_API_VERSION_NAMESPACE(ns)
Definition
versioning.hpp:66
Generated by
1.17.0