formatters/JSON: Make JSON::NullDoubleWriter use zeek::json::detail version

Not using inheritance and preferring composition to avoid including the
detail/json.h header do an indirection via a unique_ptr and then just
re-use the Double() implementation.
This commit is contained in:
Arne Welzel 2023-06-17 14:09:03 +02:00
parent 7c3b5553d8
commit d892cac58c
2 changed files with 12 additions and 8 deletions

View file

@ -2,6 +2,8 @@
#pragma once
#include <memory>
#define RAPIDJSON_HAS_STDSTRING 1
// Remove in v7.1 when removing NullDoubleWriter below and also remove
// rapidjson include tweaks from CMake's dynamic_plugin_base target.
@ -46,11 +48,11 @@ public:
{
public:
[[deprecated("Remove in v7.1 - This is an implementation detail.")]] NullDoubleWriter(
rapidjson::StringBuffer& stream)
: rapidjson::Writer<rapidjson::StringBuffer>(stream)
{
}
rapidjson::StringBuffer& stream);
bool Double(double d);
private:
std::unique_ptr<json::detail::NullDoubleWriter> writer;
};
private: