aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--SplitSource.php1
-rw-r--r--td/telegram/ForumTopicId.h55
-rw-r--r--td/telegram/MessageId.h2
-rw-r--r--td/telegram/MessageTopic.h1
5 files changed, 60 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aacf2a33b..c6064508e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -817,6 +817,7 @@ set(TDLIB_SOURCE_PART2
td/telegram/ForumTopic.h
td/telegram/ForumTopicEditedData.h
td/telegram/ForumTopicIcon.h
+ td/telegram/ForumTopicId.h
td/telegram/ForumTopicInfo.h
td/telegram/ForumTopicManager.h
td/telegram/Game.h
diff --git a/SplitSource.php b/SplitSource.php
index d3a721a02..17773a68e 100644
--- a/SplitSource.php
+++ b/SplitSource.php
@@ -352,6 +352,7 @@ function split_file($file, $chunks, $undo) {
'file_reference_manager[_(-](?![.]get[(][)])|FileReferenceManager|file_references[)]' => 'FileReferenceManager',
'file_manager[_(-](?![.]get[(][)])|FileManager([^ ;.]| [^*])|update_file[)]' => 'files/FileManager',
'FolderId' => 'FolderId',
+ 'ForumTopicId' => 'ForumTopicId',
'forum_topic_manager[_(-](?![.]get[(][)])|ForumTopicManager' => 'ForumTopicManager',
'game_manager[_(-](?![.]get[(][)])|GameManager' => 'GameManager',
'G[(][)]|Global[^A-Za-z]' => 'Global',
diff --git a/td/telegram/ForumTopicId.h b/td/telegram/ForumTopicId.h
new file mode 100644
index 000000000..3139abc7d
--- /dev/null
+++ b/td/telegram/ForumTopicId.h
@@ -0,0 +1,55 @@
+//
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2025
+//
+// 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/utils/common.h"
+#include "td/utils/HashTableUtils.h"
+#include "td/utils/StringBuilder.h"
+
+#include <type_traits>
+
+namespace td {
+
+class ForumTopicId {
+ int32 id_ = 0;
+
+ public:
+ ForumTopicId() = default;
+
+ explicit constexpr ForumTopicId(int32 forum_topic_id) : id_(forum_topic_id) {
+ }
+ template <class T, typename = std::enable_if_t<std::is_convertible<T, int32>::value>>
+ ForumTopicId(T forum_topic_id) = delete;
+
+ bool is_valid() const {
+ return id_ > 0;
+ }
+
+ int32 get() const {
+ return id_;
+ }
+
+ bool operator==(const ForumTopicId &other) const {
+ return id_ == other.id_;
+ }
+
+ bool operator!=(const ForumTopicId &other) const {
+ return id_ != other.id_;
+ }
+};
+
+struct ForumTopicIdHash {
+ uint32 operator()(ForumTopicId forum_topic_id) const {
+ return Hash<int32>()(forum_topic_id.get());
+ }
+};
+
+inline StringBuilder &operator<<(StringBuilder &string_builder, ForumTopicId forum_topic_id) {
+ return string_builder << "forum topic " << forum_topic_id.get();
+}
+
+} // namespace td
diff --git a/td/telegram/MessageId.h b/td/telegram/MessageId.h
index 48ee952a9..7cc83e14c 100644
--- a/td/telegram/MessageId.h
+++ b/td/telegram/MessageId.h
@@ -206,4 +206,6 @@ struct MessageIdHash {
}
};
+StringBuilder &operator<<(StringBuilder &string_builder, MessageId message_id);
+
} // namespace td
diff --git a/td/telegram/MessageTopic.h b/td/telegram/MessageTopic.h
index f365b065b..b8bcf8e6e 100644
--- a/td/telegram/MessageTopic.h
+++ b/td/telegram/MessageTopic.h
@@ -7,6 +7,7 @@
#pragma once
#include "td/telegram/DialogId.h"
+#include "td/telegram/ForumTopicId.h"
#include "td/telegram/MessageId.h"
#include "td/telegram/SavedMessagesTopicId.h"
#include "td/telegram/td_api.h"