unpack_decl.hpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. //
  2. // MessagePack for C++ deserializing routine
  3. //
  4. // Copyright (C) 2018 KONDO Takatoshi
  5. //
  6. // Distributed under the Boost Software License, Version 1.0.
  7. // (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef MSGPACK_V3_UNPACK_DECL_HPP
  11. #define MSGPACK_V3_UNPACK_DECL_HPP
  12. #include "msgpack/v2/unpack_decl.hpp"
  13. namespace msgpack {
  14. /// @cond
  15. MSGPACK_API_VERSION_NAMESPACE(v3) {
  16. /// @endcond
  17. using v2::unpack_reference_func;
  18. using v2::unpack_error;
  19. using v2::parse_error;
  20. using v2::insufficient_bytes;
  21. using v2::size_overflow;
  22. using v2::array_size_overflow;
  23. using v2::map_size_overflow;
  24. using v2::str_size_overflow;
  25. using v2::bin_size_overflow;
  26. using v2::ext_size_overflow;
  27. using v2::depth_size_overflow;
  28. using v2::unpack_limit;
  29. namespace detail {
  30. using v2::detail::unpack_user;
  31. using v2::detail::unpack_uint8;
  32. using v2::detail::unpack_uint16;
  33. using v2::detail::unpack_uint32;
  34. using v2::detail::unpack_uint64;
  35. using v2::detail::unpack_int8;
  36. using v2::detail::unpack_int16;
  37. using v2::detail::unpack_int32;
  38. using v2::detail::unpack_int64;
  39. using v2::detail::unpack_float;
  40. using v2::detail::unpack_double;
  41. using v2::detail::unpack_nil;
  42. using v2::detail::unpack_true;
  43. using v2::detail::unpack_false;
  44. using v2::detail::unpack_array;
  45. using v2::detail::unpack_array_item;
  46. using v2::detail::unpack_map;
  47. using v2::detail::unpack_map_item;
  48. using v2::detail::unpack_str;
  49. using v2::detail::unpack_bin;
  50. using v2::detail::unpack_ext;
  51. using v2::detail::unpack_stack;
  52. using v2::detail::init_count;
  53. using v2::detail::decr_count;
  54. using v2::detail::incr_count;
  55. using v2::detail::get_count;
  56. using v2::detail::fix_tag;
  57. using v2::detail::value;
  58. using v2::detail::load;
  59. } // detail
  60. using v2::unpacked;
  61. using v2::unpacker;
  62. using v2::basic_unpacker;
  63. namespace detail {
  64. using v2::detail::unpack_imp;
  65. } // detail
  66. /// Unpack msgpack::object from a buffer.
  67. /**
  68. * @param data The pointer to the buffer.
  69. * @param len The length of the buffer.
  70. * @param off The offset position of the buffer. It is read and overwritten.
  71. * @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
  72. * @param f A judging function that msgpack::object refer to the buffer.
  73. * @param user_data This parameter is passed to f.
  74. * @param limit The size limit information of msgpack::object.
  75. *
  76. * @return object_handle that contains unpacked data.
  77. *
  78. */
  79. msgpack::object_handle unpack(
  80. const char* data, std::size_t len, std::size_t& off, bool& referenced,
  81. msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
  82. /// Unpack msgpack::object from a buffer.
  83. /**
  84. * @param data The pointer to the buffer.
  85. * @param len The length of the buffer.
  86. * @param off The offset position of the buffer. It is read and overwritten.
  87. * @param f A judging function that msgpack::object refer to the buffer.
  88. * @param user_data This parameter is passed to f.
  89. * @param limit The size limit information of msgpack::object.
  90. *
  91. * @return object_handle that contains unpacked data.
  92. *
  93. */
  94. msgpack::object_handle unpack(
  95. const char* data, std::size_t len, std::size_t& off,
  96. msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
  97. /// Unpack msgpack::object from a buffer.
  98. /**
  99. * @param data The pointer to the buffer.
  100. * @param len The length of the buffer.
  101. * @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
  102. * @param f A judging function that msgpack::object refer to the buffer.
  103. * @param user_data This parameter is passed to f.
  104. * @param limit The size limit information of msgpack::object.
  105. *
  106. * @return object_handle that contains unpacked data.
  107. *
  108. */
  109. msgpack::object_handle unpack(
  110. const char* data, std::size_t len, bool& referenced,
  111. msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
  112. /// Unpack msgpack::object from a buffer.
  113. /**
  114. * @param data The pointer to the buffer.
  115. * @param len The length of the buffer.
  116. * @param f A judging function that msgpack::object refer to the buffer.
  117. * @param user_data This parameter is passed to f.
  118. * @param limit The size limit information of msgpack::object.
  119. *
  120. * @return object_handle that contains unpacked data.
  121. *
  122. */
  123. msgpack::object_handle unpack(
  124. const char* data, std::size_t len,
  125. msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
  126. /// Unpack msgpack::object from a buffer.
  127. /**
  128. * @param result The object_handle that contains unpacked data.
  129. * @param data The pointer to the buffer.
  130. * @param len The length of the buffer.
  131. * @param off The offset position of the buffer. It is read and overwritten.
  132. * @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
  133. * @param f A judging function that msgpack::object refer to the buffer.
  134. * @param user_data This parameter is passed to f.
  135. * @param limit The size limit information of msgpack::object.
  136. *
  137. *
  138. */
  139. void unpack(
  140. msgpack::object_handle& result,
  141. const char* data, std::size_t len, std::size_t& off, bool& referenced,
  142. msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
  143. /// Unpack msgpack::object from a buffer.
  144. /**
  145. * @param result The object_handle that contains unpacked data.
  146. * @param data The pointer to the buffer.
  147. * @param len The length of the buffer.
  148. * @param off The offset position of the buffer. It is read and overwritten.
  149. * @param f A judging function that msgpack::object refer to the buffer.
  150. * @param user_data This parameter is passed to f.
  151. * @param limit The size limit information of msgpack::object.
  152. *
  153. *
  154. */
  155. void unpack(
  156. msgpack::object_handle& result,
  157. const char* data, std::size_t len, std::size_t& off,
  158. msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
  159. /// Unpack msgpack::object from a buffer.
  160. /**
  161. * @param result The object_handle that contains unpacked data.
  162. * @param data The pointer to the buffer.
  163. * @param len The length of the buffer.
  164. * @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
  165. * @param f A judging function that msgpack::object refer to the buffer.
  166. * @param user_data This parameter is passed to f.
  167. * @param limit The size limit information of msgpack::object.
  168. *
  169. *
  170. */
  171. void unpack(
  172. msgpack::object_handle& result,
  173. const char* data, std::size_t len, bool& referenced,
  174. msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
  175. /// Unpack msgpack::object from a buffer.
  176. /**
  177. * @param result The object_handle that contains unpacked data.
  178. * @param data The pointer to the buffer.
  179. * @param len The length of the buffer.
  180. * @param f A judging function that msgpack::object refer to the buffer.
  181. * @param user_data This parameter is passed to f.
  182. * @param limit The size limit information of msgpack::object.
  183. *
  184. *
  185. */
  186. void unpack(
  187. msgpack::object_handle& result,
  188. const char* data, std::size_t len,
  189. msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
  190. /// Unpack msgpack::object from a buffer.
  191. /**
  192. * @param z The msgpack::zone that is used as a memory of unpacked msgpack objects.
  193. * @param data The pointer to the buffer.
  194. * @param len The length of the buffer.
  195. * @param off The offset position of the buffer. It is read and overwritten.
  196. * @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
  197. * @param f A judging function that msgpack::object refer to the buffer.
  198. * @param user_data This parameter is passed to f.
  199. * @param limit The size limit information of msgpack::object.
  200. *
  201. * @return msgpack::object that contains unpacked data.
  202. *
  203. */
  204. msgpack::object unpack(
  205. msgpack::zone& z,
  206. const char* data, std::size_t len, std::size_t& off, bool& referenced,
  207. msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
  208. /// Unpack msgpack::object from a buffer.
  209. /**
  210. * @param z The msgpack::zone that is used as a memory of unpacked msgpack objects.
  211. * @param data The pointer to the buffer.
  212. * @param len The length of the buffer.
  213. * @param off The offset position of the buffer. It is read and overwritten.
  214. * @param f A judging function that msgpack::object refer to the buffer.
  215. * @param user_data This parameter is passed to f.
  216. * @param limit The size limit information of msgpack::object.
  217. *
  218. * @return msgpack::object that contains unpacked data.
  219. *
  220. */
  221. msgpack::object unpack(
  222. msgpack::zone& z,
  223. const char* data, std::size_t len, std::size_t& off,
  224. msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
  225. /// Unpack msgpack::object from a buffer.
  226. /**
  227. * @param z The msgpack::zone that is used as a memory of unpacked msgpack objects.
  228. * @param data The pointer to the buffer.
  229. * @param len The length of the buffer.
  230. * @param referenced If the unpacked object contains reference of the buffer, then set as true, otherwise false.
  231. * @param f A judging function that msgpack::object refer to the buffer.
  232. * @param user_data This parameter is passed to f.
  233. * @param limit The size limit information of msgpack::object.
  234. *
  235. * @return msgpack::object that contains unpacked data.
  236. *
  237. */
  238. msgpack::object unpack(
  239. msgpack::zone& z,
  240. const char* data, std::size_t len, bool& referenced,
  241. msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
  242. /// Unpack msgpack::object from a buffer.
  243. /**
  244. * @param z The msgpack::zone that is used as a memory of unpacked msgpack objects.
  245. * @param data The pointer to the buffer.
  246. * @param len The length of the buffer.
  247. * @param f A judging function that msgpack::object refer to the buffer.
  248. * @param user_data This parameter is passed to f.
  249. * @param limit The size limit information of msgpack::object.
  250. *
  251. * @return msgpack::object that contains unpacked data.
  252. *
  253. */
  254. msgpack::object unpack(
  255. msgpack::zone& z,
  256. const char* data, std::size_t len,
  257. msgpack::unpack_reference_func f = MSGPACK_NULLPTR, void* user_data = MSGPACK_NULLPTR, msgpack::unpack_limit const& limit = unpack_limit());
  258. /// @cond
  259. } // MSGPACK_API_VERSION_NAMESPACE(v3)
  260. /// @endcond
  261. } // namespace msgpack
  262. #endif // MSGPACK_V3_UNPACK_DECL_HPP