diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index 7bc3cf6b0..907d4a8a9 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -149,6 +149,14 @@ vector> get_text_entities_object(const vector< return result; } +StringBuilder &operator<<(StringBuilder &string_builder, const FormattedText &text) { + return string_builder << '"' << text.text << "\" with entities " << text.entities; +} + +td_api::object_ptr get_formatted_text_object(const FormattedText &text) { + return td_api::make_object(text.text, get_text_entities_object(text.entities)); +} + static bool is_word_character(uint32 code) { switch (get_unicode_simple_category(code)) { case UnicodeSimpleCategory::Letter: @@ -160,10 +168,6 @@ static bool is_word_character(uint32 code) { } } -td_api::object_ptr get_formatted_text_object(const FormattedText &text) { - return td_api::make_object(text.text, get_text_entities_object(text.entities)); -} - /* static bool is_word_boundary(uint32 a, uint32 b) { return is_word_character(a) ^ is_word_character(b); diff --git a/td/telegram/MessageEntity.h b/td/telegram/MessageEntity.h index 437909d60..47ad7302f 100644 --- a/td/telegram/MessageEntity.h +++ b/td/telegram/MessageEntity.h @@ -113,6 +113,8 @@ struct FormattedText { void parse(ParserT &parser); }; +StringBuilder &operator<<(StringBuilder &string_builder, const FormattedText &text); + inline bool operator==(const FormattedText &lhs, const FormattedText &rhs) { return lhs.text == rhs.text && lhs.entities == rhs.entities; }