MessagePack for C++
Loading...
Searching...
No Matches
x3_unpack.hpp
Go to the documentation of this file.
1//
2// MessagePack for C++ deserializing routine
3//
4// Copyright (C) 2018 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_V3_X3_UNPACK_HPP
11#define MSGPACK_V3_X3_UNPACK_HPP
12
13#if defined(MSGPACK_USE_X3_PARSE)
14
15#include <boost/version.hpp>
16
17#if BOOST_VERSION >= 106100
18
22#include "msgpack/x3_parse.hpp"
23
24namespace msgpack {
25
29
30
31template <typename Iterator>
33 Iterator&& begin, Iterator&& end,
34 bool& referenced,
35 unpack_reference_func f, void* user_data,
36 unpack_limit const& limit)
37{
39 msgpack::unique_ptr<msgpack::zone> z(new msgpack::zone);
40 referenced = false;
41 detail::unpack_imp(
42 std::forward<Iterator>(begin), std::forward<Iterator>(end), *z, obj, referenced, f, user_data, limit);
43 return msgpack::object_handle(obj, msgpack::move(z));
44}
45
46template <typename Iterator>
48 Iterator&& begin, Iterator&& end,
49 unpack_reference_func f, void* user_data,
50 unpack_limit const& limit)
51{
52 bool referenced;
53 return unpack(std::forward<Iterator>(begin), std::forward<Iterator>(end), referenced, f, user_data, limit);
54}
55
56template <typename Iterator>
59 Iterator&& begin, Iterator&& end,
60 bool& referenced,
61 unpack_reference_func f, void* user_data,
62 unpack_limit const& limit)
63{
65 referenced = false;
66 detail::unpack_imp(
67 std::forward<Iterator>(begin), std::forward<Iterator>(end), z, obj, referenced, f, user_data, limit);
68 return obj;
69}
70
71template <typename Iterator>
74 Iterator&& begin, Iterator&& end,
75 unpack_reference_func f, void* user_data,
76 unpack_limit const& limit)
77{
78 bool referenced;
79 return unpack(
80 z, std::forward<Iterator>(begin), std::forward<Iterator>(end), referenced, f, user_data, limit);
81}
82
84} // MSGPACK_API_VERSION_NAMESPACE(v3)
86
87} // namespace msgpack
88
89#else // BOOST_VERSION >= 106100
90
91#error Boost 1.61.0 or later is required to use x3 parse
92
93#endif // BOOST_VERSION >= 106100
94
95#endif // defined(MSGPACK_USE_X3_PARSE)
96
97#endif // MSGPACK_V3_X3_UNPACK_HPP
The class holds object and zone.
Definition object.hpp:44
Definition cpp03_zone.hpp:30
Definition adaptor_base.hpp:15
bool(* unpack_reference_func)(msgpack::type::object_type type, std::size_t size, void *user_data)
The type of reference or copy judging function.
Definition unpack_decl.hpp:74
msgpack::object_handle unpack(const char *data, std::size_t len, std::size_t &off, bool &referenced, unpack_reference_func f, void *user_data, unpack_limit const &limit)
Unpack msgpack::object from a buffer.
Definition unpack.hpp:1396
Object class that corresponding to MessagePack format object.
Definition object_fwd.hpp:75
#define MSGPACK_API_VERSION_NAMESPACE(ns)
Definition versioning.hpp:66