Minimized header files dependency.

Added help comments for typical compile error.
This commit is contained in:
Takatoshi Kondo 2014-10-19 21:18:30 +09:00
parent fc65bc0682
commit b5e66150e9
29 changed files with 94 additions and 27 deletions

View File

@ -19,7 +19,8 @@
#define MSGPACK_CPP03_DEFINE_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/adaptor/msgpack_tuple_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#define MSGPACK_DEFINE(...) \
template <typename Packer> \

View File

@ -19,7 +19,7 @@
#define MSGPACK_CPP03_MSGPACK_TUPLE_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object.hpp"
namespace msgpack {

View File

@ -23,7 +23,6 @@
#include <vector>
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#ifndef MSGPACK_ZONE_CHUNK_SIZE
#define MSGPACK_ZONE_CHUNK_SIZE 8192

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_BOOL_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <vector>
namespace msgpack {

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_CHAR_PTR_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <cstring>
namespace msgpack {

View File

@ -20,7 +20,7 @@
#define MSGPACK_CPP11_ARRAY_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <array>

View File

@ -20,7 +20,7 @@
#define MSGPACK_CPP11_FORWARD_LIST_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <forward_list>

View File

@ -19,7 +19,7 @@
#define MSGPACK_CPP11_TUPLE_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <tuple>

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_DEQUE_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <deque>
namespace msgpack {

View File

@ -19,7 +19,8 @@
#define MSGPACK_CPP03_DEFINE_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/adaptor/msgpack_tuple_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#define MSGPACK_DEFINE(...) \
template <typename Packer> \

View File

@ -19,7 +19,7 @@
#define MSGPACK_CPP03_MSGPACK_TUPLE_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object.hpp"
namespace msgpack {

View File

@ -19,7 +19,7 @@
#define MSGPACK_CPP11_DEFINE_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
// for MSGPACK_ADD_ENUM
#include "msgpack/adaptor/int_fwd.hpp"

View File

@ -19,7 +19,7 @@
#define MSGPACK_CPP11_MSGPACK_TUPLE_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <tuple>

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_FIXINT_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include "msgpack/adaptor/int.hpp"
namespace msgpack {

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_FLOAT_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <vector>
namespace msgpack {

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_LIST_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <list>
namespace msgpack {

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_MAP_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <map>
#include <vector>
#include <algorithm>

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_NIL_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
namespace msgpack {

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_PAIR_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <utility>
namespace msgpack {

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_RAW_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <string.h>
#include <string>

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_SET_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <set>

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_STRING_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <string>
namespace msgpack {

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_TR1_UNORDERED_MAP_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#if defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_TR1_UNORDERED_SET_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#if defined(_LIBCPP_VERSION) || (_MSC_VER >= 1700)

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_VECTOR_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <vector>
namespace msgpack {

View File

@ -19,7 +19,7 @@
#define MSGPACK_TYPE_VECTOR_CHAR_HPP
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#include "msgpack/object_fwd.hpp"
#include <vector>
namespace msgpack {

View File

@ -23,7 +23,6 @@
#include <vector>
#include "msgpack/versioning.hpp"
#include "msgpack_fwd.hpp"
#ifndef MSGPACK_ZONE_CHUNK_SIZE
#define MSGPACK_ZONE_CHUNK_SIZE 8192

View File

@ -86,6 +86,36 @@ inline object const& operator>> (object const& o, object& v)
template <typename T>
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());
return o;
}
@ -116,6 +146,42 @@ namespace detail {
template <typename Stream, typename T>
struct packer_serializer {
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);
return o;
}

View File

@ -21,6 +21,7 @@
#include "msgpack/versioning.hpp"
#include "msgpack/zone.hpp"
#include "msgpack/object_fwd.hpp"
#include "msgpack/adaptor/define.hpp"
#include "msgpack/pack.hpp"
#endif // MSGPACK_FWD_HPP