summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorOleg Morozenkov <m@oleg.rocks>2018-03-10 16:01:06 +0300
committerOleg Morozenkov <m@oleg.rocks>2018-03-10 16:01:06 +0300
commitf7325292857ddf8b6a45c182086b637553b8fbcf (patch)
tree673d158190a0a5fbb8bd5ea1d0bd837e47fdc1e8 /include
parenta02363a26a629f2c5d94c95f31acc07cef8230d0 (diff)
Also fixes #54
Diffstat (limited to 'include')
-rw-r--r--include/tgbot/TgTypeParser.h13
1 files changed, 11 insertions, 2 deletions
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<typename T>
- 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<T>& value) const {
+ if (value == nullptr) {
return;
}
json += '"';
@@ -360,6 +360,15 @@ private:
json += ',';
}
+ template<typename T>
+ 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;