null_json_serializer.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // https://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef dap_null_json_serializer_h
  15. #define dap_null_json_serializer_h
  16. #include "dap/protocol.h"
  17. #include "dap/serialization.h"
  18. #include "dap/types.h"
  19. namespace dap {
  20. namespace json {
  21. struct NullDeserializer : public dap::Deserializer {
  22. static NullDeserializer instance;
  23. bool deserialize(dap::boolean*) const override { return false; }
  24. bool deserialize(dap::integer*) const override { return false; }
  25. bool deserialize(dap::number*) const override { return false; }
  26. bool deserialize(dap::string*) const override { return false; }
  27. bool deserialize(dap::object*) const override { return false; }
  28. bool deserialize(dap::any*) const override { return false; }
  29. size_t count() const override { return 0; }
  30. bool array(const std::function<bool(dap::Deserializer*)>&) const override {
  31. return false;
  32. }
  33. bool field(const std::string&,
  34. const std::function<bool(dap::Deserializer*)>&) const override {
  35. return false;
  36. }
  37. };
  38. } // namespace json
  39. } // namespace dap
  40. #endif // dap_null_json_serializer_h