aboutsummaryrefslogtreecommitdiffhomepage
path: root/td/telegram/NotificationType.h
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2018-11-10 01:56:00 +0300
committerlevlam <levlam@telegram.org>2018-11-10 01:56:00 +0300
commit4605f56d3ce400cd61ff09ee8bf3eed2855db7c9 (patch)
treec5aed1168297ce504b2d00f7c1170327dbc04e75 /td/telegram/NotificationType.h
parent5f23a99fca53f30531e18fa6c98c9af2601b5373 (diff)
Add class NotificationType.
GitOrigin-RevId: 16951bb0dd0d13a1f3332449350fed4a4a1ef13e
Diffstat (limited to 'td/telegram/NotificationType.h')
-rw-r--r--td/telegram/NotificationType.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/td/telegram/NotificationType.h b/td/telegram/NotificationType.h
new file mode 100644
index 000000000..d7672a8f3
--- /dev/null
+++ b/td/telegram/NotificationType.h
@@ -0,0 +1,47 @@
+//
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2018
+//
+// 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/CallId.h"
+#include "td/telegram/MessageId.h"
+
+#include "td/utils/common.h"
+#include "td/utils/StringBuilder.h"
+
+namespace td {
+
+class NotificationType {
+ public:
+ NotificationType() = default;
+ NotificationType(const NotificationType &) = delete;
+ NotificationType &operator=(const NotificationType &) = delete;
+ NotificationType(NotificationType &&) = delete;
+ NotificationType &operator=(NotificationType &&) = delete;
+
+ virtual ~NotificationType() {
+ }
+
+ virtual StringBuilder &to_string_builder(StringBuilder &string_builder) const = 0;
+
+ protected:
+ // append only
+ enum class Type : int32 { Message, SecretChat, Call };
+
+ virtual Type get_type() const = 0;
+};
+
+inline StringBuilder &operator<<(StringBuilder &string_builder, const NotificationType &notification_type) {
+ return notification_type.to_string_builder(string_builder);
+}
+
+unique_ptr<NotificationType> create_new_message_notification(MessageId message_id);
+
+unique_ptr<NotificationType> create_new_secret_chat_notification();
+
+unique_ptr<NotificationType> create_new_call_notification(CallId call_id);
+
+} // namespace td