JSONObject: Support floats and booleans
This commit is contained in:
parent
7251a81bde
commit
7a173a7be1
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue