mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
JSONObject: Support floats and booleans
This commit is contained in:
parent
7251a81bde
commit
7a173a7be1
1 changed files with 12 additions and 1 deletions
|
@ -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