X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Fjson.hpp;h=14ff501f5681777a19a56b8321643d2e68239388;hb=2fadd9f1a481ac870636ae737e6815473894e76f;hp=621610af4451c0720c796ee0c366d8fe2b91deb3;hpb=02bf5b48c041ef6fb575953b911e4268a44a9a9f;p=apitrace diff --git a/common/json.hpp b/common/json.hpp index 621610a..14ff501 100644 --- a/common/json.hpp +++ b/common/json.hpp @@ -306,6 +306,25 @@ public: space = ' '; } + + /** + * Special case for char to prevent it to be written as a literal + * character. + */ + inline void writeNumber(char n) { + separator(); + os << std::dec << static_cast(n); + value = true; + space = ' '; + } + + inline void writeNumber(unsigned char n) { + separator(); + os << std::dec << static_cast(n); + value = true; + space = ' '; + } + template inline void writeNumber(T n) { if (n != n) {