14 operator std::string()
const {
21 #ifndef RAPIDJSON_ASSERT
22 #define RAPIDJSON_ASSERT(x) if (!( x )) { throw rapidjson_exception( #x, __FILE__, __LINE__ ) ;}
24 #define RAPIDJSON_ASSERT_THROWS
26 #include <rapidjson/document.h>
27 #include <rapidjson/stringbuffer.h>
28 #include <rapidjson/writer.h>
42 rapidjson::StringBuffer buffer;
43 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
46 const char* output = buffer.GetString();
48 std::string ss = output;
53 inline std::string JSONencode<std::string> (
const std::string& str) {
56 s.SetString(rapidjson::StringRef(str.c_str()));
58 rapidjson::StringBuffer buffer;
59 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
62 const char* output = buffer.GetString();
64 std::string ss = output;
70 s.SetString(rapidjson::StringRef(str));
72 rapidjson::StringBuffer buffer;
73 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
76 const char* output = buffer.GetString();
78 std::string ss = output;
84 inline std::string
JSONencode(
const double& d,
int precision = -1) {
88 rapidjson::StringBuffer buffer;
89 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
91 writer.SetMaxDecimalPlaces(precision);
94 const char* output = buffer.GetString();
96 std::string ss = output;
102 inline std::string
JSONencode(
const float& d,
int precision = -1) {
106 rapidjson::StringBuffer buffer;
107 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
109 writer.SetMaxDecimalPlaces(precision);
112 const char* output = buffer.GetString();
114 std::string ss = output;
std::string JSONencode(const T &d)
Definition: JSONutil.h:38
Support for drawing Bar charts.
Definition: alltypes.h:4
std::string filename
Definition: JSONutil.h:8
std::string why
Definition: JSONutil.h:7
int linenumber
Definition: JSONutil.h:9
rapidjson_exception(const std::string &why, const std::string &filename, const int linenumber)
Definition: JSONutil.h:11