Add class QuickReplyMessageFullId.
This commit is contained in:
parent
b2884dcd0b
commit
cc40178558
@ -801,6 +801,7 @@ set(TDLIB_SOURCE
|
||||
td/telegram/QueryCombiner.h
|
||||
td/telegram/QueryMerger.h
|
||||
td/telegram/QuickReplyManager.h
|
||||
td/telegram/QuickReplyMessageFullId.h
|
||||
td/telegram/QuickReplyShortcutId.h
|
||||
td/telegram/ReactionListType.h
|
||||
td/telegram/ReactionManager.h
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/QuickReplyMessageFullId.h"
|
||||
#include "td/telegram/QuickReplyShortcutId.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/UserId.h"
|
||||
|
79
td/telegram/QuickReplyMessageFullId.h
Normal file
79
td/telegram/QuickReplyMessageFullId.h
Normal file
@ -0,0 +1,79 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
||||
//
|
||||
// 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/MessageId.h"
|
||||
#include "td/telegram/QuickReplyShortcutId.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/HashTableUtils.h"
|
||||
#include "td/utils/StringBuilder.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
struct QuickReplyMessageFullId {
|
||||
private:
|
||||
QuickReplyShortcutId quick_reply_shortcut_id;
|
||||
MessageId message_id;
|
||||
|
||||
public:
|
||||
QuickReplyMessageFullId() = default;
|
||||
|
||||
QuickReplyMessageFullId(QuickReplyShortcutId quick_reply_shortcut_id, MessageId message_id)
|
||||
: quick_reply_shortcut_id(quick_reply_shortcut_id), message_id(message_id) {
|
||||
}
|
||||
|
||||
bool operator==(const QuickReplyMessageFullId &other) const {
|
||||
return quick_reply_shortcut_id == other.quick_reply_shortcut_id && message_id == other.message_id;
|
||||
}
|
||||
|
||||
bool operator!=(const QuickReplyMessageFullId &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
QuickReplyShortcutId get_quick_reply_shortcut_id() const {
|
||||
return quick_reply_shortcut_id;
|
||||
}
|
||||
|
||||
MessageId get_message_id() const {
|
||||
return message_id;
|
||||
}
|
||||
|
||||
bool is_valid() const {
|
||||
return quick_reply_shortcut_id.is_valid() && message_id.is_valid();
|
||||
}
|
||||
|
||||
bool is_server() const {
|
||||
return quick_reply_shortcut_id.is_valid() && message_id.is_server();
|
||||
}
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const {
|
||||
quick_reply_shortcut_id.store(storer);
|
||||
message_id.store(storer);
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
void parse(ParserT &parser) {
|
||||
quick_reply_shortcut_id.parse(parser);
|
||||
message_id.parse(parser);
|
||||
}
|
||||
};
|
||||
|
||||
struct QuickReplyMessageFullIdHash {
|
||||
uint32 operator()(QuickReplyMessageFullId quick_reply_message_full_id) const {
|
||||
return combine_hashes(QuickReplyShortcutIdHash()(quick_reply_message_full_id.get_quick_reply_shortcut_id()),
|
||||
MessageIdHash()(quick_reply_message_full_id.get_message_id()));
|
||||
}
|
||||
};
|
||||
|
||||
inline StringBuilder &operator<<(StringBuilder &string_builder, QuickReplyMessageFullId quick_reply_message_full_id) {
|
||||
return string_builder << quick_reply_message_full_id.get_message_id() << " from "
|
||||
<< quick_reply_message_full_id.get_quick_reply_shortcut_id();
|
||||
}
|
||||
|
||||
} // namespace td
|
Loading…
Reference in New Issue
Block a user