/usr/include/msgpack/v2/object_fwd.hpp is in libmsgpack-dev 2.1.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | //
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2008-2016 FURUHASHI Sadayuki and KONDO Takatoshi
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef MSGPACK_V2_OBJECT_FWD_HPP
#define MSGPACK_V2_OBJECT_FWD_HPP
#include "msgpack/v2/object_fwd_decl.hpp"
#include "msgpack/object_fwd.hpp"
namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v2) {
/// @endcond
struct object : v1::object {
object() {}
object(v1::object const& o):v1::object(o) {}
/// Construct object from T
/**
* If `v` is the type that is corresponding to MessegePack format str, bin, ext, array, or map,
* you need to call `object(const T& v, msgpack::zone& z)` instead of this constructor.
*
* @tparam T The type of `v`.
* @param v The value you want to convert.
*/
template <typename T>
explicit object(const T& v) {
*this << v;
}
/// Construct object from T
/**
* The object is constructed on the zone `z`.
* See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object
*
* @tparam T The type of `v`.
* @param v The value you want to convert.
* @param z The zone that is used by the object.
*/
template <typename T>
object(const T& v, msgpack::zone& z):v1::object(v, z) {}
public:
/// Convert the object
/**
* If the object can't be converted to T, msgpack::type_error would be thrown.
* @tparam T The type of v.
* @param v The value you want to get. `v` is output parameter. `v` is overwritten by converted value from the object.
* @return The reference of `v`.
*/
template <typename T>
T& convert(T& v) const { return v1::object::convert(v); }
using v1::object::with_zone;
implicit_type convert() const;
};
#if !defined(MSGPACK_USE_CPP03)
namespace adaptor {
// If v1 has as specialization for T, then dispatch v1::adaptor::as<T>.
// So I call v1::has_as<T> meta function intentionally.
template <typename T>
struct as<T, typename std::enable_if<v1::has_as<T>::value>::type> : v1::adaptor::as<T> {
};
} // namespace adaptor
template <typename T>
struct has_as {
private:
template <typename U>
static auto check(U*) ->
typename std::enable_if<
// check v2 specialization
std::is_same<
decltype(adaptor::as<U>()(std::declval<msgpack::object>())),
U
>::value
||
// check v1 specialization
v1::has_as<U>::value,
std::true_type
>::type;
template <typename>
static std::false_type check(...);
public:
using type = decltype(check<T>(MSGPACK_NULLPTR));
static constexpr bool value = type::value;
};
#endif // !defined(MSGPACK_USE_CPP03)
/// @cond
} // MSGPACK_API_VERSION_NAMESPACE(v2)
/// @endcond
} // namespace msgpack
#endif // MSGPACK_V2_OBJECT_FWD_HPP
|