MessagePack for C++
Toggle main menu visibility
Loading...
Searching...
No Matches
msgpack
v2
object_fwd.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
11
#ifndef MSGPACK_V2_OBJECT_FWD_HPP
12
#define MSGPACK_V2_OBJECT_FWD_HPP
13
14
#include "
msgpack/v2/object_fwd_decl.hpp
"
15
#include "
msgpack/object_fwd.hpp
"
16
17
namespace
msgpack
{
18
20
MSGPACK_API_VERSION_NAMESPACE
(v2) {
22
23
struct
object
: v1::object {
24
object
() {}
25
object
(v1::object
const
& o):v1::
object
(o) {}
27
34
template
<
typename
T>
35
explicit
object
(
const
T& v) {
36
*
this
<< v;
37
}
38
40
48
template
<
typename
T>
49
object
(
const
T& v,
msgpack::zone
& z):v1::
object
(v, z) {}
50
51
public
:
53
59
template
<
typename
T>
60
T&
convert
(T& v)
const
{
return
v1::object::convert(v); }
61
62
using
v1::object::with_zone;
63
implicit_type
convert
()
const
;
64
};
65
66
#if !defined(MSGPACK_USE_CPP03)
67
68
namespace
adaptor
{
69
70
// If v1 has as specialization for T, then dispatch v1::adaptor::as<T>.
71
// So I call v1::has_as<T> meta function intentionally.
72
template
<
typename
T>
73
struct
as
<T, typename std::enable_if<v1::has_as<T>::value>
::type
> : v1::adaptor::as<T> {
74
};
75
76
}
// namespace adaptor
77
78
template
<
typename
T>
79
struct
has_as
{
80
private
:
81
template
<
typename
U>
82
static
auto
check_(U*) ->
83
typename
std::enable_if<
84
// check v2 specialization
85
std::is_same<
86
decltype
(
adaptor::as<U>
()(std::declval<msgpack::object>())),
87
U
88
>
::value
89
||
90
// check v1 specialization
91
v1::has_as<U>::value,
92
std::true_type
93
>
::type
;
94
template
<
typename
...>
95
static
std::false_type check_(...);
96
public
:
97
using
type
=
decltype
(check_<T>(
MSGPACK_NULLPTR
));
98
static
constexpr
bool
value
= type::value;
99
};
100
101
#endif
// !defined(MSGPACK_USE_CPP03)
102
104
}
// MSGPACK_API_VERSION_NAMESPACE(v2)
106
107
}
// namespace msgpack
108
109
#endif
// MSGPACK_V2_OBJECT_FWD_HPP
msgpack::zone
Definition
cpp03_zone.hpp:30
msgpack::adaptor
Definition
adaptor_base.hpp:22
msgpack::type
Definition
array_ref.hpp:24
msgpack
Definition
adaptor_base.hpp:15
object_fwd.hpp
msgpack::adaptor::as
Definition
object_fwd_decl.hpp:61
msgpack::has_as
Definition
object_fwd.hpp:53
msgpack::has_as::value
static constexpr bool value
Definition
object_fwd.hpp:66
msgpack::has_as::type
decltype(check_< T >(MSGPACK_NULLPTR)) type
Definition
object_fwd.hpp:65
msgpack::object::implicit_type
Definition
object_fwd.hpp:236
msgpack::object
Object class that corresponding to MessagePack format object.
Definition
object_fwd.hpp:77
msgpack::object::convert
implicit_type convert() const
msgpack::object::convert
T & convert(T &v) const
Convert the object.
Definition
object_fwd.hpp:60
msgpack::object::object
object()
Definition
object_fwd.hpp:24
msgpack::object::object
object(const T &v)
Construct object from T.
Definition
object_fwd.hpp:35
msgpack::object::object
object(v1::object const &o)
Definition
object_fwd.hpp:25
msgpack::object::object
object(const T &v, msgpack::zone &z)
Construct object from T.
Definition
object_fwd.hpp:49
MSGPACK_NULLPTR
#define MSGPACK_NULLPTR
Definition
cpp_config_decl.hpp:85
MSGPACK_API_VERSION_NAMESPACE
#define MSGPACK_API_VERSION_NAMESPACE(ns)
Definition
versioning.hpp:66
object_fwd_decl.hpp
Generated by
1.17.0