JSONObject: Support floats and booleans

This commit is contained in:
Eelco Dolstra 2016-02-19 14:24:04 +01:00
parent 7251a81bde
commit 7a173a7be1

View file

@ -36,7 +36,18 @@ struct JSONObject
attr(s);
escapeJSON(str, t);
}
void attr(const string & s, int n)
void attr(const string & s, const char * t)
{
attr(s);
escapeJSON(str, t);
}
void attr(const string & s, bool b)
{
attr(s);
str << (b ? "true" : "false");
}
template<typename T>
void attr(const string & s, const T & n)
{
attr(s);
str << n;