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