2#include <ossia/detail/config.hpp>
4#include <ossia/detail/string_view.hpp>
18#include <rapidjson/document.h>
19#include <rapidjson/writer.h>
25using json_writer = rapidjson::Writer<
26 rapidjson::StringBuffer, rapidjson::UTF8<>, rapidjson::UTF8<>,
27 rapidjson::CrtAllocator, rapidjson::WriteFlag::kWriteNanAndInfFlag>;
29inline std::string get_string(
const rapidjson::Value& val)
31 return std::string{val.GetString(), val.GetStringLength()};
33inline std::string_view get_string_view(
const rapidjson::Value& val)
35 return std::string_view{val.GetString(), val.GetStringLength()};
38inline void write_json_key(ossia::json_writer& writer, std::string_view k)
40 writer.Key(k.data(), k.size());
43inline void write_json(ossia::json_writer& writer, std::string_view k)
45 writer.String(k.data(), k.size());
48inline void write_json(ossia::json_writer& writer,
char c)
53inline std::string json_to_str(
const rapidjson::StringBuffer& other)
55 return {other.GetString(), other.GetSize()};