1 #ifndef CPPGRAM_MESSAGEENTITY_HPP 2 #define CPPGRAM_MESSAGEENTITY_HPP 5 #include <experimental/optional> 40 std::experimental::optional<std::string>
url;
43 std::experimental::optional<User>
user;
46 : offset( json_message_entity[
"offset"].asInt() )
47 , length( json_message_entity[
"length"].asInt() )
49 std::vector<std::string> entity_strings = {
"mention",
62 std::string entity_type = json_message_entity[
"type"].asString();
63 while ( i > 0 && entity_type.compare( entity_strings[i] ) != 0 )
70 if ( !json_message_entity[
"url"].isNull() )
72 url.emplace( json_message_entity[
"url"].asString() );
75 if ( !json_message_entity[
"user"].isNull() )
77 user.emplace(
User( json_message_entity[
"user"] ) );
std::experimental::optional< User > user
Optional. For “text_mention” only, the mentioned user
Definition: message_entity.hpp:43
int offset
Offset in UTF-16 code units to the start of the entity.
Definition: message_entity.hpp:33
EMessageEntity type
Type of the entity.
Definition: message_entity.hpp:30
Entity in the message.
Definition: message_entity.hpp:24
int length
Length of the entity in UTF-16 code units.
Definition: message_entity.hpp:33
EMessageEntity
Type of the entity.
Definition: enums.hpp:28
main namespace for Cppgram
std::experimental::optional< std::string > url
Optional. For “text_link” only, url that will be opened after user taps on the text ...
Definition: message_entity.hpp:40
User object.
Definition: user.hpp:20