diff options
| -rw-r--r-- | CMakeLists.txt | 3 | ||||
| -rw-r--r-- | SplitSource.php | 3 | ||||
| -rw-r--r-- | td/generate/scheme/td_api.tl | 5 | ||||
| -rw-r--r-- | td/telegram/AiComposeToneExample.cpp | 31 | ||||
| -rw-r--r-- | td/telegram/AiComposeToneExample.h | 47 | ||||
| -rw-r--r-- | td/telegram/AiComposeToneExample.hpp | 32 |
6 files changed, 120 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 288b7efd5..bc3a9bc70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -345,6 +345,7 @@ set(TDLIB_SOURCE_PART1 td/telegram/AffiliateType.cpp td/telegram/AgeVerificationParameters.cpp td/telegram/AiComposeTone.cpp + td/telegram/AiComposeToneExample.cpp td/telegram/AlarmManager.cpp td/telegram/AnimationsManager.cpp td/telegram/Application.cpp @@ -703,6 +704,7 @@ set(TDLIB_SOURCE_PART2 td/telegram/AffiliateType.h td/telegram/AgeVerificationParameters.h td/telegram/AiComposeTone.h + td/telegram/AiComposeToneExample.h td/telegram/AlarmManager.h td/telegram/AnimationsManager.h td/telegram/Application.h @@ -1128,6 +1130,7 @@ set(TDLIB_SOURCE_PART2 td/telegram/AgeVerificationParameters.hpp td/telegram/AiComposeTone.hpp + td/telegram/AiComposeToneExample.hpp td/telegram/AnimationsManager.hpp td/telegram/AudiosManager.hpp td/telegram/AuthManager.hpp diff --git a/SplitSource.php b/SplitSource.php index 03d861e1c..4915cde9b 100644 --- a/SplitSource.php +++ b/SplitSource.php @@ -287,7 +287,8 @@ function split_file($file, $chunks, $undo) { 'ActiveStoryState' => 'ActiveStoryState', 'AffiliateType' => 'AffiliateType', 'AgeVerificationParameters' => 'AgeVerificationParameters', - 'AiComposeTone' => 'AiComposeTone', + 'AiComposeTone[^A-Z]' => 'AiComposeTone', + 'AiComposeToneExample' => 'AiComposeToneExample', 'alarm_manager[_(-](?![.]get[(][)])|AlarmManager' => 'AlarmManager', 'animations_manager[_(-](?![.]get[(][)])|AnimationsManager[^;>]' => 'AnimationsManager', 'attach_menu_manager[_(-](?![.]get[(][)])|AttachMenuManager[^;>]' => 'AttachMenuManager', diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 6326ee334..4868c707e 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -126,6 +126,11 @@ diffText text:string entities:vector<diffEntity> = DiffText; fixedText text:formattedText diff_text:diffText = FixedText; +//@description Contains an example of text composition style usage +//@source_text Source text +//@result_text The text after the style was applied to the source text +textCompositionStyleExample source_text:formattedText result_text:formattedText = TextCompositionStyleExample; + //@description Describes a style that can be used to compose a text //@name Name of the style //@custom_emoji_id Identifier of the custom emoji corresponding to the style; 0 if none diff --git a/td/telegram/AiComposeToneExample.cpp b/td/telegram/AiComposeToneExample.cpp new file mode 100644 index 000000000..585f89b4e --- /dev/null +++ b/td/telegram/AiComposeToneExample.cpp @@ -0,0 +1,31 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2026 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +#include "td/telegram/AiComposeToneExample.h" + +namespace td { + +AiComposeToneExample::AiComposeToneExample(telegram_api::object_ptr<telegram_api::aiComposeToneExample> &&example) { + if (example != nullptr) { + from_text_ = get_formatted_text(nullptr, std::move(example->from_), true, false, "AiComposeToneExample from"); + to_text_ = get_formatted_text(nullptr, std::move(example->to_), true, false, "AiComposeToneExample to"); + } +} + +td_api::object_ptr<td_api::textCompositionStyleExample> +AiComposeToneExample::get_text_composition_style_example_object() const { + if (is_empty()) { + return nullptr; + } + return td_api::make_object<td_api::textCompositionStyleExample>( + get_formatted_text_object(nullptr, from_text_, true, -1), get_formatted_text_object(nullptr, to_text_, true, -1)); +} + +bool operator==(const AiComposeToneExample &lhs, const AiComposeToneExample &rhs) { + return lhs.from_text_ == rhs.from_text_ && lhs.to_text_ == rhs.to_text_; +} + +} // namespace td diff --git a/td/telegram/AiComposeToneExample.h b/td/telegram/AiComposeToneExample.h new file mode 100644 index 000000000..25d3b3df4 --- /dev/null +++ b/td/telegram/AiComposeToneExample.h @@ -0,0 +1,47 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2026 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +#pragma once + +#include "td/telegram/MessageEntity.h" +#include "td/telegram/td_api.h" +#include "td/telegram/telegram_api.h" + +#include "td/utils/common.h" + +namespace td { + +class AiComposeToneExample { + FormattedText from_text_; + FormattedText to_text_; + + friend bool operator==(const AiComposeToneExample &lhs, const AiComposeToneExample &rhs); + + public: + AiComposeToneExample() = default; + + explicit AiComposeToneExample(telegram_api::object_ptr<telegram_api::aiComposeToneExample> &&example); + + bool is_empty() const { + return from_text_.text.empty() && to_text_.text.empty(); + } + + td_api::object_ptr<td_api::textCompositionStyleExample> get_text_composition_style_example_object() const; + + template <class StorerT> + void store(StorerT &storer) const; + + template <class ParserT> + void parse(ParserT &parser); +}; + +bool operator==(const AiComposeToneExample &lhs, const AiComposeToneExample &rhs); + +inline bool operator!=(const AiComposeToneExample &lhs, const AiComposeToneExample &rhs) { + return !(lhs == rhs); +} + +} // namespace td diff --git a/td/telegram/AiComposeToneExample.hpp b/td/telegram/AiComposeToneExample.hpp new file mode 100644 index 000000000..dec0b8b65 --- /dev/null +++ b/td/telegram/AiComposeToneExample.hpp @@ -0,0 +1,32 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2026 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +#pragma once + +#include "td/telegram/AiComposeToneExample.h" + +#include "td/utils/common.h" +#include "td/utils/tl_helpers.h" + +namespace td { + +template <class StorerT> +void AiComposeToneExample::store(StorerT &storer) const { + BEGIN_STORE_FLAGS(); + END_STORE_FLAGS(); + td::store(from_text_, storer); + td::store(to_text_, storer); +} + +template <class ParserT> +void AiComposeToneExample::parse(ParserT &parser) { + BEGIN_PARSE_FLAGS(); + END_PARSE_FLAGS(); + td::parse(from_text_, parser); + td::parse(to_text_, parser); +} + +} // namespace td |
