handler.hpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // Official repository: https://github.com/boostorg/json
  8. //
  9. #ifndef BOOST_JSON_DETAIL_HANDLER_HPP
  10. #define BOOST_JSON_DETAIL_HANDLER_HPP
  11. #include <boost/json/detail/config.hpp>
  12. #include <boost/json/string_view.hpp>
  13. #include <boost/json/array.hpp>
  14. #include <boost/json/object.hpp>
  15. #include <boost/json/string.hpp>
  16. #include <boost/json/value_stack.hpp>
  17. BOOST_JSON_NS_BEGIN
  18. namespace detail {
  19. struct handler
  20. {
  21. static constexpr std::size_t
  22. max_object_size = object::max_size();
  23. static constexpr std::size_t
  24. max_array_size = array::max_size();
  25. static constexpr std::size_t
  26. max_key_size = string::max_size();
  27. static constexpr std::size_t
  28. max_string_size = string::max_size();
  29. value_stack st;
  30. template<class... Args>
  31. explicit
  32. handler(Args&&... args);
  33. inline bool on_document_begin(error_code& ec);
  34. inline bool on_document_end(error_code& ec);
  35. inline bool on_object_begin(error_code& ec);
  36. inline bool on_object_end(std::size_t n, error_code& ec);
  37. inline bool on_array_begin(error_code& ec);
  38. inline bool on_array_end(std::size_t n, error_code& ec);
  39. inline bool on_key_part(string_view s, std::size_t n, error_code& ec);
  40. inline bool on_key(string_view s, std::size_t n, error_code& ec);
  41. inline bool on_string_part(string_view s, std::size_t n, error_code& ec);
  42. inline bool on_string(string_view s, std::size_t n, error_code& ec);
  43. inline bool on_number_part(string_view, error_code&);
  44. inline bool on_int64(std::int64_t i, string_view, error_code& ec);
  45. inline bool on_uint64(std::uint64_t u, string_view, error_code& ec);
  46. inline bool on_double(double d, string_view, error_code& ec);
  47. inline bool on_bool(bool b, error_code& ec);
  48. inline bool on_null(error_code& ec);
  49. inline bool on_comment_part(string_view, error_code&);
  50. inline bool on_comment(string_view, error_code&);
  51. };
  52. } // detail
  53. BOOST_JSON_NS_END
  54. #endif