null_visitor.hpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // MessagePack for C++ deserializing routine
  3. //
  4. // Copyright (C) 2017 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_NULL_VISITOR_HPP
  11. #define MSGPACK_V2_NULL_VISITOR_HPP
  12. #include "msgpack/v2/null_visitor_decl.hpp"
  13. namespace msgpack {
  14. /// @cond
  15. MSGPACK_API_VERSION_NAMESPACE(v2) {
  16. /// @endcond
  17. struct null_visitor {
  18. bool visit_nil() {
  19. return true;
  20. }
  21. bool visit_boolean(bool /*v*/) {
  22. return true;
  23. }
  24. bool visit_positive_integer(uint64_t /*v*/) {
  25. return true;
  26. }
  27. bool visit_negative_integer(int64_t /*v*/) {
  28. return true;
  29. }
  30. bool visit_float32(float /*v*/) {
  31. return true;
  32. }
  33. bool visit_float64(double /*v*/) {
  34. return true;
  35. }
  36. bool visit_str(const char* /*v*/, uint32_t /*size*/) {
  37. return true;
  38. }
  39. bool visit_bin(const char* /*v*/, uint32_t /*size*/) {
  40. return true;
  41. }
  42. bool visit_ext(const char* /*v*/, uint32_t /*size*/) {
  43. return true;
  44. }
  45. bool start_array(uint32_t /*num_elements*/) {
  46. return true;
  47. }
  48. bool start_array_item() {
  49. return true;
  50. }
  51. bool end_array_item() {
  52. return true;
  53. }
  54. bool end_array() {
  55. return true;
  56. }
  57. bool start_map(uint32_t /*num_kv_pairs*/) {
  58. return true;
  59. }
  60. bool start_map_key() {
  61. return true;
  62. }
  63. bool end_map_key() {
  64. return true;
  65. }
  66. bool start_map_value() {
  67. return true;
  68. }
  69. bool end_map_value() {
  70. return true;
  71. }
  72. bool end_map() {
  73. return true;
  74. }
  75. void parse_error(size_t /*parsed_offset*/, size_t /*error_offset*/) {
  76. }
  77. void insufficient_bytes(size_t /*parsed_offset*/, size_t /*error_offset*/) {
  78. }
  79. bool referenced() const {
  80. return false;
  81. }
  82. void set_referenced(bool /*referenced*/) {
  83. }
  84. };
  85. /// @cond
  86. } // MSGPACK_API_VERSION_NAMESPACE(v2)
  87. /// @endcond
  88. } // namespace msgpack
  89. #endif // MSGPACK_V2_NULL_VISITOR_HPP