parse_decl.hpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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_V2_PARSE_DECL_HPP
  11. #define MSGPACK_V2_PARSE_DECL_HPP
  12. #include "msgpack/parse_return.hpp"
  13. namespace msgpack {
  14. /// @cond
  15. MSGPACK_API_VERSION_NAMESPACE(v2) {
  16. /// @endcond
  17. namespace detail {
  18. template <typename VisitorHolder>
  19. class context;
  20. } // detail
  21. /// Parsing class for a stream deserialization.
  22. template <typename VisitorHolder, typename ReferencedBufferHook>
  23. class parser;
  24. /// Unpack msgpack formatted data via a visitor
  25. /**
  26. * @param data The pointer to the buffer.
  27. * @param len The length of the buffer.
  28. * @param off The offset position of the buffer. It is read and overwritten.
  29. * @param v The visitor that satisfies visitor concept. https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#visitor-concept
  30. *
  31. * @return if unpacking process finishes without error then return true, otherwise return false.
  32. *
  33. */
  34. template <typename Visitor>
  35. bool parse(const char* data, size_t len, size_t& off, Visitor& v);
  36. /// Unpack msgpack formatted data via a visitor
  37. /**
  38. * @param data The pointer to the buffer.
  39. * @param len The length of the buffer.
  40. * @param v The visitor that satisfies visitor concept. https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_visitor#visitor-concept
  41. *
  42. * @return if unpacking process finishes without error then return true, otherwise return false.
  43. *
  44. */
  45. template <typename Visitor>
  46. bool parse(const char* data, size_t len, Visitor& v);
  47. namespace detail {
  48. template <typename Visitor>
  49. struct parse_helper;
  50. template <typename Visitor>
  51. inline parse_return
  52. parse_imp(const char* data, size_t len, size_t& off, Visitor& v);
  53. } // detail
  54. /// @cond
  55. } // MSGPACK_API_VERSION_NAMESPACE(v2)
  56. /// @endcond
  57. } // namespace msgpack
  58. #endif // MSGPACK_V2_PARSE_DECL_HPP