mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-16 18:56:54 +02:00
Merge pull request #666 from redboltz/fix_663_and_update_to_v3
Fix 663 and update to v3
This commit is contained in:
@@ -39,7 +39,7 @@ matrix:
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="1"
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="signed" API_VERSION="2"
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="signed" API_VERSION="3"
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" SHARED="ON" CHAR_SIGN="signed" API_VERSION="2"
|
||||
@@ -87,7 +87,7 @@ matrix:
|
||||
- libc6-dbg
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="signed" API_VERSION="2" X3_PARSE="ON"
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="signed" API_VERSION="3" X3_PARSE="ON"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
@@ -140,7 +140,7 @@ matrix:
|
||||
- libc6-dbg
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="32" BOOST="ON" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="2" X3_PARSE="ON"
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="32" BOOST="ON" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="3" X3_PARSE="ON"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
|
@@ -124,7 +124,7 @@ ENDIF ()
|
||||
IF (MSGPACK_DEFAULT_API_VERSION)
|
||||
SET (CMAKE_CXX_FLAGS "-DMSGPACK_DEFAULT_API_VERSION=${MSGPACK_DEFAULT_API_VERSION} ${CMAKE_CXX_FLAGS}")
|
||||
ELSE ()
|
||||
SET (CMAKE_CXX_FLAGS "-DMSGPACK_DEFAULT_API_VERSION=2 ${CMAKE_CXX_FLAGS}")
|
||||
SET (CMAKE_CXX_FLAGS "-DMSGPACK_DEFAULT_API_VERSION=3 ${CMAKE_CXX_FLAGS}")
|
||||
ENDIF ()
|
||||
|
||||
FILE (GLOB_RECURSE PREDEF_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/predef/include/boost ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/predef/include/boost/*.h)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
version: 2.1.5.{build}
|
||||
version: 3.0.0.{build}
|
||||
|
||||
image:
|
||||
- Visual Studio 2015
|
||||
|
@@ -1,4 +1,4 @@
|
||||
IF (MSGPACK_USE_X3_PARSE)
|
||||
IF (MSGPACK_USE_X3_PARSE AND MSGPACK_DEFAULT_API_VERSION VERSION_GREATER 1)
|
||||
INCLUDE_DIRECTORIES (
|
||||
../include
|
||||
)
|
||||
|
@@ -11,7 +11,11 @@
|
||||
#include "msgpack/iterator.hpp"
|
||||
#include "msgpack/zone.hpp"
|
||||
#include "msgpack/pack.hpp"
|
||||
#include "msgpack/null_visitor.hpp"
|
||||
#include "msgpack/parse.hpp"
|
||||
#include "msgpack/unpack.hpp"
|
||||
#include "msgpack/x3_parse.hpp"
|
||||
#include "msgpack/x3_unpack.hpp"
|
||||
#include "msgpack/sbuffer.hpp"
|
||||
#include "msgpack/vrefbuffer.hpp"
|
||||
#include "msgpack/version.hpp"
|
||||
|
@@ -14,5 +14,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/adaptor_base.hpp"
|
||||
#include "msgpack/v2/adaptor/adaptor_base.hpp"
|
||||
#include "msgpack/v3/adaptor/adaptor_base.hpp"
|
||||
|
||||
#endif // MSGPACK_ADAPTOR_BASE_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/adaptor_base_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/adaptor_base_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/adaptor_base_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_ADAPTOR_BASE_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/array_ref_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/array_ref_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/array_ref_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_ARRAY_REF_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/boost/msgpack_variant_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/boost/msgpack_variant_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/boost/msgpack_variant_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_BOOST_MSGPACK_VARIANT_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/check_container_size_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/check_container_size_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/check_container_size_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_CHECK_CONTAINER_SIZE_DECL_HPP
|
||||
|
@@ -139,5 +139,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/define_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/define_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/define_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_DEFINE_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/ext_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/ext_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/ext_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_EXT_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/fixint_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/fixint_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/fixint_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_FIXINT_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/int_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/int_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/int_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_INT_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/map_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/map_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/map_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_MAP_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/msgpack_tuple_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/msgpack_tuple_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/msgpack_tuple_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_MSGPACK_TUPLE_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/nil_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/nil_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/nil_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_NIL_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/raw_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/raw_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/raw_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_RAW_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/size_equal_only_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/size_equal_only_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/size_equal_only_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_SIZE_EQUAL_ONLY_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/adaptor/v4raw_decl.hpp"
|
||||
#include "msgpack/v2/adaptor/v4raw_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/v4raw_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_V4RAW_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/cpp_config_decl.hpp"
|
||||
#include "msgpack/v2/cpp_config_decl.hpp"
|
||||
#include "msgpack/v3/cpp_config_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_CPP_CONFIG_DECL_HPP
|
||||
|
17
include/msgpack/create_object_visitor.hpp
Normal file
17
include/msgpack/create_object_visitor.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_CREATE_OBJECT_VISITOR_HPP
|
||||
#define MSGPACK_CREATE_OBJECT_VISITOR_HPP
|
||||
|
||||
#include "msgpack/create_object_visitor_decl.hpp"
|
||||
|
||||
#include "msgpack/v2/create_object_visitor.hpp"
|
||||
|
||||
#endif // MSGPACK_CREATE_OBJECT_VISITOR_HPP
|
16
include/msgpack/create_object_visitor_decl.hpp
Normal file
16
include/msgpack/create_object_visitor_decl.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_CREATE_OBJECT_VISITOR_DECL_HPP
|
||||
#define MSGPACK_CREATE_OBJECT_VISITOR_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/create_object_visitor_decl.hpp"
|
||||
#include "msgpack/v3/create_object_visitor_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_CREATE_OBJECT_VISITOR_DECL_HPP
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/fbuffer_decl.hpp"
|
||||
#include "msgpack/v2/fbuffer_decl.hpp"
|
||||
#include "msgpack/v3/fbuffer_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_FBUFFER_DECL_HPP
|
||||
|
@@ -13,5 +13,6 @@
|
||||
|
||||
#include <msgpack/v1/iterator_decl.hpp>
|
||||
#include <msgpack/v2/iterator_decl.hpp>
|
||||
#include <msgpack/v3/iterator_decl.hpp>
|
||||
|
||||
#endif // MSGPACK_V1_ITERATOR_DECL_HPP
|
||||
#endif // MSGPACK_ITERATOR_DECL_HPP
|
||||
|
@@ -13,5 +13,6 @@
|
||||
|
||||
#include "msgpack/v1/meta_decl.hpp"
|
||||
#include "msgpack/v2/meta_decl.hpp"
|
||||
#include "msgpack/v3/meta_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_META_DECL_HPP
|
||||
|
17
include/msgpack/null_visitor.hpp
Normal file
17
include/msgpack/null_visitor.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_NULL_VISITOR_HPP
|
||||
#define MSGPACK_NULL_VISITOR_HPP
|
||||
|
||||
#include "msgpack/null_visitor_decl.hpp"
|
||||
|
||||
#include "msgpack/v2/null_visitor.hpp"
|
||||
|
||||
#endif // MSGPACK_NULL_VISITOR_HPP
|
16
include/msgpack/null_visitor_decl.hpp
Normal file
16
include/msgpack/null_visitor_decl.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_NULL_VISITOR_DECL_HPP
|
||||
#define MSGPACK_NULL_VISITOR_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/null_visitor_decl.hpp"
|
||||
#include "msgpack/v3/null_visitor_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_NULL_VISITOR_DECL_HPP
|
@@ -13,5 +13,6 @@
|
||||
|
||||
#include "msgpack/v1/object_decl.hpp"
|
||||
#include "msgpack/v2/object_decl.hpp"
|
||||
#include "msgpack/v3/object_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_OBJECT_DECL_HPP
|
||||
|
@@ -15,5 +15,6 @@
|
||||
|
||||
#include "msgpack/v1/object_fwd.hpp"
|
||||
#include "msgpack/v2/object_fwd.hpp"
|
||||
#include "msgpack/v3/object_fwd.hpp"
|
||||
|
||||
#endif // MSGPACK_OBJECT_FWD_HPP
|
||||
|
@@ -13,5 +13,6 @@
|
||||
|
||||
#include "msgpack/v1/object_fwd_decl.hpp"
|
||||
#include "msgpack/v2/object_fwd_decl.hpp"
|
||||
#include "msgpack/v3/object_fwd_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_OBJECT_FWD_DECL_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/pack_decl.hpp"
|
||||
#include "msgpack/v2/pack_decl.hpp"
|
||||
#include "msgpack/v3/pack_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_PACK_DECL_HPP
|
||||
|
18
include/msgpack/parse.hpp
Normal file
18
include/msgpack/parse.hpp
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_PARSE_HPP
|
||||
#define MSGPACK_PARSE_HPP
|
||||
|
||||
#include "msgpack/parse_decl.hpp"
|
||||
|
||||
#include "msgpack/v2/parse.hpp"
|
||||
#include "msgpack/v3/parse.hpp"
|
||||
|
||||
#endif // MSGPACK_PARSE_HPP
|
16
include/msgpack/parse_decl.hpp
Normal file
16
include/msgpack/parse_decl.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_PARSE_DECL_HPP
|
||||
#define MSGPACK_PARSE_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/parse_decl.hpp"
|
||||
#include "msgpack/v3/parse_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_PARSE_DECL_HPP
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/parse_return.hpp"
|
||||
#include "msgpack/v2/parse_return.hpp"
|
||||
#include "msgpack/v3/parse_return.hpp"
|
||||
|
||||
#endif // MSGPACK_PARSE_RETURN_HPP
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "msgpack/v1/sbuffer_decl.hpp"
|
||||
#include "msgpack/v2/sbuffer_decl.hpp"
|
||||
#include "msgpack/v3/sbuffer_decl.hpp"
|
||||
|
||||
|
||||
#endif // MSGPACK_SBUFFER_DECL_HPP
|
||||
|
@@ -14,6 +14,6 @@
|
||||
|
||||
#include "msgpack/v1/unpack.hpp"
|
||||
#include "msgpack/v2/unpack.hpp"
|
||||
#include "msgpack/v2/x3_unpack.hpp"
|
||||
#include "msgpack/v3/unpack.hpp"
|
||||
|
||||
#endif // MSGPACK_UNPACK_HPP
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/unpack_decl.hpp"
|
||||
#include "msgpack/v2/unpack_decl.hpp"
|
||||
#include "msgpack/v3/unpack_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_UNPACK_DECL_HPP
|
||||
|
@@ -1392,11 +1392,12 @@ inline msgpack::object_handle unpack(
|
||||
parse_return ret = detail::unpack_imp(
|
||||
data, len, noff, *z, obj, referenced, f, user_data, limit);
|
||||
|
||||
off = noff;
|
||||
switch(ret) {
|
||||
case PARSE_SUCCESS:
|
||||
off = noff;
|
||||
return msgpack::object_handle(obj, msgpack::move(z));
|
||||
case PARSE_EXTRA_BYTES:
|
||||
off = noff;
|
||||
return msgpack::object_handle(obj, msgpack::move(z));
|
||||
case PARSE_CONTINUE:
|
||||
throw msgpack::insufficient_bytes("insufficient bytes");
|
||||
@@ -1448,13 +1449,14 @@ inline void unpack(
|
||||
parse_return ret = detail::unpack_imp(
|
||||
data, len, noff, *z, obj, referenced, f, user_data, limit);
|
||||
|
||||
off = noff;
|
||||
switch(ret) {
|
||||
case PARSE_SUCCESS:
|
||||
off = noff;
|
||||
result.set(obj);
|
||||
result.zone() = msgpack::move(z);
|
||||
return;
|
||||
case PARSE_EXTRA_BYTES:
|
||||
off = noff;
|
||||
result.set(obj);
|
||||
result.zone() = msgpack::move(z);
|
||||
return;
|
||||
@@ -1510,11 +1512,12 @@ inline msgpack::object unpack(
|
||||
parse_return ret = detail::unpack_imp(
|
||||
data, len, noff, z, obj, referenced, f, user_data, limit);
|
||||
|
||||
off = noff;
|
||||
switch(ret) {
|
||||
case PARSE_SUCCESS:
|
||||
off = noff;
|
||||
return obj;
|
||||
case PARSE_EXTRA_BYTES:
|
||||
off = noff;
|
||||
return obj;
|
||||
case PARSE_CONTINUE:
|
||||
throw msgpack::insufficient_bytes("insufficient bytes");
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "msgpack/unpack_decl.hpp"
|
||||
#include "msgpack/unpack_exception.hpp"
|
||||
#include "msgpack/v2/create_object_visitor_decl.hpp"
|
||||
#include "msgpack/v2/null_visitor.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
33
include/msgpack/v2/create_object_visitor_decl.hpp
Normal file
33
include/msgpack/v2/create_object_visitor_decl.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2017 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_CREATE_OBJECT_VISITOR_DECL_HPP
|
||||
#define MSGPACK_V2_CREATE_OBJECT_VISITOR_DECL_HPP
|
||||
|
||||
#include "msgpack/versioning.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v2) {
|
||||
/// @endcond
|
||||
|
||||
namespace detail {
|
||||
|
||||
class create_object_visitor;
|
||||
|
||||
} // detail
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v2)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V2_CREATE_OBJECT_VISITOR_DECL_HPP
|
@@ -10,8 +10,7 @@
|
||||
#ifndef MSGPACK_V2_NULL_VISITOR_HPP
|
||||
#define MSGPACK_V2_NULL_VISITOR_HPP
|
||||
|
||||
#include "msgpack/versioning.hpp"
|
||||
#include "msgpack/cpp_config.hpp"
|
||||
#include "msgpack/v2/null_visitor_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
|
29
include/msgpack/v2/null_visitor_decl.hpp
Normal file
29
include/msgpack/v2/null_visitor_decl.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_NULL_VISITOR_DECL_HPP
|
||||
#define MSGPACK_V2_NULL_VISITOR_DECL_HPP
|
||||
|
||||
#include "msgpack/versioning.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v2) {
|
||||
/// @endcond
|
||||
|
||||
struct null_visitor;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v2)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V2_NULL_VISITOR_DECL_HPP
|
@@ -22,6 +22,7 @@ using v1::packer;
|
||||
|
||||
using v1::pack;
|
||||
|
||||
|
||||
#if MSGPACK_ENDIAN_LITTLE_BYTE
|
||||
|
||||
using v1::take8_8;
|
||||
|
@@ -10,8 +10,14 @@
|
||||
#ifndef MSGPACK_V2_PARSE_HPP
|
||||
#define MSGPACK_V2_PARSE_HPP
|
||||
|
||||
#if MSGPACK_DEFAULT_API_VERSION >= 2
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "msgpack/unpack_define.h"
|
||||
#include "msgpack/parse_return.hpp"
|
||||
#include "msgpack/unpack_exception.hpp"
|
||||
#include "msgpack/unpack_decl.hpp"
|
||||
#include "msgpack/v2/create_object_visitor.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
@@ -21,6 +27,10 @@ MSGPACK_API_VERSION_NAMESPACE(v2) {
|
||||
|
||||
namespace detail {
|
||||
|
||||
using v1::detail::fix_tag;
|
||||
using v1::detail::value;
|
||||
using v1::detail::load;
|
||||
|
||||
template <typename VisitorHolder>
|
||||
class context {
|
||||
public:
|
||||
@@ -58,6 +68,7 @@ private:
|
||||
std::size_t& off) {
|
||||
typename value<T>::type size;
|
||||
load<T>(size, load_pos);
|
||||
++m_current;
|
||||
if (size == 0) {
|
||||
if (!sv(size)) {
|
||||
off = m_current - m_start;
|
||||
@@ -67,7 +78,7 @@ private:
|
||||
off = m_current - m_start;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
parse_return ret = m_stack.consume(holder(), m_current);
|
||||
parse_return ret = m_stack.consume(holder());
|
||||
if (ret != PARSE_CONTINUE) {
|
||||
off = m_current - m_start;
|
||||
return ret;
|
||||
@@ -84,18 +95,17 @@ private:
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
++m_current;
|
||||
m_cs = MSGPACK_CS_HEADER;
|
||||
return PARSE_CONTINUE;
|
||||
}
|
||||
|
||||
parse_return after_visit_proc(bool visit_result, std::size_t& off) {
|
||||
++m_current;
|
||||
if (!visit_result) {
|
||||
off = m_current - m_start;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
parse_return ret = m_stack.consume(holder(), m_current);
|
||||
++m_current;
|
||||
parse_return ret = m_stack.consume(holder());
|
||||
if (ret != PARSE_CONTINUE) {
|
||||
off = m_current - m_start;
|
||||
}
|
||||
@@ -161,21 +171,15 @@ private:
|
||||
assert(0);
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
parse_return consume(VisitorHolder& visitor_holder, char const*& current) {
|
||||
parse_return consume(VisitorHolder& visitor_holder) {
|
||||
while (!m_stack.empty()) {
|
||||
stack_elem& e = m_stack.back();
|
||||
switch (e.m_type) {
|
||||
case MSGPACK_CT_ARRAY_ITEM:
|
||||
if (!visitor_holder.visitor().end_array_item()) {
|
||||
--current;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
if (!visitor_holder.visitor().end_array_item()) return PARSE_STOP_VISITOR;
|
||||
if (--e.m_rest == 0) {
|
||||
m_stack.pop_back();
|
||||
if (!visitor_holder.visitor().end_array()) {
|
||||
--current;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
if (!visitor_holder.visitor().end_array()) return PARSE_STOP_VISITOR;
|
||||
}
|
||||
else {
|
||||
if (!visitor_holder.visitor().start_array_item()) return PARSE_STOP_VISITOR;
|
||||
@@ -183,24 +187,15 @@ private:
|
||||
}
|
||||
break;
|
||||
case MSGPACK_CT_MAP_KEY:
|
||||
if (!visitor_holder.visitor().end_map_key()) {
|
||||
--current;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
if (!visitor_holder.visitor().end_map_key()) return PARSE_STOP_VISITOR;
|
||||
if (!visitor_holder.visitor().start_map_value()) return PARSE_STOP_VISITOR;
|
||||
e.m_type = MSGPACK_CT_MAP_VALUE;
|
||||
return PARSE_CONTINUE;
|
||||
case MSGPACK_CT_MAP_VALUE:
|
||||
if (!visitor_holder.visitor().end_map_value()) {
|
||||
--current;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
if (!visitor_holder.visitor().end_map_value()) return PARSE_STOP_VISITOR;
|
||||
if (--e.m_rest == 0) {
|
||||
m_stack.pop_back();
|
||||
if (!visitor_holder.visitor().end_map()) {
|
||||
--current;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
if (!visitor_holder.visitor().end_map()) return PARSE_STOP_VISITOR;
|
||||
}
|
||||
else {
|
||||
e.m_type = MSGPACK_CT_MAP_KEY;
|
||||
@@ -1013,23 +1008,23 @@ inline void parser<VisitorHolder, ReferencedBufferHook>::remove_nonparsed_buffer
|
||||
|
||||
template <typename Visitor>
|
||||
inline bool parse(const char* data, size_t len, size_t& off, Visitor& v) {
|
||||
parse_return ret = detail::parse_imp(data, len, off, v);
|
||||
parse_return ret = msgpack::detail::parse_imp(data, len, off, v);
|
||||
return ret == PARSE_SUCCESS || ret == PARSE_EXTRA_BYTES;
|
||||
}
|
||||
|
||||
template <typename Visitor>
|
||||
inline bool parse(const char* data, size_t len, Visitor& v) {
|
||||
std::size_t off = 0;
|
||||
return parse(data, len, off, v);
|
||||
return msgpack::parse(data, len, off, v);
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename Visitor>
|
||||
struct parse_helper : context<parse_helper<Visitor> > {
|
||||
struct parse_helper : detail::context<parse_helper<Visitor> > {
|
||||
parse_helper(Visitor& v):m_visitor(v) {}
|
||||
parse_return execute(const char* data, std::size_t len, std::size_t& off) {
|
||||
return context<parse_helper<Visitor> >::execute(data, len, off);
|
||||
return detail::context<parse_helper<Visitor> >::execute(data, len, off);
|
||||
}
|
||||
Visitor& visitor() const { return m_visitor; }
|
||||
Visitor& m_visitor;
|
||||
@@ -1047,12 +1042,13 @@ parse_imp(const char* data, size_t len, size_t& off, Visitor& v) {
|
||||
}
|
||||
detail::parse_helper<Visitor> h(v);
|
||||
parse_return ret = h.execute(data, len, noff);
|
||||
off = noff;
|
||||
switch (ret) {
|
||||
case PARSE_CONTINUE:
|
||||
off = noff;
|
||||
v.insufficient_bytes(noff - 1, noff);
|
||||
return ret;
|
||||
case PARSE_SUCCESS:
|
||||
off = noff;
|
||||
if(noff < len) {
|
||||
return PARSE_EXTRA_BYTES;
|
||||
}
|
||||
@@ -1071,5 +1067,6 @@ parse_imp(const char* data, size_t len, size_t& off, Visitor& v) {
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_DEFAULT_API_VERSION >= 2
|
||||
|
||||
#endif // MSGPACK_V2_PARSE_HPP
|
||||
|
79
include/msgpack/v2/parse_decl.hpp
Normal file
79
include/msgpack/v2/parse_decl.hpp
Normal file
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_PARSE_DECL_HPP
|
||||
#define MSGPACK_V2_PARSE_DECL_HPP
|
||||
|
||||
#include "msgpack/parse_return.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v2) {
|
||||
/// @endcond
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename VisitorHolder>
|
||||
class context;
|
||||
|
||||
} // detail
|
||||
|
||||
|
||||
/// Parsing class for a stream deserialization.
|
||||
|
||||
template <typename VisitorHolder, typename ReferencedBufferHook>
|
||||
class parser;
|
||||
|
||||
|
||||
/// Unpack msgpack formatted data via a visitor
|
||||
/**
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param off The offset position of the buffer. It is read and overwritten.
|
||||
* @param v The visitor that satisfies visitor concept. https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#visitor-concept
|
||||
*
|
||||
* @return if unpacking process finishs without error then return true, otherwise return false.
|
||||
*
|
||||
*/
|
||||
template <typename Visitor>
|
||||
bool parse(const char* data, size_t len, size_t& off, Visitor& v);
|
||||
|
||||
|
||||
/// Unpack msgpack formatted data via a visitor
|
||||
/**
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param v The visitor that satisfies visitor concept. https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#visitor-concept
|
||||
*
|
||||
* @return if unpacking process finishs without error then return true, otherwise return false.
|
||||
*
|
||||
*/
|
||||
template <typename Visitor>
|
||||
bool parse(const char* data, size_t len, Visitor& v);
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename Visitor>
|
||||
struct parse_helper;
|
||||
|
||||
template <typename Visitor>
|
||||
inline parse_return
|
||||
parse_imp(const char* data, size_t len, size_t& off, Visitor& v);
|
||||
|
||||
} // detail
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v2)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#endif // MSGPACK_V2_PARSE_DECL_HPP
|
@@ -10,9 +10,11 @@
|
||||
#ifndef MSGPACK_V2_UNPACK_HPP
|
||||
#define MSGPACK_V2_UNPACK_HPP
|
||||
|
||||
#if MSGPACK_DEFAULT_API_VERSION >= 2
|
||||
|
||||
#include "msgpack/unpack_decl.hpp"
|
||||
#include "msgpack/v2/create_object_visitor.hpp"
|
||||
#include "msgpack/v2/parse.hpp"
|
||||
#include "msgpack/parse.hpp"
|
||||
#include "msgpack/create_object_visitor.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
@@ -152,13 +154,16 @@ inline msgpack::object_handle unpack(
|
||||
msgpack::object obj;
|
||||
msgpack::unique_ptr<msgpack::zone> z(new msgpack::zone);
|
||||
referenced = false;
|
||||
std::size_t noff = off;
|
||||
parse_return ret = detail::unpack_imp(
|
||||
data, len, off, *z, obj, referenced, f, user_data, limit);
|
||||
data, len, noff, *z, obj, referenced, f, user_data, limit);
|
||||
|
||||
switch(ret) {
|
||||
case PARSE_SUCCESS:
|
||||
off = noff;
|
||||
return msgpack::object_handle(obj, msgpack::move(z));
|
||||
case PARSE_EXTRA_BYTES:
|
||||
off = noff;
|
||||
return msgpack::object_handle(obj, msgpack::move(z));
|
||||
default:
|
||||
break;
|
||||
@@ -203,15 +208,18 @@ inline void unpack(
|
||||
msgpack::object obj;
|
||||
msgpack::unique_ptr<msgpack::zone> z(new msgpack::zone);
|
||||
referenced = false;
|
||||
std::size_t noff = off;
|
||||
parse_return ret = detail::unpack_imp(
|
||||
data, len, off, *z, obj, referenced, f, user_data, limit);
|
||||
data, len, noff, *z, obj, referenced, f, user_data, limit);
|
||||
|
||||
switch(ret) {
|
||||
case PARSE_SUCCESS:
|
||||
off = noff;
|
||||
result.set(obj);
|
||||
result.zone() = msgpack::move(z);
|
||||
return;
|
||||
case PARSE_EXTRA_BYTES:
|
||||
off = noff;
|
||||
result.set(obj);
|
||||
result.zone() = msgpack::move(z);
|
||||
return;
|
||||
@@ -223,7 +231,7 @@ inline void unpack(
|
||||
inline void unpack(
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len, std::size_t& off,
|
||||
msgpack::v2::unpack_reference_func f, void* user_data,
|
||||
unpack_reference_func f, void* user_data,
|
||||
unpack_limit const& limit)
|
||||
{
|
||||
bool referenced;
|
||||
@@ -259,14 +267,17 @@ inline msgpack::object unpack(
|
||||
unpack_limit const& limit)
|
||||
{
|
||||
msgpack::object obj;
|
||||
std::size_t noff = off;
|
||||
referenced = false;
|
||||
parse_return ret = detail::unpack_imp(
|
||||
data, len, off, z, obj, referenced, f, user_data, limit);
|
||||
data, len, noff, z, obj, referenced, f, user_data, limit);
|
||||
|
||||
switch(ret) {
|
||||
case PARSE_SUCCESS:
|
||||
off = noff;
|
||||
return obj;
|
||||
case PARSE_EXTRA_BYTES:
|
||||
off = noff;
|
||||
return obj;
|
||||
default:
|
||||
break;
|
||||
@@ -332,5 +343,6 @@ unpack_imp(const char* data, std::size_t len, std::size_t& off,
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_DEFAULT_API_VERSION >= 2
|
||||
|
||||
#endif // MSGPACK_V2_UNPACK_HPP
|
||||
|
@@ -100,7 +100,7 @@ class basic_unpacker;
|
||||
* @return object_handle that contains unpacked data.
|
||||
*
|
||||
*/
|
||||
object_handle unpack(
|
||||
msgpack::object_handle unpack(
|
||||
const char* data, std::size_t len, std::size_t& off, bool& referenced,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
|
||||
|
||||
@@ -116,7 +116,7 @@ object_handle unpack(
|
||||
* @return object_handle that contains unpacked data.
|
||||
*
|
||||
*/
|
||||
object_handle unpack(
|
||||
msgpack::object_handle unpack(
|
||||
const char* data, std::size_t len, std::size_t& off,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
|
||||
|
||||
@@ -132,7 +132,7 @@ object_handle unpack(
|
||||
* @return object_handle that contains unpacked data.
|
||||
*
|
||||
*/
|
||||
object_handle unpack(
|
||||
msgpack::object_handle unpack(
|
||||
const char* data, std::size_t len, bool& referenced,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
|
||||
|
||||
@@ -147,7 +147,7 @@ object_handle unpack(
|
||||
* @return object_handle that contains unpacked data.
|
||||
*
|
||||
*/
|
||||
object_handle unpack(
|
||||
msgpack::object_handle unpack(
|
||||
const char* data, std::size_t len,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
|
||||
|
||||
@@ -166,7 +166,7 @@ object_handle unpack(
|
||||
*
|
||||
*/
|
||||
void unpack(
|
||||
object_handle& result,
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len, std::size_t& off, bool& referenced,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
|
||||
|
||||
@@ -183,7 +183,7 @@ void unpack(
|
||||
*
|
||||
*/
|
||||
void unpack(
|
||||
object_handle& result,
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len, std::size_t& off,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
|
||||
|
||||
@@ -200,7 +200,7 @@ void unpack(
|
||||
*
|
||||
*/
|
||||
void unpack(
|
||||
object_handle& result,
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len, bool& referenced,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
|
||||
|
||||
@@ -216,7 +216,7 @@ void unpack(
|
||||
*
|
||||
*/
|
||||
void unpack(
|
||||
object_handle& result,
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
|
||||
|
||||
@@ -292,31 +292,6 @@ msgpack::object unpack(
|
||||
const char* data, std::size_t len,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// Unpack msgpack formatted data via a visitor
|
||||
/**
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param off The offset position of the buffer. It is read and overwritten.
|
||||
* @param v The visitor that satisfies visitor concept. https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#visitor-concept
|
||||
*
|
||||
* @return if unpacking process finishs without error then return true, otherwise return false.
|
||||
*
|
||||
*/
|
||||
template <typename Visitor>
|
||||
bool parse(const char* data, size_t len, size_t& off, Visitor& v);
|
||||
|
||||
/// Unpack msgpack formatted data via a visitor
|
||||
/**
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param v The visitor that satisfies visitor concept. https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#visitor-concept
|
||||
*
|
||||
* @return if unpacking process finishs without error then return true, otherwise return false.
|
||||
*
|
||||
*/
|
||||
template <typename Visitor>
|
||||
bool parse(const char* data, size_t len, Visitor& v);
|
||||
|
||||
namespace detail {
|
||||
|
||||
parse_return
|
||||
@@ -325,9 +300,6 @@ unpack_imp(const char* data, std::size_t len, std::size_t& off,
|
||||
unpack_reference_func f, void* user_data,
|
||||
unpack_limit const& limit);
|
||||
|
||||
template <typename UnpackVisitor>
|
||||
parse_return
|
||||
parse_imp(const char* data, size_t len, size_t& off, UnpackVisitor& v);
|
||||
|
||||
} // detail
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#if BOOST_VERSION >= 106100
|
||||
|
||||
#include "msgpack/versioning.hpp"
|
||||
#include "msgpack/x3_parse_decl.hpp"
|
||||
|
||||
#if __GNUC__ >= 4
|
||||
#pragma GCC diagnostic push
|
||||
|
36
include/msgpack/v2/x3_parse_decl.hpp
Normal file
36
include/msgpack/v2/x3_parse_decl.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2017 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_X3_PARSE_DECL_HPP
|
||||
#define MSGPACK_V2_X3_PARSE_DECL_HPP
|
||||
|
||||
#if defined(MSGPACK_USE_X3_PARSE)
|
||||
|
||||
#include "msgpack/versioning.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v2) {
|
||||
/// @endcond
|
||||
|
||||
|
||||
template <typename Iterator, typename Visitor>
|
||||
bool parse(Iterator&& begin, Iterator&& end, Visitor&& vis);
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v2)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#endif // defined(MSGPACK_USE_X3_PARSE)
|
||||
|
||||
#endif // MSGPACK_V2_X3_PARSE_DECL_HPP
|
@@ -17,8 +17,9 @@
|
||||
#if BOOST_VERSION >= 106100
|
||||
|
||||
#include "msgpack/versioning.hpp"
|
||||
#include "msgpack/v2/create_object_visitor.hpp"
|
||||
#include "msgpack/v2/x3_parse.hpp"
|
||||
#include "msgpack/create_object_visitor.hpp"
|
||||
#include "msgpack/x3_unpack_decl.hpp"
|
||||
#include "msgpack/x3_parse.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
@@ -32,8 +33,8 @@ template <typename Iterator>
|
||||
inline void
|
||||
unpack_imp(Iterator&& begin, Iterator&& end,
|
||||
msgpack::zone& result_zone, msgpack::object& result, bool& referenced,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit())
|
||||
unpack_reference_func f, void* user_data,
|
||||
unpack_limit const& limit)
|
||||
{
|
||||
create_object_visitor v(f, user_data, limit);
|
||||
v.set_zone(result_zone);
|
||||
@@ -53,8 +54,8 @@ template <typename Iterator>
|
||||
inline msgpack::object_handle unpack(
|
||||
Iterator&& begin, Iterator&& end,
|
||||
bool& referenced,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit())
|
||||
unpack_reference_func f, void* user_data,
|
||||
unpack_limit const& limit)
|
||||
{
|
||||
msgpack::object obj;
|
||||
msgpack::unique_ptr<msgpack::zone> z(new msgpack::zone);
|
||||
@@ -67,8 +68,8 @@ inline msgpack::object_handle unpack(
|
||||
template <typename Iterator>
|
||||
inline msgpack::object_handle unpack(
|
||||
Iterator&& begin, Iterator&& end,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit())
|
||||
unpack_reference_func f, void* user_data,
|
||||
unpack_limit const& limit)
|
||||
{
|
||||
bool referenced;
|
||||
return unpack(std::forward<Iterator>(begin), std::forward<Iterator>(end), referenced, f, user_data, limit);
|
||||
@@ -79,8 +80,8 @@ inline msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
Iterator&& begin, Iterator&& end,
|
||||
bool& referenced,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit())
|
||||
unpack_reference_func f, void* user_data,
|
||||
unpack_limit const& limit)
|
||||
{
|
||||
msgpack::object obj;
|
||||
referenced = false;
|
||||
@@ -93,8 +94,8 @@ template <typename Iterator>
|
||||
inline msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
Iterator&& begin, Iterator&& end,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit())
|
||||
unpack_reference_func f, void* user_data,
|
||||
unpack_limit const& limit)
|
||||
{
|
||||
bool referenced;
|
||||
return unpack(
|
||||
|
71
include/msgpack/v2/x3_unpack_decl.hpp
Normal file
71
include/msgpack/v2/x3_unpack_decl.hpp
Normal file
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_X3_UNPACK_DECL_HPP
|
||||
#define MSGPACK_V2_X3_UNPACK_DECL_HPP
|
||||
|
||||
#if defined(MSGPACK_USE_X3_PARSE)
|
||||
|
||||
#include "msgpack/versioning.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v2) {
|
||||
/// @endcond
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename Iterator>
|
||||
void
|
||||
unpack_imp(Iterator&& begin, Iterator&& end,
|
||||
msgpack::zone& result_zone, msgpack::object& result, bool& referenced,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit());
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename Iterator>
|
||||
msgpack::object_handle unpack(
|
||||
Iterator&& begin, Iterator&& end,
|
||||
bool& referenced,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit());
|
||||
|
||||
template <typename Iterator>
|
||||
msgpack::object_handle unpack(
|
||||
Iterator&& begin, Iterator&& end,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit());
|
||||
|
||||
template <typename Iterator>
|
||||
msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
Iterator&& begin, Iterator&& end,
|
||||
bool& referenced,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit());
|
||||
|
||||
template <typename Iterator>
|
||||
msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
Iterator&& begin, Iterator&& end,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v2)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#endif // defined(MSGPACK_USE_X3_PARSE)
|
||||
|
||||
#endif // MSGPACK_V2_X3_UNPACK_DECL_HPP
|
58
include/msgpack/v3/adaptor/adaptor_base.hpp
Normal file
58
include/msgpack/v3/adaptor/adaptor_base.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2015-2016 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_V3_ADAPTOR_BASE_HPP
|
||||
#define MSGPACK_V3_ADAPTOR_BASE_HPP
|
||||
|
||||
#include "msgpack/v3/adaptor/adaptor_base_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
|
||||
namespace adaptor {
|
||||
|
||||
// Adaptor functors
|
||||
|
||||
template <typename T, typename Enabler>
|
||||
struct convert : v2::adaptor::convert<T, Enabler> {
|
||||
};
|
||||
|
||||
template <typename T, typename Enabler>
|
||||
struct pack : v2::adaptor::pack<T, Enabler> {
|
||||
};
|
||||
|
||||
template <typename T, typename Enabler>
|
||||
struct object<
|
||||
T,
|
||||
Enabler,
|
||||
typename msgpack::enable_if<
|
||||
!msgpack::is_same<T, std::string>::value &&
|
||||
!msgpack::is_array<T>::value
|
||||
>::type>
|
||||
: v2::adaptor::object<T, Enabler> {
|
||||
};
|
||||
|
||||
template <typename T, typename Enabler>
|
||||
struct object_with_zone : v2::adaptor::object_with_zone<T, Enabler> {
|
||||
};
|
||||
|
||||
} // namespace adaptor
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#endif // MSGPACK_V3_ADAPTOR_BASE_HPP
|
52
include/msgpack/v3/adaptor/adaptor_base_decl.hpp
Normal file
52
include/msgpack/v3/adaptor/adaptor_base_decl.hpp
Normal file
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_ADAPTOR_BASE_DECL_HPP
|
||||
#define MSGPACK_V3_ADAPTOR_BASE_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/adaptor_base_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::packer;
|
||||
|
||||
namespace adaptor {
|
||||
|
||||
// Adaptor functors
|
||||
|
||||
template <typename T, typename Enabler = void>
|
||||
struct convert;
|
||||
|
||||
template <typename T, typename Enabler = void>
|
||||
struct pack;
|
||||
|
||||
template <typename T, typename Enabler = void, typename Enabler2 = void>
|
||||
struct object;
|
||||
|
||||
template <typename T, typename Enabler = void>
|
||||
struct object_with_zone;
|
||||
|
||||
} // namespace adaptor
|
||||
|
||||
// operators
|
||||
|
||||
using v2::operator>>;
|
||||
using v2::operator<<;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_ADAPTOR_BASE_DECL_HPP
|
36
include/msgpack/v3/adaptor/array_ref_decl.hpp
Normal file
36
include/msgpack/v3/adaptor/array_ref_decl.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_TYPE_ARRAY_REF_DECL_HPP
|
||||
#define MSGPACK_V3_TYPE_ARRAY_REF_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/array_ref_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
|
||||
using v2::type::array_ref;
|
||||
|
||||
using v2::type::make_array_ref;
|
||||
|
||||
|
||||
} // namespace type
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_TYPE_ARRAY_REF_DECL_HPP
|
42
include/msgpack/v3/adaptor/boost/msgpack_variant_decl.hpp
Normal file
42
include/msgpack/v3/adaptor/boost/msgpack_variant_decl.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_TYPE_BOOST_MSGPACK_VARIANT_DECL_HPP
|
||||
#define MSGPACK_V3_TYPE_BOOST_MSGPACK_VARIANT_DECL_HPP
|
||||
|
||||
#if defined(MSGPACK_USE_BOOST)
|
||||
|
||||
#include "msgpack/v2/adaptor/boost/msgpack_variant_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
|
||||
using v2::type::basic_variant;
|
||||
using v2::type::variant;
|
||||
using v2::type::variant_ref;
|
||||
|
||||
using v2::type::operator<;
|
||||
|
||||
using v2::type::operator==;
|
||||
|
||||
} // namespace type
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_USE_BOOST
|
||||
#endif // MSGPACK_V3_TYPE_BOOST_MSGPACK_VARIANT_DECL_HPP
|
39
include/msgpack/v3/adaptor/check_container_size_decl.hpp
Normal file
39
include/msgpack/v3/adaptor/check_container_size_decl.hpp
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_CHECK_CONTAINER_SIZE_DECL_HPP
|
||||
#define MSGPACK_V3_CHECK_CONTAINER_SIZE_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/check_container_size_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::container_size_overflow;
|
||||
|
||||
namespace detail {
|
||||
|
||||
using v2::detail::check_container_size;
|
||||
|
||||
using v2::detail::check_container_size_for_ext;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
using v2::checked_get_container_size;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_CHECK_CONTAINER_SIZE_DECL_HPP
|
23
include/msgpack/v3/adaptor/define_decl.hpp
Normal file
23
include/msgpack/v3/adaptor/define_decl.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_DEFINE_DECL_HPP
|
||||
#define MSGPACK_V3_DEFINE_DECL_HPP
|
||||
|
||||
#include "msgpack/cpp_config.hpp"
|
||||
|
||||
#if defined(MSGPACK_USE_CPP03)
|
||||
#include "msgpack/v3/adaptor/detail/cpp03_define_array_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/detail/cpp03_define_map_decl.hpp"
|
||||
#else // MSGPACK_USE_CPP03
|
||||
#include "msgpack/v3/adaptor/detail/cpp11_define_array_decl.hpp"
|
||||
#include "msgpack/v3/adaptor/detail/cpp11_define_map_decl.hpp"
|
||||
#endif // MSGPACK_USE_CPP03
|
||||
|
||||
#endif // MSGPACK_V3_DEFINE_DECL_HPP
|
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// 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_V3_CPP03_DEFINE_ARRAY_DECL_HPP
|
||||
#define MSGPACK_V3_CPP03_DEFINE_ARRAY_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/detail/cpp03_define_array_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
namespace type {
|
||||
|
||||
using v2::type::define_array;
|
||||
|
||||
using v2::type::make_define_array;
|
||||
|
||||
} // namespace type
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_CPP03_DEFINE_ARRAY_DECL_HPP
|
31
include/msgpack/v3/adaptor/detail/cpp03_define_map_decl.hpp
Normal file
31
include/msgpack/v3/adaptor/detail/cpp03_define_map_decl.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2015-2016 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_V3_CPP03_DEFINE_MAP_DECL_HPP
|
||||
#define MSGPACK_V3_CPP03_DEFINE_MAP_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/detail/cpp03_define_map_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
namespace type {
|
||||
|
||||
using v2::type::define_map;
|
||||
|
||||
using v2::type::make_define_map;
|
||||
|
||||
} // namespace type
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_CPP03_DEFINE_MAP_DECL_HPP
|
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_CPP03_MSGPACK_TUPLE_DECL_HPP
|
||||
#define MSGPACK_V3_CPP03_MSGPACK_TUPLE_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/detail/cpp03_msgpack_tuple_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
|
||||
using v2::type::tuple;
|
||||
|
||||
using v2::type::tuple_element;
|
||||
|
||||
using v2::type::const_tuple_element;
|
||||
|
||||
using v2::type::tuple_type;
|
||||
|
||||
using v2::type::get;
|
||||
|
||||
using v2::type::make_tuple;
|
||||
|
||||
} // namespace type
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_CPP03_MSGPACK_TUPLE_DECL_HPP
|
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// 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_V3_CPP11_DEFINE_ARRAY_DECL_HPP
|
||||
#define MSGPACK_V3_CPP11_DEFINE_ARRAY_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/detail/cpp11_define_array_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
namespace type {
|
||||
|
||||
using v2::type::define_array_imp;
|
||||
using v2::type::define_array;
|
||||
|
||||
using v2::type::make_define_array;
|
||||
|
||||
} // namespace type
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_CPP11_DEFINE_ARRAY_DECL_HPP
|
31
include/msgpack/v3/adaptor/detail/cpp11_define_map_decl.hpp
Normal file
31
include/msgpack/v3/adaptor/detail/cpp11_define_map_decl.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_CPP11_DEFINE_MAP_DECL_HPP
|
||||
#define MSGPACK_V3_CPP11_DEFINE_MAP_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/detail/cpp11_define_map_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
namespace type {
|
||||
|
||||
using v2::type::define_map_imp;
|
||||
using v2::type::define_map;
|
||||
using v2::type::make_define_map;
|
||||
|
||||
} // namespace type
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_CPP11_DEFINE_MAP_DECL_HPP
|
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_CPP11_MSGPACK_TUPLE_DECL_HPP
|
||||
#define MSGPACK_V3_CPP11_MSGPACK_TUPLE_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/detail/cpp11_msgpack_tuple_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
|
||||
using v2::type::get;
|
||||
using v2::type::tuple_size;
|
||||
using v2::type::tuple_element;
|
||||
using v2::type::uses_allocator;
|
||||
using v2::type::ignore;
|
||||
using v2::type::swap;
|
||||
|
||||
using v2::type::tuple;
|
||||
|
||||
using v2::type::make_tuple;
|
||||
using v2::type::forward_as_tuple;
|
||||
using v2::type::tuple_cat;
|
||||
using v2::type::tie;
|
||||
|
||||
} // namespace type
|
||||
|
||||
// --- Pack from tuple to packer stream ---
|
||||
|
||||
using v2::MsgpackTuplePacker;
|
||||
|
||||
// --- Convert from tuple to object ---
|
||||
using v2::MsgpackTupleAs;
|
||||
|
||||
using v2::MsgpackTupleAsImpl;
|
||||
|
||||
using v2::MsgpackTupleConverter;
|
||||
|
||||
// --- Convert from tuple to object with zone ---
|
||||
using v2::MsgpackTupleToObjectWithZone;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
///@endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_CPP11_MSGPACK_TUPLE_DECL_HPP
|
34
include/msgpack/v3/adaptor/ext_decl.hpp
Normal file
34
include/msgpack/v3/adaptor/ext_decl.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_TYPE_EXT_DECL_HPP
|
||||
#define MSGPACK_V3_TYPE_EXT_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/ext_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
|
||||
using v2::type::ext_ref;
|
||||
using v2::type::ext;
|
||||
|
||||
} // namespace type
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_TYPE_EXT_DECL_HPP
|
43
include/msgpack/v3/adaptor/fixint_decl.hpp
Normal file
43
include/msgpack/v3/adaptor/fixint_decl.hpp
Normal file
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 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_V3_TYPE_FIXINT_DECL_HPP
|
||||
#define MSGPACK_V3_TYPE_FIXINT_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/fixint_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
|
||||
using v2::type::fix_int;
|
||||
|
||||
using v2::type::fix_uint8;
|
||||
using v2::type::fix_uint16;
|
||||
using v2::type::fix_uint32;
|
||||
using v2::type::fix_uint64;
|
||||
|
||||
using v2::type::fix_int8;
|
||||
using v2::type::fix_int16;
|
||||
using v2::type::fix_int32;
|
||||
using v2::type::fix_int64;
|
||||
|
||||
} // namespace type
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_TYPE_FIXINT_DECL_HPP
|
54
include/msgpack/v3/adaptor/int_decl.hpp
Normal file
54
include/msgpack/v3/adaptor/int_decl.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 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_V3_TYPE_INT_DECL_HPP
|
||||
#define MSGPACK_V3_TYPE_INT_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/int_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3){
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
namespace detail {
|
||||
|
||||
|
||||
template <typename T, bool Signed>
|
||||
struct convert_integer_sign;
|
||||
|
||||
template <typename T>
|
||||
struct is_signed;
|
||||
|
||||
|
||||
template <bool Signed>
|
||||
struct object_char_sign;
|
||||
|
||||
//using v2::type::detail::convert_integer_sign;
|
||||
|
||||
//using v2::type::detail::is_signed;
|
||||
|
||||
using v2::type::detail::convert_integer;
|
||||
|
||||
//using v2::type::detail::object_char_sign;
|
||||
|
||||
using v2::type::detail::object_char;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace type
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_TYPE_INT_DECL_HPP
|
33
include/msgpack/v3/adaptor/map_decl.hpp
Normal file
33
include/msgpack/v3/adaptor/map_decl.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_TYPE_MAP_DECL_HPP
|
||||
#define MSGPACK_V3_TYPE_MAP_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/map_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
|
||||
using v2::type::assoc_vector;
|
||||
|
||||
} //namespace type
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_TYPE_MAP_DECL_HPP
|
21
include/msgpack/v3/adaptor/msgpack_tuple_decl.hpp
Normal file
21
include/msgpack/v3/adaptor/msgpack_tuple_decl.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// 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_V3_MSGPACK_TUPLE_DECL_HPP
|
||||
#define MSGPACK_V3_MSGPACK_TUPLE_DECL_HPP
|
||||
|
||||
#include "msgpack/cpp_config.hpp"
|
||||
|
||||
#if defined(MSGPACK_USE_CPP03)
|
||||
#include "msgpack/v3/adaptor/detail/cpp03_msgpack_tuple_decl.hpp"
|
||||
#else // MSGPACK_USE_CPP03
|
||||
#include "msgpack/v3/adaptor/detail/cpp11_msgpack_tuple_decl.hpp"
|
||||
#endif // MSGPACK_USE_CPP03
|
||||
|
||||
#endif // MSGPACK_V3_MSGPACK_TUPLE_DECL_HPP
|
42
include/msgpack/v3/adaptor/nil_decl.hpp
Normal file
42
include/msgpack/v3/adaptor/nil_decl.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// 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_V3_TYPE_NIL_DECL_HPP
|
||||
#define MSGPACK_V3_TYPE_NIL_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/nil_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
|
||||
using v2::type::nil_t;
|
||||
|
||||
#if defined(MSGPACK_USE_LEGACY_NIL)
|
||||
|
||||
typedef nil_t nil;
|
||||
|
||||
#endif // defined(MSGPACK_USE_LEGACY_NIL)
|
||||
|
||||
using v2::type::operator<;
|
||||
using v2::type::operator==;
|
||||
|
||||
} // namespace type
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_TYPE_NIL_DECL_HPP
|
33
include/msgpack/v3/adaptor/raw_decl.hpp
Normal file
33
include/msgpack/v3/adaptor/raw_decl.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_TYPE_RAW_DECL_HPP
|
||||
#define MSGPACK_V3_TYPE_RAW_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/raw_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
|
||||
using v2::type::raw_ref;
|
||||
|
||||
} // namespace type
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_TYPE_RAW_DECL_HPP
|
35
include/msgpack/v3/adaptor/size_equal_only_decl.hpp
Normal file
35
include/msgpack/v3/adaptor/size_equal_only_decl.hpp
Normal file
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_TYPE_SIZE_EQUAL_ONLY_DECL_HPP
|
||||
#define MSGPACK_V3_TYPE_SIZE_EQUAL_ONLY_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/adaptor/size_equal_only_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
|
||||
using v2::type::size_equal_only;
|
||||
using v2::type::make_size_equal_only;
|
||||
using v2::type::size;
|
||||
|
||||
} // namespace type
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_TYPE_SIZE_EQUAL_ONLY_DECL_HPP
|
34
include/msgpack/v3/adaptor/v4raw_decl.hpp
Normal file
34
include/msgpack/v3/adaptor/v4raw_decl.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_TYPE_V4RAW_DECL_HPP
|
||||
#define MSGPACK_V3_TYPE_V4RAW_DECL_HPP
|
||||
|
||||
#include "msgpack/versioning.hpp"
|
||||
#include "msgpack/adaptor/adaptor_base.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
|
||||
using v2::type::v4raw_ref;
|
||||
|
||||
} // namespace type
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_TYPE_V4RAW_DECL_HPP
|
84
include/msgpack/v3/cpp_config_decl.hpp
Normal file
84
include/msgpack/v3/cpp_config_decl.hpp
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// MessagePack for C++ C++03/C++11 Adaptation
|
||||
//
|
||||
// Copyright (C) 2018 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_V3_CPP_CONFIG_DECL_HPP
|
||||
#define MSGPACK_V3_CPP_CONFIG_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/cpp_config_decl.hpp"
|
||||
|
||||
#if defined(MSGPACK_USE_CPP03)
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::unique_ptr;
|
||||
|
||||
using v2::move;
|
||||
|
||||
using v2::enable_if;
|
||||
|
||||
using v2::integral_constant;
|
||||
|
||||
using v2::is_same;
|
||||
|
||||
using v2::underlying_type;
|
||||
|
||||
using v2::is_array;
|
||||
|
||||
using v2::remove_const;
|
||||
using v2::remove_volatile;
|
||||
using v2::remove_cv;
|
||||
|
||||
using v2::is_pointer;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#else // MSGPACK_USE_CPP03
|
||||
|
||||
namespace msgpack {
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
// unique_ptr
|
||||
using v2::unique_ptr;
|
||||
// using v2::make_unique; // since C++14
|
||||
using v2::hash;
|
||||
|
||||
// utility
|
||||
using v2::move;
|
||||
using v2::swap;
|
||||
using v2::enable_if;
|
||||
using v2::is_same;
|
||||
using v2::underlying_type;
|
||||
using v2::is_array;
|
||||
|
||||
using v2::remove_const;
|
||||
using v2::remove_volatile;
|
||||
using v2::remove_cv;
|
||||
|
||||
using v2::is_pointer;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#endif // MSGPACK_USE_CPP03
|
||||
|
||||
#endif // MSGPACK_V3_CPP_CONFIG_DECL_HPP
|
33
include/msgpack/v3/create_object_visitor_decl.hpp
Normal file
33
include/msgpack/v3/create_object_visitor_decl.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_V3_CREATE_OBJECT_VISITOR_DECL_HPP
|
||||
#define MSGPACK_V3_CREATE_OBJECT_VISITOR_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/create_object_visitor_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace detail {
|
||||
|
||||
using v2::detail::create_object_visitor;
|
||||
|
||||
} // detail
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_CREATE_OBJECT_VISITOR_DECL_HPP
|
31
include/msgpack/v3/detail/cpp03_zone_decl.hpp
Normal file
31
include/msgpack/v3/detail/cpp03_zone_decl.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// MessagePack for C++ memory pool
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_CPP03_ZONE_DECL_HPP
|
||||
#define MSGPACK_V3_CPP03_ZONE_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/detail/cpp03_zone_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::zone;
|
||||
|
||||
using v2::aligned_size;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_CPP03_ZONE_DECL_HPP
|
31
include/msgpack/v3/detail/cpp11_zone_decl.hpp
Normal file
31
include/msgpack/v3/detail/cpp11_zone_decl.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// MessagePack for C++ memory pool
|
||||
//
|
||||
// Copyright (C) 2016 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_V3_CPP11_ZONE_DECL_HPP
|
||||
#define MSGPACK_V3_CPP11_ZONE_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/zone_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::zone;
|
||||
|
||||
using v2::aligned_size;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_CPP11_ZONE_DECL_HPP
|
32
include/msgpack/v3/fbuffer_decl.hpp
Normal file
32
include/msgpack/v3/fbuffer_decl.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// MessagePack for C++ FILE* buffer adaptor
|
||||
//
|
||||
// Copyright (C) 2013-2018 Vladimir Volodko 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_V3_FBUFFER_DECL_HPP
|
||||
#define MSGPACK_V3_FBUFFER_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/fbuffer_decl.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::fbuffer;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_FBUFFER_DECL_HPP
|
33
include/msgpack/v3/iterator_decl.hpp
Normal file
33
include/msgpack/v3/iterator_decl.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2018 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_V3_ITERATOR_DECL_HPP
|
||||
#define MSGPACK_V3_ITERATOR_DECL_HPP
|
||||
#if !defined(MSGPACK_USE_CPP03)
|
||||
|
||||
#include <msgpack/v2/iterator_decl.hpp>
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::begin;
|
||||
using v2::end;
|
||||
|
||||
/// @cond
|
||||
}
|
||||
/// @endcond
|
||||
|
||||
}
|
||||
|
||||
#endif // !defined(MSGPACK_USE_CPP03)
|
||||
#endif // MSGPACK_V3_ITERATOR_DECL_HPP
|
50
include/msgpack/v3/meta_decl.hpp
Normal file
50
include/msgpack/v3/meta_decl.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2015-2018 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_V3_META_DECL_HPP
|
||||
#define MSGPACK_V3_META_DECL_HPP
|
||||
|
||||
#if !defined(MSGPACK_USE_CPP03)
|
||||
|
||||
#include "msgpack/v2/meta_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace detail {
|
||||
|
||||
using v2::detail::bool_pack;
|
||||
|
||||
using v2::detail::all_of_imp;
|
||||
|
||||
using v2::detail::any_of_imp;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
using v2::all_of;
|
||||
|
||||
using v2::any_of;
|
||||
|
||||
using v2::seq;
|
||||
|
||||
using v2::gen_seq;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // !defined(MSGPACK_USE_CPP03)
|
||||
|
||||
#endif // MSGPACK_V3_META_DECL_HPP
|
29
include/msgpack/v3/null_visitor_decl.hpp
Normal file
29
include/msgpack/v3/null_visitor_decl.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2017 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_V3_NULL_VISITOR_DECL_HPP
|
||||
#define MSGPACK_V3_NULL_VISITOR_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/null_visitor_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::null_visitor;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_NULL_VISITOR_DECL_HPP
|
49
include/msgpack/v3/object_decl.hpp
Normal file
49
include/msgpack/v3/object_decl.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2018 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_V3_OBJECT_DECL_HPP
|
||||
#define MSGPACK_V3_OBJECT_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/object_decl.hpp"
|
||||
#include "msgpack/adaptor/adaptor_base.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::object_handle;
|
||||
|
||||
namespace detail {
|
||||
|
||||
using v2::detail::add_ext_type_size;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
using v2::aligned_zone_size;
|
||||
|
||||
using v2::clone;
|
||||
|
||||
namespace detail {
|
||||
|
||||
using v2::detail::packer_serializer;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
using v2::operator==;
|
||||
using v2::operator!=;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_OBJECT_DECL_HPP
|
70
include/msgpack/v3/object_fwd.hpp
Normal file
70
include/msgpack/v3/object_fwd.hpp
Normal file
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2008-2018 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_V3_OBJECT_FWD_HPP
|
||||
#define MSGPACK_V3_OBJECT_FWD_HPP
|
||||
|
||||
#include "msgpack/v3/object_fwd_decl.hpp"
|
||||
#include "msgpack/object_fwd.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
#if !defined(MSGPACK_USE_CPP03)
|
||||
|
||||
namespace adaptor {
|
||||
|
||||
// If v2 has as specialization for T, then dispatch v2::adaptor::as<T>.
|
||||
// So I call v2::has_as<T> meta function intentionally.
|
||||
template <typename T>
|
||||
struct as<T, typename std::enable_if<v2::has_as<T>::value>::type> : v2::adaptor::as<T> {
|
||||
};
|
||||
|
||||
} // namespace adaptor
|
||||
|
||||
template <typename T>
|
||||
struct has_as {
|
||||
private:
|
||||
template <typename U>
|
||||
static auto check(U*) ->
|
||||
typename std::enable_if<
|
||||
// check v3 specialization
|
||||
std::is_same<
|
||||
decltype(adaptor::as<U>()(std::declval<msgpack::object>())),
|
||||
U
|
||||
>::value
|
||||
||
|
||||
// check v2 specialization
|
||||
v2::has_as<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(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_OBJECT_FWD_HPP
|
75
include/msgpack/v3/object_fwd_decl.hpp
Normal file
75
include/msgpack/v3/object_fwd_decl.hpp
Normal file
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2008-2018 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_V3_OBJECT_FWD_DECL_HPP
|
||||
#define MSGPACK_V3_OBJECT_FWD_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/object_fwd_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace type {
|
||||
using v2::type::object_type;
|
||||
using v2::type::NIL;
|
||||
using v2::type::BOOLEAN;
|
||||
using v2::type::POSITIVE_INTEGER;
|
||||
using v2::type::NEGATIVE_INTEGER;
|
||||
using v2::type::FLOAT32;
|
||||
using v2::type::FLOAT64;
|
||||
using v2::type::FLOAT;
|
||||
#if defined(MSGPACK_USE_LEGACY_NAME_AS_FLOAT)
|
||||
using v2::type::DOUBLE;
|
||||
#endif // MSGPACK_USE_LEGACY_NAME_AS_FLOAT
|
||||
using v2::type::STR;
|
||||
using v2::type::BIN;
|
||||
using v2::type::ARRAY;
|
||||
using v2::type::MAP;
|
||||
using v2::type::EXT;
|
||||
} // namespace type
|
||||
|
||||
using v2::object;
|
||||
|
||||
using v2::object_kv;
|
||||
|
||||
using v2::object_array;
|
||||
using v2::object_map;
|
||||
|
||||
using v2::object_str;
|
||||
using v2::object_bin;
|
||||
using v2::object_ext;
|
||||
|
||||
using v2::type_error;
|
||||
|
||||
|
||||
#if !defined(MSGPACK_USE_CPP03)
|
||||
|
||||
namespace adaptor {
|
||||
|
||||
template <typename T, typename Enabler = void>
|
||||
struct as;
|
||||
|
||||
} // namespace adaptor
|
||||
|
||||
template <typename T>
|
||||
struct has_as;
|
||||
|
||||
#endif // !defined(MSGPACK_USE_CPP03)
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_OBJECT_FWD_DECL_HPP
|
55
include/msgpack/v3/pack_decl.hpp
Normal file
55
include/msgpack/v3/pack_decl.hpp
Normal file
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// MessagePack for C++ serializing routine
|
||||
//
|
||||
// Copyright (C) 2008-2018 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_V3_PACK_DECL_HPP
|
||||
#define MSGPACK_V3_PACK_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/pack_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::packer;
|
||||
|
||||
using v2::pack;
|
||||
|
||||
#if MSGPACK_ENDIAN_LITTLE_BYTE
|
||||
|
||||
using v2::take8_8;
|
||||
|
||||
using v2::take8_16;
|
||||
|
||||
using v2::take8_32;
|
||||
|
||||
using v2::take8_64;
|
||||
|
||||
#elif MSGPACK_ENDIAN_BIG_BYTE
|
||||
|
||||
using v2::take8_8;
|
||||
|
||||
using v2::take8_16;
|
||||
|
||||
using v2::take8_32;
|
||||
|
||||
using v2::take8_64;
|
||||
|
||||
#else
|
||||
#error msgpack-c supports only big endian and little endian
|
||||
#endif
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_PACK_DECL_HPP
|
677
include/msgpack/v3/parse.hpp
Normal file
677
include/msgpack/v3/parse.hpp
Normal file
@@ -0,0 +1,677 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_V3_PARSE_HPP
|
||||
#define MSGPACK_V3_PARSE_HPP
|
||||
|
||||
#if MSGPACK_DEFAULT_API_VERSION >= 2
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "msgpack/parse_return.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename VisitorHolder>
|
||||
class context {
|
||||
public:
|
||||
context()
|
||||
:m_trail(0), m_cs(MSGPACK_CS_HEADER)
|
||||
{
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
m_cs = MSGPACK_CS_HEADER;
|
||||
m_trail = 0;
|
||||
m_stack.clear();
|
||||
holder().visitor().init();
|
||||
}
|
||||
|
||||
parse_return execute(const char* data, std::size_t len, std::size_t& off);
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
static uint32_t next_cs(T p)
|
||||
{
|
||||
return static_cast<uint32_t>(*p) & 0x1f;
|
||||
}
|
||||
|
||||
VisitorHolder& holder() {
|
||||
return static_cast<VisitorHolder&>(*this);
|
||||
}
|
||||
|
||||
template <typename T, typename StartVisitor, typename EndVisitor>
|
||||
parse_return start_aggregate(
|
||||
StartVisitor const& sv,
|
||||
EndVisitor const& ev,
|
||||
const char* load_pos,
|
||||
std::size_t& off) {
|
||||
typename value<T>::type size;
|
||||
load<T>(size, load_pos);
|
||||
if (size == 0) {
|
||||
if (!sv(size)) {
|
||||
off = m_current - m_start;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
if (!ev()) {
|
||||
off = m_current - m_start;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
parse_return ret = m_stack.consume(holder(), m_current);
|
||||
++m_current;
|
||||
if (ret != PARSE_CONTINUE) {
|
||||
off = m_current - m_start;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!sv(size)) {
|
||||
off = m_current - m_start;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
parse_return ret = m_stack.push(holder(), sv.type(), static_cast<uint32_t>(size));
|
||||
++m_current;
|
||||
if (ret != PARSE_CONTINUE) {
|
||||
off = m_current - m_start;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
m_cs = MSGPACK_CS_HEADER;
|
||||
return PARSE_CONTINUE;
|
||||
}
|
||||
|
||||
parse_return after_visit_proc(bool visit_result, std::size_t& off) {
|
||||
if (!visit_result) {
|
||||
off = m_current - m_start;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
parse_return ret = m_stack.consume(holder(), m_current);
|
||||
++m_current;
|
||||
if (ret != PARSE_CONTINUE) {
|
||||
off = m_current - m_start;
|
||||
}
|
||||
m_cs = MSGPACK_CS_HEADER;
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct array_sv {
|
||||
array_sv(VisitorHolder& visitor_holder):m_visitor_holder(visitor_holder) {}
|
||||
bool operator()(uint32_t size) const {
|
||||
return m_visitor_holder.visitor().start_array(size);
|
||||
}
|
||||
msgpack_container_type type() const { return MSGPACK_CT_ARRAY_ITEM; }
|
||||
private:
|
||||
VisitorHolder& m_visitor_holder;
|
||||
};
|
||||
struct array_ev {
|
||||
array_ev(VisitorHolder& visitor_holder):m_visitor_holder(visitor_holder) {}
|
||||
bool operator()() const {
|
||||
return m_visitor_holder.visitor().end_array();
|
||||
}
|
||||
private:
|
||||
VisitorHolder& m_visitor_holder;
|
||||
};
|
||||
struct map_sv {
|
||||
map_sv(VisitorHolder& visitor_holder):m_visitor_holder(visitor_holder) {}
|
||||
bool operator()(uint32_t size) const {
|
||||
return m_visitor_holder.visitor().start_map(size);
|
||||
}
|
||||
msgpack_container_type type() const { return MSGPACK_CT_MAP_KEY; }
|
||||
private:
|
||||
VisitorHolder& m_visitor_holder;
|
||||
};
|
||||
struct map_ev {
|
||||
map_ev(VisitorHolder& visitor_holder):m_visitor_holder(visitor_holder) {}
|
||||
bool operator()() const {
|
||||
return m_visitor_holder.visitor().end_map();
|
||||
}
|
||||
private:
|
||||
VisitorHolder& m_visitor_holder;
|
||||
};
|
||||
|
||||
struct unpack_stack {
|
||||
struct stack_elem {
|
||||
stack_elem(msgpack_container_type type, uint32_t rest):m_type(type), m_rest(rest) {}
|
||||
msgpack_container_type m_type;
|
||||
uint32_t m_rest;
|
||||
};
|
||||
unpack_stack() {
|
||||
m_stack.reserve(MSGPACK_EMBED_STACK_SIZE);
|
||||
}
|
||||
parse_return push(VisitorHolder& visitor_holder, msgpack_container_type type, uint32_t rest) {
|
||||
m_stack.push_back(stack_elem(type, rest));
|
||||
switch (type) {
|
||||
case MSGPACK_CT_ARRAY_ITEM:
|
||||
return visitor_holder.visitor().start_array_item() ? PARSE_CONTINUE : PARSE_STOP_VISITOR;
|
||||
case MSGPACK_CT_MAP_KEY:
|
||||
return visitor_holder.visitor().start_map_key() ? PARSE_CONTINUE : PARSE_STOP_VISITOR;
|
||||
case MSGPACK_CT_MAP_VALUE:
|
||||
assert(0);
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
assert(0);
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
parse_return consume(VisitorHolder& visitor_holder, char const*& current) {
|
||||
while (!m_stack.empty()) {
|
||||
stack_elem& e = m_stack.back();
|
||||
switch (e.m_type) {
|
||||
case MSGPACK_CT_ARRAY_ITEM:
|
||||
if (!visitor_holder.visitor().end_array_item()) {
|
||||
--current;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
if (--e.m_rest == 0) {
|
||||
m_stack.pop_back();
|
||||
if (!visitor_holder.visitor().end_array()) {
|
||||
--current;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!visitor_holder.visitor().start_array_item()) return PARSE_STOP_VISITOR;
|
||||
return PARSE_CONTINUE;
|
||||
}
|
||||
break;
|
||||
case MSGPACK_CT_MAP_KEY:
|
||||
if (!visitor_holder.visitor().end_map_key()) {
|
||||
--current;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
if (!visitor_holder.visitor().start_map_value()) return PARSE_STOP_VISITOR;
|
||||
e.m_type = MSGPACK_CT_MAP_VALUE;
|
||||
return PARSE_CONTINUE;
|
||||
case MSGPACK_CT_MAP_VALUE:
|
||||
if (!visitor_holder.visitor().end_map_value()) {
|
||||
--current;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
if (--e.m_rest == 0) {
|
||||
m_stack.pop_back();
|
||||
if (!visitor_holder.visitor().end_map()) {
|
||||
--current;
|
||||
return PARSE_STOP_VISITOR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
e.m_type = MSGPACK_CT_MAP_KEY;
|
||||
if (!visitor_holder.visitor().start_map_key()) return PARSE_STOP_VISITOR;
|
||||
return PARSE_CONTINUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return PARSE_SUCCESS;
|
||||
}
|
||||
bool empty() const { return m_stack.empty(); }
|
||||
void clear() { m_stack.clear(); }
|
||||
private:
|
||||
std::vector<stack_elem> m_stack;
|
||||
};
|
||||
|
||||
char const* m_start;
|
||||
char const* m_current;
|
||||
|
||||
std::size_t m_trail;
|
||||
uint32_t m_cs;
|
||||
uint32_t m_num_elements;
|
||||
unpack_stack m_stack;
|
||||
};
|
||||
|
||||
template <std::size_t N>
|
||||
inline void check_ext_size(std::size_t /*size*/) {
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void check_ext_size<4>(std::size_t size) {
|
||||
if (size == 0xffffffff) throw msgpack::ext_size_overflow("ext size overflow");
|
||||
}
|
||||
|
||||
template <typename VisitorHolder>
|
||||
inline parse_return context<VisitorHolder>::execute(const char* data, std::size_t len, std::size_t& off)
|
||||
{
|
||||
assert(len >= off);
|
||||
|
||||
m_start = data;
|
||||
m_current = data + off;
|
||||
const char* const pe = data + len;
|
||||
const char* n = MSGPACK_NULLPTR;
|
||||
|
||||
msgpack::object obj;
|
||||
|
||||
if(m_current == pe) {
|
||||
off = m_current - m_start;
|
||||
return PARSE_CONTINUE;
|
||||
}
|
||||
bool fixed_trail_again = false;
|
||||
do {
|
||||
if (m_cs == MSGPACK_CS_HEADER) {
|
||||
fixed_trail_again = false;
|
||||
int selector = *reinterpret_cast<const unsigned char*>(m_current);
|
||||
if (0x00 <= selector && selector <= 0x7f) { // Positive Fixnum
|
||||
uint8_t tmp = *reinterpret_cast<const uint8_t*>(m_current);
|
||||
bool visret = holder().visitor().visit_positive_integer(tmp);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} else if(0xe0 <= selector && selector <= 0xff) { // Negative Fixnum
|
||||
int8_t tmp = *reinterpret_cast<const int8_t*>(m_current);
|
||||
bool visret = holder().visitor().visit_negative_integer(tmp);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} else if (0xc4 <= selector && selector <= 0xdf) {
|
||||
const uint32_t trail[] = {
|
||||
1, // bin 8 0xc4
|
||||
2, // bin 16 0xc5
|
||||
4, // bin 32 0xc6
|
||||
1, // ext 8 0xc7
|
||||
2, // ext 16 0xc8
|
||||
4, // ext 32 0xc9
|
||||
4, // float 32 0xca
|
||||
8, // float 64 0xcb
|
||||
1, // uint 8 0xcc
|
||||
2, // uint 16 0xcd
|
||||
4, // uint 32 0xce
|
||||
8, // uint 64 0xcf
|
||||
1, // int 8 0xd0
|
||||
2, // int 16 0xd1
|
||||
4, // int 32 0xd2
|
||||
8, // int 64 0xd3
|
||||
2, // fixext 1 0xd4
|
||||
3, // fixext 2 0xd5
|
||||
5, // fixext 4 0xd6
|
||||
9, // fixext 8 0xd7
|
||||
17,// fixext 16 0xd8
|
||||
1, // str 8 0xd9
|
||||
2, // str 16 0xda
|
||||
4, // str 32 0xdb
|
||||
2, // array 16 0xdc
|
||||
4, // array 32 0xdd
|
||||
2, // map 16 0xde
|
||||
4, // map 32 0xdf
|
||||
};
|
||||
m_trail = trail[selector - 0xc4];
|
||||
m_cs = next_cs(m_current);
|
||||
fixed_trail_again = true;
|
||||
} else if(0xa0 <= selector && selector <= 0xbf) { // FixStr
|
||||
m_trail = static_cast<uint32_t>(*m_current) & 0x1f;
|
||||
if(m_trail == 0) {
|
||||
bool visret = holder().visitor().visit_str(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
}
|
||||
else {
|
||||
m_cs = MSGPACK_ACS_STR_VALUE;
|
||||
fixed_trail_again = true;
|
||||
}
|
||||
} else if(0x90 <= selector && selector <= 0x9f) { // FixArray
|
||||
parse_return ret = start_aggregate<fix_tag>(array_sv(holder()), array_ev(holder()), m_current, off);
|
||||
if (ret != PARSE_CONTINUE) return ret;
|
||||
} else if(0x80 <= selector && selector <= 0x8f) { // FixMap
|
||||
parse_return ret = start_aggregate<fix_tag>(map_sv(holder()), map_ev(holder()), m_current, off);
|
||||
if (ret != PARSE_CONTINUE) return ret;
|
||||
} else if(selector == 0xc2) { // false
|
||||
bool visret = holder().visitor().visit_boolean(false);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} else if(selector == 0xc3) { // true
|
||||
bool visret = holder().visitor().visit_boolean(true);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} else if(selector == 0xc0) { // nil
|
||||
bool visret = holder().visitor().visit_nil();
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} else {
|
||||
off = m_current - m_start;
|
||||
holder().visitor().parse_error(off - 1, off);
|
||||
return PARSE_PARSE_ERROR;
|
||||
}
|
||||
// end MSGPACK_CS_HEADER
|
||||
}
|
||||
if (m_cs != MSGPACK_CS_HEADER || fixed_trail_again) {
|
||||
if (fixed_trail_again) {
|
||||
++m_current;
|
||||
fixed_trail_again = false;
|
||||
}
|
||||
if(static_cast<std::size_t>(pe - m_current) < m_trail) {
|
||||
off = m_current - m_start;
|
||||
return PARSE_CONTINUE;
|
||||
}
|
||||
n = m_current;
|
||||
m_current += m_trail - 1;
|
||||
switch(m_cs) {
|
||||
//case MSGPACK_CS_
|
||||
//case MSGPACK_CS_
|
||||
case MSGPACK_CS_FLOAT: {
|
||||
union { uint32_t i; float f; } mem;
|
||||
load<uint32_t>(mem.i, n);
|
||||
bool visret = holder().visitor().visit_float32(mem.f);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_DOUBLE: {
|
||||
union { uint64_t i; double f; } mem;
|
||||
load<uint64_t>(mem.i, n);
|
||||
#if defined(TARGET_OS_IPHONE)
|
||||
// ok
|
||||
#elif defined(__arm__) && !(__ARM_EABI__) // arm-oabi
|
||||
// https://github.com/msgpack/msgpack-perl/pull/1
|
||||
mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
|
||||
#endif
|
||||
bool visret = holder().visitor().visit_float64(mem.f);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_UINT_8: {
|
||||
uint8_t tmp;
|
||||
load<uint8_t>(tmp, n);
|
||||
bool visret = holder().visitor().visit_positive_integer(tmp);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_UINT_16: {
|
||||
uint16_t tmp;
|
||||
load<uint16_t>(tmp, n);
|
||||
bool visret = holder().visitor().visit_positive_integer(tmp);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_UINT_32: {
|
||||
uint32_t tmp;
|
||||
load<uint32_t>(tmp, n);
|
||||
bool visret = holder().visitor().visit_positive_integer(tmp);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_UINT_64: {
|
||||
uint64_t tmp;
|
||||
load<uint64_t>(tmp, n);
|
||||
bool visret = holder().visitor().visit_positive_integer(tmp);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_INT_8: {
|
||||
int8_t tmp;
|
||||
load<int8_t>(tmp, n);
|
||||
bool visret = holder().visitor().visit_negative_integer(tmp);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_INT_16: {
|
||||
int16_t tmp;
|
||||
load<int16_t>(tmp, n);
|
||||
bool visret = holder().visitor().visit_negative_integer(tmp);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_INT_32: {
|
||||
int32_t tmp;
|
||||
load<int32_t>(tmp, n);
|
||||
bool visret = holder().visitor().visit_negative_integer(tmp);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_INT_64: {
|
||||
int64_t tmp;
|
||||
load<int64_t>(tmp, n);
|
||||
bool visret = holder().visitor().visit_negative_integer(tmp);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_FIXEXT_1: {
|
||||
bool visret = holder().visitor().visit_ext(n, 1+1);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_FIXEXT_2: {
|
||||
bool visret = holder().visitor().visit_ext(n, 2+1);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_FIXEXT_4: {
|
||||
bool visret = holder().visitor().visit_ext(n, 4+1);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_FIXEXT_8: {
|
||||
bool visret = holder().visitor().visit_ext(n, 8+1);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_FIXEXT_16: {
|
||||
bool visret = holder().visitor().visit_ext(n, 16+1);
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_STR_8: {
|
||||
uint8_t tmp;
|
||||
load<uint8_t>(tmp, n);
|
||||
m_trail = tmp;
|
||||
if(m_trail == 0) {
|
||||
bool visret = holder().visitor().visit_str(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
}
|
||||
else {
|
||||
m_cs = MSGPACK_ACS_STR_VALUE;
|
||||
fixed_trail_again = true;
|
||||
}
|
||||
} break;
|
||||
case MSGPACK_CS_BIN_8: {
|
||||
uint8_t tmp;
|
||||
load<uint8_t>(tmp, n);
|
||||
m_trail = tmp;
|
||||
if(m_trail == 0) {
|
||||
bool visret = holder().visitor().visit_bin(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
}
|
||||
else {
|
||||
m_cs = MSGPACK_ACS_BIN_VALUE;
|
||||
fixed_trail_again = true;
|
||||
}
|
||||
} break;
|
||||
case MSGPACK_CS_EXT_8: {
|
||||
uint8_t tmp;
|
||||
load<uint8_t>(tmp, n);
|
||||
m_trail = tmp + 1;
|
||||
if(m_trail == 0) {
|
||||
bool visret = holder().visitor().visit_ext(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
}
|
||||
else {
|
||||
m_cs = MSGPACK_ACS_EXT_VALUE;
|
||||
fixed_trail_again = true;
|
||||
}
|
||||
} break;
|
||||
case MSGPACK_CS_STR_16: {
|
||||
uint16_t tmp;
|
||||
load<uint16_t>(tmp, n);
|
||||
m_trail = tmp;
|
||||
if(m_trail == 0) {
|
||||
bool visret = holder().visitor().visit_str(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
}
|
||||
else {
|
||||
m_cs = MSGPACK_ACS_STR_VALUE;
|
||||
fixed_trail_again = true;
|
||||
}
|
||||
} break;
|
||||
case MSGPACK_CS_BIN_16: {
|
||||
uint16_t tmp;
|
||||
load<uint16_t>(tmp, n);
|
||||
m_trail = tmp;
|
||||
if(m_trail == 0) {
|
||||
bool visret = holder().visitor().visit_bin(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
}
|
||||
else {
|
||||
m_cs = MSGPACK_ACS_BIN_VALUE;
|
||||
fixed_trail_again = true;
|
||||
}
|
||||
} break;
|
||||
case MSGPACK_CS_EXT_16: {
|
||||
uint16_t tmp;
|
||||
load<uint16_t>(tmp, n);
|
||||
m_trail = tmp + 1;
|
||||
if(m_trail == 0) {
|
||||
bool visret = holder().visitor().visit_ext(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
}
|
||||
else {
|
||||
m_cs = MSGPACK_ACS_EXT_VALUE;
|
||||
fixed_trail_again = true;
|
||||
}
|
||||
} break;
|
||||
case MSGPACK_CS_STR_32: {
|
||||
uint32_t tmp;
|
||||
load<uint32_t>(tmp, n);
|
||||
m_trail = tmp;
|
||||
if(m_trail == 0) {
|
||||
bool visret = holder().visitor().visit_str(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
}
|
||||
else {
|
||||
m_cs = MSGPACK_ACS_STR_VALUE;
|
||||
fixed_trail_again = true;
|
||||
}
|
||||
} break;
|
||||
case MSGPACK_CS_BIN_32: {
|
||||
uint32_t tmp;
|
||||
load<uint32_t>(tmp, n);
|
||||
m_trail = tmp;
|
||||
if(m_trail == 0) {
|
||||
bool visret = holder().visitor().visit_bin(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
}
|
||||
else {
|
||||
m_cs = MSGPACK_ACS_BIN_VALUE;
|
||||
fixed_trail_again = true;
|
||||
}
|
||||
} break;
|
||||
case MSGPACK_CS_EXT_32: {
|
||||
uint32_t tmp;
|
||||
load<uint32_t>(tmp, n);
|
||||
check_ext_size<sizeof(std::size_t)>(tmp);
|
||||
m_trail = tmp;
|
||||
++m_trail;
|
||||
if(m_trail == 0) {
|
||||
bool visret = holder().visitor().visit_ext(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
}
|
||||
else {
|
||||
m_cs = MSGPACK_ACS_EXT_VALUE;
|
||||
fixed_trail_again = true;
|
||||
}
|
||||
} break;
|
||||
case MSGPACK_ACS_STR_VALUE: {
|
||||
bool visret = holder().visitor().visit_str(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_ACS_BIN_VALUE: {
|
||||
bool visret = holder().visitor().visit_bin(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_ACS_EXT_VALUE: {
|
||||
bool visret = holder().visitor().visit_ext(n, static_cast<uint32_t>(m_trail));
|
||||
parse_return upr = after_visit_proc(visret, off);
|
||||
if (upr != PARSE_CONTINUE) return upr;
|
||||
} break;
|
||||
case MSGPACK_CS_ARRAY_16: {
|
||||
parse_return ret = start_aggregate<uint16_t>(array_sv(holder()), array_ev(holder()), n, off);
|
||||
if (ret != PARSE_CONTINUE) return ret;
|
||||
|
||||
} break;
|
||||
case MSGPACK_CS_ARRAY_32: {
|
||||
parse_return ret = start_aggregate<uint32_t>(array_sv(holder()), array_ev(holder()), n, off);
|
||||
if (ret != PARSE_CONTINUE) return ret;
|
||||
} break;
|
||||
case MSGPACK_CS_MAP_16: {
|
||||
parse_return ret = start_aggregate<uint16_t>(map_sv(holder()), map_ev(holder()), n, off);
|
||||
if (ret != PARSE_CONTINUE) return ret;
|
||||
} break;
|
||||
case MSGPACK_CS_MAP_32: {
|
||||
parse_return ret = start_aggregate<uint32_t>(map_sv(holder()), map_ev(holder()), n, off);
|
||||
if (ret != PARSE_CONTINUE) return ret;
|
||||
} break;
|
||||
default:
|
||||
off = m_current - m_start;
|
||||
holder().visitor().parse_error(n - m_start - 1, n - m_start);
|
||||
return PARSE_PARSE_ERROR;
|
||||
}
|
||||
}
|
||||
} while(m_current != pe);
|
||||
|
||||
off = m_current - m_start;
|
||||
return PARSE_CONTINUE;
|
||||
}
|
||||
|
||||
template <typename Visitor>
|
||||
struct parse_helper : detail::context<parse_helper<Visitor> > {
|
||||
parse_helper(Visitor& v):m_visitor(v) {}
|
||||
parse_return execute(const char* data, std::size_t len, std::size_t& off) {
|
||||
return detail::context<parse_helper<Visitor> >::execute(data, len, off);
|
||||
}
|
||||
Visitor& visitor() const { return m_visitor; }
|
||||
Visitor& m_visitor;
|
||||
};
|
||||
|
||||
template <typename Visitor>
|
||||
inline parse_return
|
||||
parse_imp(const char* data, size_t len, size_t& off, Visitor& v) {
|
||||
std::size_t noff = off;
|
||||
if(len <= noff) {
|
||||
// FIXME
|
||||
v.insufficient_bytes(noff, noff);
|
||||
return PARSE_CONTINUE;
|
||||
}
|
||||
detail::parse_helper<Visitor> h(v);
|
||||
parse_return ret = h.execute(data, len, noff);
|
||||
off = noff;
|
||||
switch (ret) {
|
||||
case PARSE_CONTINUE:
|
||||
v.insufficient_bytes(noff - 1, noff);
|
||||
return ret;
|
||||
case PARSE_SUCCESS:
|
||||
if(noff < len) {
|
||||
return PARSE_EXTRA_BYTES;
|
||||
}
|
||||
return ret;
|
||||
default:
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
} // detail
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_DEFAULT_API_VERSION >= 2
|
||||
|
||||
#endif // MSGPACK_V3_PARSE_HPP
|
49
include/msgpack/v3/parse_decl.hpp
Normal file
49
include/msgpack/v3/parse_decl.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018-2017 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_V3_PARSE_DECL_HPP
|
||||
#define MSGPACK_V3_PARSE_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/parse_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename VisitorHolder>
|
||||
class context;
|
||||
|
||||
} // detail
|
||||
|
||||
using v2::parser;
|
||||
using v2::parse;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename Visitor>
|
||||
struct parse_helper;
|
||||
|
||||
template <typename Visitor>
|
||||
inline parse_return
|
||||
parse_imp(const char* data, size_t len, size_t& off, Visitor& v);
|
||||
|
||||
} // detail
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#endif // MSGPACK_V3_PARSE_DECL_HPP
|
35
include/msgpack/v3/parse_return.hpp
Normal file
35
include/msgpack/v3/parse_return.hpp
Normal file
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2008-2018 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_V3_PARSE_RETURN_HPP
|
||||
#define MSGPACK_V3_PARSE_RETURN_HPP
|
||||
|
||||
#include "msgpack/v2/parse_return.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::parse_return;
|
||||
|
||||
using v2::PARSE_SUCCESS;
|
||||
using v2::PARSE_EXTRA_BYTES;
|
||||
using v2::PARSE_CONTINUE;
|
||||
using v2::PARSE_PARSE_ERROR;
|
||||
using v2::PARSE_STOP_VISITOR;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_PARSE_RETURN_HPP
|
33
include/msgpack/v3/sbuffer_decl.hpp
Normal file
33
include/msgpack/v3/sbuffer_decl.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// MessagePack for C++ simple buffer implementation
|
||||
//
|
||||
// Copyright (C) 2018 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_V3_SBUFFER_DECL_HPP
|
||||
#define MSGPACK_V3_SBUFFER_DECL_HPP
|
||||
|
||||
#include "msgpack/versioning.hpp"
|
||||
|
||||
#ifndef MSGPACK_SBUFFER_INIT_SIZE
|
||||
#define MSGPACK_SBUFFER_INIT_SIZE 8192
|
||||
#endif
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::sbuffer;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_SBUFFER_DECL_HPP
|
192
include/msgpack/v3/unpack.hpp
Normal file
192
include/msgpack/v3/unpack.hpp
Normal file
@@ -0,0 +1,192 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_V3_UNPACK_HPP
|
||||
#define MSGPACK_V3_UNPACK_HPP
|
||||
|
||||
#include "msgpack/unpack_decl.hpp"
|
||||
#include "msgpack/parse.hpp"
|
||||
#include "msgpack/create_object_visitor.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
inline msgpack::object_handle unpack(
|
||||
const char* data, std::size_t len, std::size_t& off, bool& referenced,
|
||||
msgpack::unpack_reference_func f, void* user_data,
|
||||
msgpack::unpack_limit const& limit
|
||||
)
|
||||
{
|
||||
msgpack::object obj;
|
||||
msgpack::unique_ptr<msgpack::zone> z(new msgpack::zone);
|
||||
referenced = false;
|
||||
parse_return ret = detail::unpack_imp(
|
||||
data, len, off, *z, obj, referenced, f, user_data, limit);
|
||||
|
||||
switch(ret) {
|
||||
case msgpack::PARSE_SUCCESS:
|
||||
return msgpack::object_handle(obj, msgpack::move(z));
|
||||
case msgpack::PARSE_EXTRA_BYTES:
|
||||
return msgpack::object_handle(obj, msgpack::move(z));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return msgpack::object_handle();
|
||||
}
|
||||
|
||||
inline msgpack::object_handle unpack(
|
||||
const char* data, std::size_t len, std::size_t& off,
|
||||
msgpack::unpack_reference_func f, void* user_data,
|
||||
msgpack::unpack_limit const& limit)
|
||||
{
|
||||
bool referenced;
|
||||
return msgpack::v3::unpack(data, len, off, referenced, f, user_data, limit);
|
||||
}
|
||||
|
||||
inline msgpack::object_handle unpack(
|
||||
const char* data, std::size_t len, bool& referenced,
|
||||
msgpack::unpack_reference_func f, void* user_data,
|
||||
msgpack::unpack_limit const& limit)
|
||||
{
|
||||
std::size_t off = 0;
|
||||
return msgpack::v3::unpack(data, len, off, referenced, f, user_data, limit);
|
||||
}
|
||||
|
||||
inline msgpack::object_handle unpack(
|
||||
const char* data, std::size_t len,
|
||||
msgpack::unpack_reference_func f, void* user_data,
|
||||
msgpack::unpack_limit const& limit)
|
||||
{
|
||||
bool referenced;
|
||||
std::size_t off = 0;
|
||||
return msgpack::v3::unpack(data, len, off, referenced, f, user_data, limit);
|
||||
}
|
||||
|
||||
inline void unpack(
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len, std::size_t& off, bool& referenced,
|
||||
msgpack::unpack_reference_func f, void* user_data,
|
||||
msgpack::unpack_limit const& limit)
|
||||
{
|
||||
msgpack::object obj;
|
||||
msgpack::unique_ptr<msgpack::zone> z(new msgpack::zone);
|
||||
referenced = false;
|
||||
parse_return ret = detail::unpack_imp(
|
||||
data, len, off, *z, obj, referenced, f, user_data, limit);
|
||||
|
||||
switch(ret) {
|
||||
case msgpack::PARSE_SUCCESS:
|
||||
result.set(obj);
|
||||
result.zone() = msgpack::move(z);
|
||||
return;
|
||||
case msgpack::PARSE_EXTRA_BYTES:
|
||||
result.set(obj);
|
||||
result.zone() = msgpack::move(z);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
inline void unpack(
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len, std::size_t& off,
|
||||
msgpack::v3::unpack_reference_func f, void* user_data,
|
||||
msgpack::unpack_limit const& limit)
|
||||
{
|
||||
bool referenced;
|
||||
msgpack::v3::unpack(result, data, len, off, referenced, f, user_data, limit);
|
||||
}
|
||||
|
||||
inline void unpack(
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len, bool& referenced,
|
||||
msgpack::unpack_reference_func f, void* user_data,
|
||||
msgpack::unpack_limit const& limit)
|
||||
{
|
||||
std::size_t off = 0;
|
||||
msgpack::v3::unpack(result, data, len, off, referenced, f, user_data, limit);
|
||||
}
|
||||
|
||||
inline void unpack(
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len,
|
||||
msgpack::unpack_reference_func f, void* user_data,
|
||||
msgpack::unpack_limit const& limit)
|
||||
{
|
||||
bool referenced;
|
||||
std::size_t off = 0;
|
||||
msgpack::v3::unpack(result, data, len, off, referenced, f, user_data, limit);
|
||||
}
|
||||
|
||||
|
||||
inline msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
const char* data, std::size_t len, std::size_t& off, bool& referenced,
|
||||
msgpack::unpack_reference_func f, void* user_data,
|
||||
msgpack::unpack_limit const& limit)
|
||||
{
|
||||
msgpack::object obj;
|
||||
referenced = false;
|
||||
parse_return ret = detail::unpack_imp(
|
||||
data, len, off, z, obj, referenced, f, user_data, limit);
|
||||
|
||||
switch(ret) {
|
||||
case msgpack::PARSE_SUCCESS:
|
||||
return obj;
|
||||
case msgpack::PARSE_EXTRA_BYTES:
|
||||
return obj;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
inline msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
const char* data, std::size_t len, std::size_t& off,
|
||||
msgpack::unpack_reference_func f, void* user_data,
|
||||
msgpack::unpack_limit const& limit)
|
||||
{
|
||||
bool referenced;
|
||||
return msgpack::v3::unpack(z, data, len, off, referenced, f, user_data, limit);
|
||||
}
|
||||
|
||||
inline msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
const char* data, std::size_t len, bool& referenced,
|
||||
msgpack::unpack_reference_func f, void* user_data,
|
||||
msgpack::unpack_limit const& limit)
|
||||
{
|
||||
std::size_t off = 0;
|
||||
return msgpack::v3::unpack(z, data, len, off, referenced, f, user_data, limit);
|
||||
}
|
||||
|
||||
inline msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
const char* data, std::size_t len,
|
||||
msgpack::unpack_reference_func f, void* user_data,
|
||||
msgpack::unpack_limit const& limit)
|
||||
{
|
||||
bool referenced;
|
||||
std::size_t off = 0;
|
||||
return msgpack::v3::unpack(z, data, len, off, referenced, f, user_data, limit);
|
||||
}
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#endif // MSGPACK_V3_UNPACK_HPP
|
304
include/msgpack/v3/unpack_decl.hpp
Normal file
304
include/msgpack/v3/unpack_decl.hpp
Normal file
@@ -0,0 +1,304 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_V3_UNPACK_DECL_HPP
|
||||
#define MSGPACK_V3_UNPACK_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/unpack_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::unpack_reference_func;
|
||||
|
||||
using v2::unpack_error;
|
||||
using v2::parse_error;
|
||||
using v2::insufficient_bytes;
|
||||
using v2::size_overflow;
|
||||
using v2::array_size_overflow;
|
||||
using v2::map_size_overflow;
|
||||
using v2::str_size_overflow;
|
||||
using v2::bin_size_overflow;
|
||||
using v2::ext_size_overflow;
|
||||
using v2::depth_size_overflow;
|
||||
using v2::unpack_limit;
|
||||
|
||||
namespace detail {
|
||||
|
||||
using v2::detail::unpack_user;
|
||||
|
||||
using v2::detail::unpack_uint8;
|
||||
using v2::detail::unpack_uint16;
|
||||
using v2::detail::unpack_uint32;
|
||||
using v2::detail::unpack_uint64;
|
||||
|
||||
using v2::detail::unpack_int8;
|
||||
using v2::detail::unpack_int16;
|
||||
using v2::detail::unpack_int32;
|
||||
using v2::detail::unpack_int64;
|
||||
|
||||
using v2::detail::unpack_float;
|
||||
using v2::detail::unpack_double;
|
||||
|
||||
using v2::detail::unpack_nil;
|
||||
|
||||
using v2::detail::unpack_true;
|
||||
using v2::detail::unpack_false;
|
||||
|
||||
using v2::detail::unpack_array;
|
||||
using v2::detail::unpack_array_item;
|
||||
using v2::detail::unpack_map;
|
||||
using v2::detail::unpack_map_item;
|
||||
using v2::detail::unpack_str;
|
||||
using v2::detail::unpack_bin;
|
||||
using v2::detail::unpack_ext;
|
||||
|
||||
using v2::detail::unpack_stack;
|
||||
|
||||
using v2::detail::init_count;
|
||||
using v2::detail::decr_count;
|
||||
using v2::detail::incr_count;
|
||||
|
||||
using v2::detail::get_count;
|
||||
|
||||
using v2::detail::fix_tag;
|
||||
|
||||
using v2::detail::value;
|
||||
|
||||
using v2::detail::load;
|
||||
|
||||
} // detail
|
||||
|
||||
|
||||
using v2::unpacked;
|
||||
using v2::unpacker;
|
||||
using v2::basic_unpacker;
|
||||
|
||||
namespace detail {
|
||||
|
||||
using v2::detail::unpack_imp;
|
||||
|
||||
} // detail
|
||||
|
||||
/// Unpack msgpack::object from a buffer.
|
||||
/**
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param off The offset position of the buffer. It is read and overwritten.
|
||||
* @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
|
||||
* @param f A judging function that msgpack::object refer to the buffer.
|
||||
* @param user_data This parameter is passed to f.
|
||||
* @param limit The size limit information of msgpack::object.
|
||||
*
|
||||
* @return object_handle that contains unpacked data.
|
||||
*
|
||||
*/
|
||||
msgpack::object_handle unpack(
|
||||
const char* data, std::size_t len, std::size_t& off, bool& referenced,
|
||||
msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// Unpack msgpack::object from a buffer.
|
||||
/**
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param off The offset position of the buffer. It is read and overwritten.
|
||||
* @param f A judging function that msgpack::object refer to the buffer.
|
||||
* @param user_data This parameter is passed to f.
|
||||
* @param limit The size limit information of msgpack::object.
|
||||
*
|
||||
* @return object_handle that contains unpacked data.
|
||||
*
|
||||
*/
|
||||
msgpack::object_handle unpack(
|
||||
const char* data, std::size_t len, std::size_t& off,
|
||||
msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// Unpack msgpack::object from a buffer.
|
||||
/**
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
|
||||
* @param f A judging function that msgpack::object refer to the buffer.
|
||||
* @param user_data This parameter is passed to f.
|
||||
* @param limit The size limit information of msgpack::object.
|
||||
*
|
||||
* @return object_handle that contains unpacked data.
|
||||
*
|
||||
*/
|
||||
msgpack::object_handle unpack(
|
||||
const char* data, std::size_t len, bool& referenced,
|
||||
msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// Unpack msgpack::object from a buffer.
|
||||
/**
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param f A judging function that msgpack::object refer to the buffer.
|
||||
* @param user_data This parameter is passed to f.
|
||||
* @param limit The size limit information of msgpack::object.
|
||||
*
|
||||
* @return object_handle that contains unpacked data.
|
||||
*
|
||||
*/
|
||||
msgpack::object_handle unpack(
|
||||
const char* data, std::size_t len,
|
||||
msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
|
||||
|
||||
|
||||
/// Unpack msgpack::object from a buffer.
|
||||
/**
|
||||
* @param result The object_handle that contains unpacked data.
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param off The offset position of the buffer. It is read and overwritten.
|
||||
* @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
|
||||
* @param f A judging function that msgpack::object refer to the buffer.
|
||||
* @param user_data This parameter is passed to f.
|
||||
* @param limit The size limit information of msgpack::object.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void unpack(
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len, std::size_t& off, bool& referenced,
|
||||
msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// Unpack msgpack::object from a buffer.
|
||||
/**
|
||||
* @param result The object_handle that contains unpacked data.
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param off The offset position of the buffer. It is read and overwritten.
|
||||
* @param f A judging function that msgpack::object refer to the buffer.
|
||||
* @param user_data This parameter is passed to f.
|
||||
* @param limit The size limit information of msgpack::object.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void unpack(
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len, std::size_t& off,
|
||||
msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// Unpack msgpack::object from a buffer.
|
||||
/**
|
||||
* @param result The object_handle that contains unpacked data.
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
|
||||
* @param f A judging function that msgpack::object refer to the buffer.
|
||||
* @param user_data This parameter is passed to f.
|
||||
* @param limit The size limit information of msgpack::object.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void unpack(
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len, bool& referenced,
|
||||
msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// Unpack msgpack::object from a buffer.
|
||||
/**
|
||||
* @param result The object_handle that contains unpacked data.
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param f A judging function that msgpack::object refer to the buffer.
|
||||
* @param user_data This parameter is passed to f.
|
||||
* @param limit The size limit information of msgpack::object.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void unpack(
|
||||
msgpack::object_handle& result,
|
||||
const char* data, std::size_t len,
|
||||
msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// Unpack msgpack::object from a buffer.
|
||||
/**
|
||||
* @param z The msgpack::zone that is used as a memory of unpacked msgpack objects.
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param off The offset position of the buffer. It is read and overwritten.
|
||||
* @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
|
||||
* @param f A judging function that msgpack::object refer to the buffer.
|
||||
* @param user_data This parameter is passed to f.
|
||||
* @param limit The size limit information of msgpack::object.
|
||||
*
|
||||
* @return msgpack::object that contains unpacked data.
|
||||
*
|
||||
*/
|
||||
msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
const char* data, std::size_t len, std::size_t& off, bool& referenced,
|
||||
msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// Unpack msgpack::object from a buffer.
|
||||
/**
|
||||
* @param z The msgpack::zone that is used as a memory of unpacked msgpack objects.
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param off The offset position of the buffer. It is read and overwritten.
|
||||
* @param f A judging function that msgpack::object refer to the buffer.
|
||||
* @param user_data This parameter is passed to f.
|
||||
* @param limit The size limit information of msgpack::object.
|
||||
*
|
||||
* @return msgpack::object that contains unpacked data.
|
||||
*
|
||||
*/
|
||||
msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
const char* data, std::size_t len, std::size_t& off,
|
||||
msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// Unpack msgpack::object from a buffer.
|
||||
/**
|
||||
* @param z The msgpack::zone that is used as a memory of unpacked msgpack objects.
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
|
||||
* @param f A judging function that msgpack::object refer to the buffer.
|
||||
* @param user_data This parameter is passed to f.
|
||||
* @param limit The size limit information of msgpack::object.
|
||||
*
|
||||
* @return msgpack::object that contains unpacked data.
|
||||
*
|
||||
*/
|
||||
msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
const char* data, std::size_t len, bool& referenced,
|
||||
msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// Unpack msgpack::object from a buffer.
|
||||
/**
|
||||
* @param z The msgpack::zone that is used as a memory of unpacked msgpack objects.
|
||||
* @param data The pointer to the buffer.
|
||||
* @param len The length of the buffer.
|
||||
* @param f A judging function that msgpack::object refer to the buffer.
|
||||
* @param user_data This parameter is passed to f.
|
||||
* @param limit The size limit information of msgpack::object.
|
||||
*
|
||||
* @return msgpack::object that contains unpacked data.
|
||||
*
|
||||
*/
|
||||
msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
const char* data, std::size_t len,
|
||||
msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
|
||||
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_UNPACK_DECL_HPP
|
29
include/msgpack/v3/vrefbuffer_decl.hpp
Normal file
29
include/msgpack/v3/vrefbuffer_decl.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// MessagePack for C++ zero-copy buffer implementation
|
||||
//
|
||||
// Copyright (C) 2018 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_V3_VREFBUFFER_DECL_HPP
|
||||
#define MSGPACK_V3_VREFBUFFER_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/vrefbuffer_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::vrefbuffer;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_VREFBUFFER_DECL_HPP
|
34
include/msgpack/v3/x3_parse_decl.hpp
Normal file
34
include/msgpack/v3/x3_parse_decl.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_V3_X3_PARSE_DECL_HPP
|
||||
#define MSGPACK_V3_X3_PARSE_DECL_HPP
|
||||
|
||||
#if defined(MSGPACK_USE_X3_PARSE)
|
||||
|
||||
#include "msgpack/v2/x3_parse_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::parse;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v2)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#endif // defined(MSGPACK_USE_X3_PARSE)
|
||||
|
||||
#endif // MSGPACK_V3_X3_PARSE_DECL_HPP
|
97
include/msgpack/v3/x3_unpack.hpp
Normal file
97
include/msgpack/v3/x3_unpack.hpp
Normal file
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2018 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_V3_X3_UNPACK_HPP
|
||||
#define MSGPACK_V3_X3_UNPACK_HPP
|
||||
|
||||
#if defined(MSGPACK_USE_X3_PARSE)
|
||||
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#if BOOST_VERSION >= 106100
|
||||
|
||||
#include "msgpack/versioning.hpp"
|
||||
#include "msgpack/create_object_visitor.hpp"
|
||||
#include "msgpack/x3_unpack_decl.hpp"
|
||||
#include "msgpack/x3_parse.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
|
||||
template <typename Iterator>
|
||||
inline msgpack::object_handle unpack(
|
||||
Iterator&& begin, Iterator&& end,
|
||||
bool& referenced,
|
||||
unpack_reference_func f, void* user_data,
|
||||
unpack_limit const& limit)
|
||||
{
|
||||
msgpack::object obj;
|
||||
msgpack::unique_ptr<msgpack::zone> z(new msgpack::zone);
|
||||
referenced = false;
|
||||
detail::unpack_imp(
|
||||
std::forward<Iterator>(begin), std::forward<Iterator>(end), *z, obj, referenced, f, user_data, limit);
|
||||
return msgpack::object_handle(obj, msgpack::move(z));
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
inline msgpack::object_handle unpack(
|
||||
Iterator&& begin, Iterator&& end,
|
||||
unpack_reference_func f, void* user_data,
|
||||
unpack_limit const& limit)
|
||||
{
|
||||
bool referenced;
|
||||
return unpack(std::forward<Iterator>(begin), std::forward<Iterator>(end), referenced, f, user_data, limit);
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
inline msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
Iterator&& begin, Iterator&& end,
|
||||
bool& referenced,
|
||||
unpack_reference_func f, void* user_data,
|
||||
unpack_limit const& limit)
|
||||
{
|
||||
msgpack::object obj;
|
||||
referenced = false;
|
||||
detail::unpack_imp(
|
||||
std::forward<Iterator>(begin), std::forward<Iterator>(end), z, obj, referenced, f, user_data, limit);
|
||||
return obj;
|
||||
}
|
||||
|
||||
template <typename Iterator>
|
||||
inline msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
Iterator&& begin, Iterator&& end,
|
||||
unpack_reference_func f, void* user_data,
|
||||
unpack_limit const& limit)
|
||||
{
|
||||
bool referenced;
|
||||
return unpack(
|
||||
z, std::forward<Iterator>(begin), std::forward<Iterator>(end), referenced, f, user_data, limit);
|
||||
}
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#else // BOOST_VERSION >= 106100
|
||||
|
||||
#error Boost 1.61.0 or later is required to use x3 parse
|
||||
|
||||
#endif // BOOST_VERSION >= 106100
|
||||
|
||||
#endif // defined(MSGPACK_USE_X3_PARSE)
|
||||
|
||||
#endif // MSGPACK_V3_X3_UNPACK_HPP
|
65
include/msgpack/v3/x3_unpack_decl.hpp
Normal file
65
include/msgpack/v3/x3_unpack_decl.hpp
Normal file
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// MessagePack for C++ deserializing routine
|
||||
//
|
||||
// Copyright (C) 2017 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_V3_X3_UNPACK_DECL_HPP
|
||||
#define MSGPACK_V3_X3_UNPACK_DECL_HPP
|
||||
|
||||
#if defined(MSGPACK_USE_X3_PARSE)
|
||||
|
||||
#include "msgpack/v2/x3_unpack_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
namespace detail {
|
||||
|
||||
using v2::detail::unpack_imp;
|
||||
|
||||
} // detail
|
||||
|
||||
template <typename Iterator>
|
||||
msgpack::object_handle unpack(
|
||||
Iterator&& begin, Iterator&& end,
|
||||
bool& referenced,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit());
|
||||
|
||||
template <typename Iterator>
|
||||
msgpack::object_handle unpack(
|
||||
Iterator&& begin, Iterator&& end,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit());
|
||||
|
||||
template <typename Iterator>
|
||||
msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
Iterator&& begin, Iterator&& end,
|
||||
bool& referenced,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit());
|
||||
|
||||
template <typename Iterator>
|
||||
msgpack::object unpack(
|
||||
msgpack::zone& z,
|
||||
Iterator&& begin, Iterator&& end,
|
||||
unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR,
|
||||
unpack_limit const& limit = unpack_limit());
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // defined(MSGPACK_USE_X3_PARSE)
|
||||
|
||||
#endif // MSGPACK_V3_X3_UNPACK_DECL_HPP
|
29
include/msgpack/v3/zbuffer_decl.hpp
Normal file
29
include/msgpack/v3/zbuffer_decl.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// MessagePack for C++ deflate buffer implementation
|
||||
//
|
||||
// Copyright (C) 2018 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_V3_ZBUFFER_DECL_HPP
|
||||
#define MSGPACK_V3_ZBUFFER_DECL_HPP
|
||||
|
||||
#include "msgpack/v2/zbuffer_decl.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
/// @cond
|
||||
MSGPACK_API_VERSION_NAMESPACE(v3) {
|
||||
/// @endcond
|
||||
|
||||
using v2::zbuffer;
|
||||
|
||||
/// @cond
|
||||
} // MSGPACK_API_VERSION_NAMESPACE(v3)
|
||||
/// @endcond
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif // MSGPACK_V3_ZBUFFER_DECL_HPP
|
21
include/msgpack/v3/zone_decl.hpp
Normal file
21
include/msgpack/v3/zone_decl.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// MessagePack for C++ memory pool
|
||||
//
|
||||
// Copyright (C) 2008-2018 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_V3_ZONE_DECL_HPP
|
||||
#define MSGPACK_V3_ZONE_DECL_HPP
|
||||
|
||||
#include "msgpack/cpp_config.hpp"
|
||||
|
||||
#if defined(MSGPACK_USE_CPP03)
|
||||
#include "msgpack/v3/detail/cpp03_zone_decl.hpp"
|
||||
#else // MSGPACK_USE_CPP03
|
||||
#include "msgpack/v3/detail/cpp11_zone_decl.hpp"
|
||||
#endif // MSGPACK_USE_CPP03
|
||||
|
||||
#endif // MSGPACK_V3_ZONE_DECL_HPP
|
@@ -1,3 +1,3 @@
|
||||
#define MSGPACK_VERSION_MAJOR 2
|
||||
#define MSGPACK_VERSION_MINOR 1
|
||||
#define MSGPACK_VERSION_REVISION 5
|
||||
#define MSGPACK_VERSION_MAJOR 3
|
||||
#define MSGPACK_VERSION_MINOR 0
|
||||
#define MSGPACK_VERSION_REVISION 0
|
||||
|
@@ -11,7 +11,7 @@
|
||||
#define MSGPACK_VERSIONING_HPP
|
||||
|
||||
#if !defined(MSGPACK_DEFAULT_API_VERSION)
|
||||
#define MSGPACK_DEFAULT_API_VERSION 2
|
||||
#define MSGPACK_DEFAULT_API_VERSION 3
|
||||
#endif
|
||||
|
||||
#define MSGPACK_DEFAULT_API_NS MSGPACK_DETAIL_PP_CAT(v, MSGPACK_DEFAULT_API_VERSION)
|
||||
@@ -20,6 +20,8 @@
|
||||
#define MSGPACK_DETAIL_PP_ENABLE_NS_v1 ()
|
||||
#elif MSGPACK_DEFAULT_API_VERSION == 2
|
||||
#define MSGPACK_DETAIL_PP_ENABLE_NS_v2 ()
|
||||
#elif MSGPACK_DEFAULT_API_VERSION == 3
|
||||
#define MSGPACK_DETAIL_PP_ENABLE_NS_v3 ()
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
|
@@ -12,5 +12,6 @@
|
||||
|
||||
#include "msgpack/v1/vrefbuffer_decl.hpp"
|
||||
#include "msgpack/v2/vrefbuffer_decl.hpp"
|
||||
#include "msgpack/v3/vrefbuffer_decl.hpp"
|
||||
|
||||
#endif // MSGPACK_VREFBUFFER_DECL_HPP
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user