From fa662a813bc36db87a83e2eae02f598f4342240f Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Tue, 29 May 2018 22:18:08 +0900 Subject: Fix build error (no matching function) --- src/TgTypeParser.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/TgTypeParser.cpp') diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp index 20ed9a2..ca7547d 100644 --- a/src/TgTypeParser.cpp +++ b/src/TgTypeParser.cpp @@ -121,7 +121,23 @@ MessageEntity::Ptr TgTypeParser::parseJsonAndGetMessageEntity(const ptree& data) result->url = data.get("url", ""); result->user = tryParseJson(&TgTypeParser::parseJsonAndGetUser, data, "user"); return result; -} +} + +string TgTypeParser::parseMessageEntity(const MessageEntity::Ptr& object) const { + if (!object) { + return ""; + } + string result; + result += '{'; + appendToJson(result, "type", object->type); + appendToJson(result, "offset", object->offset); + appendToJson(result, "length", object->length); + appendToJson(result, "url", object->url); + appendToJson(result, "user", parseUser(object->user)); + result.erase(result.length() - 1); + result += '}'; + return result; +} Message::Ptr TgTypeParser::parseJsonAndGetMessage(const ptree& data) const { auto result(make_shared()); @@ -439,9 +455,9 @@ string TgTypeParser::parseGame(const Game::Ptr& object) const { result += '{'; appendToJson(result, "title", object->title); appendToJson(result, "description", object->description); - appendToJson(result, "photo", parseArray(&TgTypeParser::parsePhotoSize, object->photo)); + appendToJson(result, "photo", parseArray(&TgTypeParser::parsePhotoSize, object->photo)); appendToJson(result, "text", object->text); - appendToJson(result, "text_entities", parseArray(&TgTypeParser::parseJsonAndGetMessageEntity, object->textEntities)); + appendToJson(result, "text_entities", parseArray(&TgTypeParser::parseMessageEntity, object->textEntities)); appendToJson(result, "animation", parseAnimation(object->animation)); result.erase(result.length() - 1); result += '}'; -- cgit v1.2.3