object_decl.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. //
  2. // MessagePack for C++ static resolution routine
  3. //
  4. // Copyright (C) 2008-2014 FURUHASHI Sadayuki and KONDO Takatoshi
  5. //
  6. // Distributed under the Boost Software License, Version 1.0.
  7. // (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef MSGPACK_V1_OBJECT_DECL_HPP
  11. #define MSGPACK_V1_OBJECT_DECL_HPP
  12. #include "msgpack/versioning.hpp"
  13. #include "msgpack/pack.hpp"
  14. #include "msgpack/zone.hpp"
  15. #include "msgpack/adaptor/adaptor_base.hpp"
  16. #include <cstring>
  17. #include <stdexcept>
  18. #include <typeinfo>
  19. #include <limits>
  20. #include <ostream>
  21. #include <typeinfo>
  22. #include <iomanip>
  23. namespace msgpack {
  24. /// @cond
  25. MSGPACK_API_VERSION_NAMESPACE(v1) {
  26. /// @endcond
  27. /// The class holds object and zone
  28. class object_handle;
  29. namespace detail {
  30. template <std::size_t N>
  31. std::size_t add_ext_type_size(std::size_t size);
  32. template <>
  33. std::size_t add_ext_type_size<4>(std::size_t size);
  34. } // namespace detail
  35. std::size_t aligned_zone_size(msgpack::object const& obj);
  36. /// clone object
  37. /**
  38. * Clone (deep copy) object.
  39. * The copied object is located on newly allocated zone.
  40. * @param obj copy source object
  41. *
  42. * @return object_handle that holds deep copied object and zone.
  43. */
  44. object_handle clone(msgpack::object const& obj);
  45. namespace detail {
  46. template <typename Stream, typename T>
  47. struct packer_serializer;
  48. } // namespace detail
  49. // obsolete
  50. template <typename Type>
  51. class define;
  52. bool operator==(const msgpack::object& x, const msgpack::object& y);
  53. template <typename T>
  54. bool operator==(const msgpack::object& x, const T& y);
  55. bool operator!=(const msgpack::object& x, const msgpack::object& y);
  56. template <typename T>
  57. bool operator==(const T& y, const msgpack::object& x);
  58. template <typename T>
  59. bool operator!=(const msgpack::object& x, const T& y);
  60. template <typename T>
  61. bool operator!=(const T& y, const msgpack::object& x);
  62. void operator<< (msgpack::object& o, const msgpack_object& v);
  63. class object_parser;
  64. template <typename Stream>
  65. struct object_pack_visitor;
  66. struct object_stringize_visitor;
  67. // obsolete
  68. template <typename T>
  69. MSGPACK_DEPRECATED("please use member function version of object::convert(T&)")
  70. void convert(T& v, msgpack::object const& o);
  71. // obsolete
  72. template <typename Stream, typename T>
  73. MSGPACK_DEPRECATED("please use member function version of packer::pack(const T&)")
  74. void pack(msgpack::packer<Stream>& o, const T& v);
  75. // obsolete
  76. template <typename Stream, typename T>
  77. MSGPACK_DEPRECATED("please use member function version of packer::pack(const T&)")
  78. void pack_copy(msgpack::packer<Stream>& o, T v);
  79. template <typename Stream>
  80. msgpack::packer<Stream>& operator<< (msgpack::packer<Stream>& o, const msgpack::object& v);
  81. template <typename Stream>
  82. msgpack::packer<Stream>& operator<< (msgpack::packer<Stream>& o, const msgpack::object::with_zone& v);
  83. std::ostream& operator<< (std::ostream& s, const msgpack::object& v);
  84. /// @cond
  85. } // MSGPACK_API_VERSION_NAMESPACE(v1)
  86. /// @endcond
  87. } // namespace msgpack
  88. #endif // MSGPACK_V1_OBJECT_DECL_HPP