From f7325292857ddf8b6a45c182086b637553b8fbcf Mon Sep 17 00:00:00 2001 From: Oleg Morozenkov Date: Sat, 10 Mar 2018 16:01:06 +0300 Subject: Also fixes #54 --- include/tgbot/TgTypeParser.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h index e593d6a..2faaf45 100644 --- a/include/tgbot/TgTypeParser.h +++ b/include/tgbot/TgTypeParser.h @@ -349,8 +349,8 @@ public: private: template - void appendToJson(std::string& json, const std::string& varName, const T& value) const { - if (value == 0) { + void appendToJson(std::string& json, const std::string& varName, const std::shared_ptr& value) const { + if (value == nullptr) { return; } json += '"'; @@ -360,6 +360,15 @@ private: json += ','; } + template + void appendToJson(std::string& json, const std::string& varName, const T& value) const { + json += '"'; + json += varName; + json += "\":"; + json += value; + json += ','; + } + void appendToJson(std::string& json, const std::string& varName, const bool& value) const { json += '"'; json += varName; -- cgit v1.2.3