mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-05-22 05:34:03 +02:00
Minimized header files dependency.
Added help comments for typical compile error.
This commit is contained in:
parent
fc65bc0682
commit
b5e66150e9
@ -19,7 +19,8 @@
|
|||||||
#define MSGPACK_CPP03_DEFINE_HPP
|
#define MSGPACK_CPP03_DEFINE_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/adaptor/msgpack_tuple_fwd.hpp"
|
||||||
|
#include "msgpack/object_fwd.hpp"
|
||||||
|
|
||||||
#define MSGPACK_DEFINE(...) \
|
#define MSGPACK_DEFINE(...) \
|
||||||
template <typename Packer> \
|
template <typename Packer> \
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_CPP03_MSGPACK_TUPLE_HPP
|
#define MSGPACK_CPP03_MSGPACK_TUPLE_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object.hpp"
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
|
||||||
|
|
||||||
#ifndef MSGPACK_ZONE_CHUNK_SIZE
|
#ifndef MSGPACK_ZONE_CHUNK_SIZE
|
||||||
#define MSGPACK_ZONE_CHUNK_SIZE 8192
|
#define MSGPACK_ZONE_CHUNK_SIZE 8192
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_BOOL_HPP
|
#define MSGPACK_TYPE_BOOL_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_CHAR_PTR_HPP
|
#define MSGPACK_TYPE_CHAR_PTR_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#define MSGPACK_CPP11_ARRAY_HPP
|
#define MSGPACK_CPP11_ARRAY_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#define MSGPACK_CPP11_FORWARD_LIST_HPP
|
#define MSGPACK_CPP11_FORWARD_LIST_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
|
|
||||||
#include <forward_list>
|
#include <forward_list>
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_CPP11_TUPLE_HPP
|
#define MSGPACK_CPP11_TUPLE_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_DEQUE_HPP
|
#define MSGPACK_TYPE_DEQUE_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
#define MSGPACK_CPP03_DEFINE_HPP
|
#define MSGPACK_CPP03_DEFINE_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/adaptor/msgpack_tuple_fwd.hpp"
|
||||||
|
#include "msgpack/object_fwd.hpp"
|
||||||
|
|
||||||
#define MSGPACK_DEFINE(...) \
|
#define MSGPACK_DEFINE(...) \
|
||||||
template <typename Packer> \
|
template <typename Packer> \
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_CPP03_MSGPACK_TUPLE_HPP
|
#define MSGPACK_CPP03_MSGPACK_TUPLE_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object.hpp"
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_CPP11_DEFINE_HPP
|
#define MSGPACK_CPP11_DEFINE_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
|
|
||||||
// for MSGPACK_ADD_ENUM
|
// for MSGPACK_ADD_ENUM
|
||||||
#include "msgpack/adaptor/int_fwd.hpp"
|
#include "msgpack/adaptor/int_fwd.hpp"
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_CPP11_MSGPACK_TUPLE_HPP
|
#define MSGPACK_CPP11_MSGPACK_TUPLE_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_FIXINT_HPP
|
#define MSGPACK_TYPE_FIXINT_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
#include "msgpack/adaptor/int.hpp"
|
#include "msgpack/adaptor/int.hpp"
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_FLOAT_HPP
|
#define MSGPACK_TYPE_FLOAT_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_LIST_HPP
|
#define MSGPACK_TYPE_LIST_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_MAP_HPP
|
#define MSGPACK_TYPE_MAP_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_NIL_HPP
|
#define MSGPACK_TYPE_NIL_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_PAIR_HPP
|
#define MSGPACK_TYPE_PAIR_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_RAW_HPP
|
#define MSGPACK_TYPE_RAW_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_SET_HPP
|
#define MSGPACK_TYPE_SET_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_STRING_HPP
|
#define MSGPACK_TYPE_STRING_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_TR1_UNORDERED_MAP_HPP
|
#define MSGPACK_TYPE_TR1_UNORDERED_MAP_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
|
|
||||||
#if defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)
|
#if defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_TR1_UNORDERED_SET_HPP
|
#define MSGPACK_TYPE_TR1_UNORDERED_SET_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
|
|
||||||
#if defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)
|
#if defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_VECTOR_HPP
|
#define MSGPACK_TYPE_VECTOR_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#define MSGPACK_TYPE_VECTOR_CHAR_HPP
|
#define MSGPACK_TYPE_VECTOR_CHAR_HPP
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace msgpack {
|
namespace msgpack {
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack_fwd.hpp"
|
|
||||||
|
|
||||||
#ifndef MSGPACK_ZONE_CHUNK_SIZE
|
#ifndef MSGPACK_ZONE_CHUNK_SIZE
|
||||||
#define MSGPACK_ZONE_CHUNK_SIZE 8192
|
#define MSGPACK_ZONE_CHUNK_SIZE 8192
|
||||||
|
@ -86,6 +86,36 @@ inline object const& operator>> (object const& o, object& v)
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
inline object const& operator>> (object const& o, T& v)
|
inline object const& operator>> (object const& o, T& v)
|
||||||
{
|
{
|
||||||
|
// If you get a error 'class your_class has no member named 'msgpack_unpack',
|
||||||
|
// check the following:
|
||||||
|
// 1. The class your_class should have MSGPACK_DEFINE macro or
|
||||||
|
//
|
||||||
|
// 2. The class your_class should have the following operator declaration and
|
||||||
|
// definition:
|
||||||
|
// inline object const& operator>> (object const& o, std::string& v)
|
||||||
|
//
|
||||||
|
// See 3.
|
||||||
|
//
|
||||||
|
// 3. #include "msgpack.hpp" too early.
|
||||||
|
// Replace msgpack.hpp with msgpack_fwd.hpp, then,
|
||||||
|
// place operator declarations as follows:
|
||||||
|
//
|
||||||
|
// namespace msgpack {
|
||||||
|
// MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {
|
||||||
|
// object const& operator>> (object const& o, std::string& v);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// then, #include "msgpack.hpp", finally place the operator definitions as follows:
|
||||||
|
//
|
||||||
|
// namespace msgpack {
|
||||||
|
// MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {
|
||||||
|
// object const& operator>> (object const& o, std::string& v) {
|
||||||
|
// // converting operations here
|
||||||
|
// }
|
||||||
|
// } // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
|
||||||
|
// } // namespace msgpack
|
||||||
|
//
|
||||||
v.msgpack_unpack(o.convert());
|
v.msgpack_unpack(o.convert());
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
@ -116,6 +146,42 @@ namespace detail {
|
|||||||
template <typename Stream, typename T>
|
template <typename Stream, typename T>
|
||||||
struct packer_serializer {
|
struct packer_serializer {
|
||||||
static packer<Stream>& pack(packer<Stream>& o, const T& v) {
|
static packer<Stream>& pack(packer<Stream>& o, const T& v) {
|
||||||
|
// If you get a error 'const class your_class has no member named 'msgpack_pack',
|
||||||
|
// check the following:
|
||||||
|
// 1. The class your_class should have MSGPACK_DEFINE macro or
|
||||||
|
//
|
||||||
|
// 2. The class your_class should have the following operator declaration and
|
||||||
|
// definition:
|
||||||
|
//
|
||||||
|
// namespace msgpack {
|
||||||
|
// MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {
|
||||||
|
// template <typename Stream>
|
||||||
|
// inline packer<Stream>& operator<< (packer<Stream>& o, const your_class& v)
|
||||||
|
// } // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
|
||||||
|
// } // namespace msgpack
|
||||||
|
//
|
||||||
|
// See 3.
|
||||||
|
//
|
||||||
|
// 3. #include "msgpack.hpp" too early.
|
||||||
|
// Replace msgpack.hpp with msgpack_fwd.hpp, then,
|
||||||
|
// place operator declarations as follows:
|
||||||
|
//
|
||||||
|
// namespace msgpack {
|
||||||
|
// MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {
|
||||||
|
// template <typename Stream>
|
||||||
|
// packer<Stream>& operator<< (packer<Stream>& o, const your_class& v);
|
||||||
|
// } // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
|
||||||
|
// } // namespace msgpack
|
||||||
|
//
|
||||||
|
// then, #include "msgpack.hpp", finally place the operator definitions as follows:
|
||||||
|
//
|
||||||
|
// template <typename Stream>
|
||||||
|
// inline packer<Stream>& operator<< (packer<Stream>& o, const your_class& v) {
|
||||||
|
// // packing operation
|
||||||
|
// }
|
||||||
|
// } // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
|
||||||
|
// } // namespace msgpack
|
||||||
|
//
|
||||||
v.msgpack_pack(o);
|
v.msgpack_pack(o);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "msgpack/versioning.hpp"
|
#include "msgpack/versioning.hpp"
|
||||||
#include "msgpack/zone.hpp"
|
#include "msgpack/zone.hpp"
|
||||||
#include "msgpack/object_fwd.hpp"
|
#include "msgpack/object_fwd.hpp"
|
||||||
|
#include "msgpack/adaptor/define.hpp"
|
||||||
#include "msgpack/pack.hpp"
|
#include "msgpack/pack.hpp"
|
||||||
|
|
||||||
#endif // MSGPACK_FWD_HPP
|
#endif // MSGPACK_FWD_HPP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user