handler.hpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // Copyright (c) 2019 Vinnie Falco ([email protected])
  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. namespace boost {
  18. namespace json {
  19. namespace detail {
  20. struct handler
  21. {
  22. static constexpr std::size_t
  23. max_object_size = object::max_size();
  24. static constexpr std::size_t
  25. max_array_size = array::max_size();
  26. static constexpr std::size_t
  27. max_key_size = string::max_size();
  28. static constexpr std::size_t
  29. max_string_size = string::max_size();
  30. value_stack st;
  31. template<class... Args>
  32. explicit
  33. handler(Args&&... args);
  34. inline bool on_document_begin(system::error_code& ec);
  35. inline bool on_document_end(system::error_code& ec);
  36. inline bool on_object_begin(system::error_code& ec);
  37. inline bool on_object_end(std::size_t n, system::error_code& ec);
  38. inline bool on_array_begin(system::error_code& ec);
  39. inline bool on_array_end(std::size_t n, system::error_code& ec);
  40. inline bool on_key_part(string_view s, std::size_t n, system::error_code& ec);
  41. inline bool on_key(string_view s, std::size_t n, system::error_code& ec);
  42. inline bool on_string_part(string_view s, std::size_t n, system::error_code& ec);
  43. inline bool on_string(string_view s, std::size_t n, system::error_code& ec);
  44. inline bool on_number_part(string_view, system::error_code&);
  45. inline bool on_int64(std::int64_t i, string_view, system::error_code& ec);
  46. inline bool on_uint64(std::uint64_t u, string_view, system::error_code& ec);
  47. inline bool on_double(double d, string_view, system::error_code& ec);
  48. inline bool on_bool(bool b, system::error_code& ec);
  49. inline bool on_null(system::error_code& ec);
  50. inline bool on_comment_part(string_view, system::error_code&);
  51. inline bool on_comment(string_view, system::error_code&);
  52. };
  53. } // detail
  54. } // namespace json
  55. } // namespace boost
  56. #endif