diff options
author | Egor Pugin <egor.pugin@gmail.com> | 2020-03-14 17:34:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-14 17:34:07 +0300 |
commit | b3e84e58d471412b9d26e173b77c757d93d57b19 (patch) | |
tree | 5ad991beda3975e8d8237562724e20f30d169d40 /src/TgTypeParser.cpp | |
parent | 9afa9c4e97faa9a6d7e6089ec1f822047738fdec (diff) | |
parent | 64174491dac84c559db5c48ed850177fa3eb4da0 (diff) |
Merge pull request #133 from JellyBrick/master
Fix #127, #128 & Code quality improvements
Diffstat (limited to 'src/TgTypeParser.cpp')
-rw-r--r-- | src/TgTypeParser.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp index e002c60..4d91d28 100644 --- a/src/TgTypeParser.cpp +++ b/src/TgTypeParser.cpp @@ -377,8 +377,8 @@ Poll::Ptr TgTypeParser::parseJsonAndGetPoll(const ptree& data) const { auto result(make_shared<Poll>()); result->id = data.get("id", 0); result->question = data.get("question", ""); - result->options = tryParseJson<PollOption>(&TgTypeParser::parseJsonAndGetPollOption, data, "options"); - result->is_closed = data.get<bool>("is_closed"); + result->options = parseJsonAndGetArray<PollOption>(&TgTypeParser::parseJsonAndGetPollOption, data, "options"); + result->isClosed = data.get<bool>("is_closed"); return result; } @@ -390,8 +390,8 @@ string TgTypeParser::parsePoll(const Poll::Ptr& object) const { result += '{'; appendToJson(result, "id", object->id); appendToJson(result, "question", object->question); - appendToJson(result, "options", parsePollOption(object->options)); - appendToJson(result, "is_closed", object->is_closed); + appendToJson(result, "options", parseArray(&TgTypeParser::parsePollOption, object->options)); + appendToJson(result, "is_closed", object->isClosed); removeLastComma(result); result += '}'; return result; @@ -400,7 +400,7 @@ string TgTypeParser::parsePoll(const Poll::Ptr& object) const { PollOption::Ptr TgTypeParser::parseJsonAndGetPollOption(const ptree& data) const { auto result(make_shared<PollOption>()); result->text = data.get("text", ""); - result->voter_count = data.get("voter_count", 0); + result->voterCount = data.get("voter_count", 0); return result; } @@ -411,7 +411,7 @@ string TgTypeParser::parsePollOption(const PollOption::Ptr& object) const { string result; result += '{'; appendToJson(result, "text", object->text); - appendToJson(result, "voter_count", object->voter_count); + appendToJson(result, "voter_count", object->voterCount); removeLastComma(result); result += '}'; return result; |