14 operator std::string()
const {
21 #define RAPIDJSON_ASSERT(x) if (!( x )) { throw rapidjson_exception( #x, __FILE__, __LINE__ ) ;}
22 #define RAPIDJSON_ASSERT_THROWS
24 #include <rapidjson/document.h>
25 #include <rapidjson/stringbuffer.h>
26 #include <rapidjson/writer.h>
40 rapidjson::StringBuffer buffer;
41 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
44 const char* output = buffer.GetString();
46 std::string ss = output;
51 inline std::string JSONencode<std::string> (
const std::string& str) {
54 s.SetString(rapidjson::StringRef(str.c_str()));
56 rapidjson::StringBuffer buffer;
57 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
60 const char* output = buffer.GetString();
62 std::string ss = output;
68 s.SetString(rapidjson::StringRef(str));
70 rapidjson::StringBuffer buffer;
71 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
74 const char* output = buffer.GetString();
76 std::string ss = output;
82 inline std::string
JSONencode(
const double& d,
int precision = -1) {
86 rapidjson::StringBuffer buffer;
87 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
89 writer.SetMaxDecimalPlaces(precision);
92 const char* output = buffer.GetString();
94 std::string ss = output;
100 inline std::string
JSONencode(
const float& d,
int precision = -1) {
104 rapidjson::StringBuffer buffer;
105 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
107 writer.SetMaxDecimalPlaces(precision);
110 const char* output = buffer.GetString();
112 std::string ss = output;
std::string JSONencode(const T &d)
Definition: JSONutil.h:36
these methods convert byte arrays in to base64 codes and are used in BRIDGES to represent the color a...
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