Move stringify function to rapidjson-helpers
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "util/rapidjson-helpers.hpp"
|
||||
|
||||
#include <rapidjson/prettywriter.h>
|
||||
|
||||
namespace chatterino {
|
||||
namespace rj {
|
||||
|
||||
@@ -15,5 +17,14 @@ void addMember(rapidjson::Value &obj, const char *key, rapidjson::Value &value,
|
||||
obj.AddMember(rapidjson::Value(key, a).Move(), value.Move(), a);
|
||||
}
|
||||
|
||||
std::string stringify(const rapidjson::Value &value)
|
||||
{
|
||||
rapidjson::StringBuffer buffer;
|
||||
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
|
||||
value.Accept(writer);
|
||||
|
||||
return std::string(buffer.GetString());
|
||||
}
|
||||
|
||||
} // namespace rj
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <pajlada/settings/serialize.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
namespace chatterino {
|
||||
namespace rj {
|
||||
@@ -93,5 +94,7 @@ bool getSafe(const rapidjson::Value &value, Type &out)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string stringify(const rapidjson::Value &value);
|
||||
|
||||
} // namespace rj
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user