From ddb907bffa2a85d2773b80714fca90de687e3fb9 Mon Sep 17 00:00:00 2001 From: Andrea Barbadoro Date: Fri, 4 Nov 2016 21:29:08 +0100 Subject: Update TgTypeParser.cpp --- src/TgTypeParser.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp index 05a287d..63ff3ce 100644 --- a/src/TgTypeParser.cpp +++ b/src/TgTypeParser.cpp @@ -102,6 +102,15 @@ string TgTypeParser::parseUser(const User::Ptr& object) const { return result; } +MessageEntity::Ptr TgTypeParser::parseJsonAndGetEntity(const ptree& data) const{ + MessageEntity::Ptr result(new MessageEntity); + result->type=data.get("type"); + result->offset=data.get("offset"); + result->length=data.get("length"); + result->url=data.get("url", ""); + return result; +} + Message::Ptr TgTypeParser::parseJsonAndGetMessage(const ptree& data) const { Message::Ptr result(new Message); result->messageId = data.get("message_id"); -- cgit v1.2.3 From 54843ab5d5ddfa695f6873b0adb53ec333b9491f Mon Sep 17 00:00:00 2001 From: Andrea Barbadoro Date: Fri, 4 Nov 2016 21:30:03 +0100 Subject: Update TgTypeParser.h --- include/tgbot/TgTypeParser.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h index 17e9553..9e5a1d7 100644 --- a/include/tgbot/TgTypeParser.h +++ b/include/tgbot/TgTypeParser.h @@ -73,6 +73,7 @@ public: std::string parseChat(const Chat::Ptr& object) const; User::Ptr parseJsonAndGetUser(const boost::property_tree::ptree& data) const; std::string parseUser(const User::Ptr& object) const; + MessageEntity::Ptr parseJsonAndGetEntity(const boost::property_tree::ptree& data) const; Message::Ptr parseJsonAndGetMessage(const boost::property_tree::ptree& data) const; std::string parseMessage(const Message::Ptr& object) const; PhotoSize::Ptr parseJsonAndGetPhotoSize(const boost::property_tree::ptree& data) const; -- cgit v1.2.3