| 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 |
|
| 15 |
#ifndef dap_null_json_serializer_h |
| 16 |
#define dap_null_json_serializer_h |
| 17 |
|
| 18 |
#include "dap/protocol.h" |
| 19 |
#include "dap/serialization.h" |
| 20 |
#include "dap/types.h" |
| 21 |
|
| 22 |
namespace dap { |
| 23 |
namespace json { |
| 24 |
|
| 25 |
struct NullDeserializer : public dap::Deserializer { |
| 26 |
static NullDeserializer instance; |
| 27 |
|
| 28 |
bool deserialize(dap::boolean*) const override { return false; } |
| 29 |
bool deserialize(dap::integer*) const override { return false; } |
| 30 |
bool deserialize(dap::number*) const override { return false; } |
| 31 |
bool deserialize(dap::string*) const override { return false; } |
| 32 |
bool deserialize(dap::object*) const override { return false; } |
| 33 |
bool deserialize(dap::any*) const override { return false; } |
| 34 |
size_t count() const override { return 0; } |
| 35 |
bool array(const std::function<bool(dap::Deserializer*)>&) const override { |
| 36 |
return false; |
| 37 |
} |
| 38 |
bool field(const std::string&, |
| 39 |
const std::function<bool(dap::Deserializer*)>&) const override { |
| 40 |
return false; |
| 41 |
} |
| 42 |
}; |
| 43 |
|
| 44 |
} // namespace json |
| 45 |
} // namespace dap |
| 46 |
|
| 47 |
#endif // dap_null_json_serializer_h |