From b0f7f9c98f2b54e34e9344f817d30363533d108f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 6 Oct 2016 16:34:28 +0200 Subject: [PATCH] toJSON(): Support some more types --- src/libutil/json.cc | 10 ++++++++++ src/libutil/json.hh | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/libutil/json.cc b/src/libutil/json.cc index ecc3fdfe5..6023d1d4f 100644 --- a/src/libutil/json.cc +++ b/src/libutil/json.cc @@ -44,6 +44,16 @@ void toJSON(std::ostream & str, long n) str << n; } +void toJSON(std::ostream & str, unsigned int n) +{ + str << n; +} + +void toJSON(std::ostream & str, int n) +{ + str << n; +} + void toJSON(std::ostream & str, double f) { str << f; diff --git a/src/libutil/json.hh b/src/libutil/json.hh index aec456845..03eecb732 100644 --- a/src/libutil/json.hh +++ b/src/libutil/json.hh @@ -12,6 +12,8 @@ void toJSON(std::ostream & str, const char * s); void toJSON(std::ostream & str, unsigned long long n); void toJSON(std::ostream & str, unsigned long n); void toJSON(std::ostream & str, long n); +void toJSON(std::ostream & str, unsigned int n); +void toJSON(std::ostream & str, int n); void toJSON(std::ostream & str, double f); void toJSON(std::ostream & str, bool b);