Make some OrderedMessage fields private.
This commit is contained in:
parent
128aec1d59
commit
b00dfaf493
@ -171,8 +171,8 @@ OrderedMessages::AttachInfo OrderedMessages::auto_attach_message(MessageId messa
|
|||||||
return {false, false};
|
return {false, false};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_find_older_messages(const OrderedMessage *ordered_message, MessageId max_message_id,
|
void OrderedMessages::do_find_older_messages(const OrderedMessage *ordered_message, MessageId max_message_id,
|
||||||
vector<MessageId> &message_ids) {
|
vector<MessageId> &message_ids) {
|
||||||
if (ordered_message == nullptr) {
|
if (ordered_message == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -192,8 +192,8 @@ vector<MessageId> OrderedMessages::find_older_messages(MessageId max_message_id)
|
|||||||
return message_ids;
|
return message_ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_find_newer_messages(const OrderedMessage *ordered_message, MessageId min_message_id,
|
void OrderedMessages::do_find_newer_messages(const OrderedMessage *ordered_message, MessageId min_message_id,
|
||||||
vector<MessageId> &message_ids) {
|
vector<MessageId> &message_ids) {
|
||||||
if (ordered_message == nullptr) {
|
if (ordered_message == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -213,8 +213,8 @@ vector<MessageId> OrderedMessages::find_newer_messages(MessageId min_message_id)
|
|||||||
return message_ids;
|
return message_ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MessageId do_find_message_by_date(const OrderedMessage *ordered_message, int32 date,
|
MessageId OrderedMessages::do_find_message_by_date(const OrderedMessage *ordered_message, int32 date,
|
||||||
const std::function<int32(MessageId)> &get_message_date) {
|
const std::function<int32(MessageId)> &get_message_date) {
|
||||||
if (ordered_message == nullptr) {
|
if (ordered_message == nullptr) {
|
||||||
return MessageId();
|
return MessageId();
|
||||||
}
|
}
|
||||||
@ -237,9 +237,9 @@ MessageId OrderedMessages::find_message_by_date(int32 date,
|
|||||||
return do_find_message_by_date(messages_.get(), date, get_message_date);
|
return do_find_message_by_date(messages_.get(), date, get_message_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_find_messages_by_date(const OrderedMessage *ordered_message, int32 min_date, int32 max_date,
|
void OrderedMessages::do_find_messages_by_date(const OrderedMessage *ordered_message, int32 min_date, int32 max_date,
|
||||||
const std::function<int32(MessageId)> &get_message_date,
|
const std::function<int32(MessageId)> &get_message_date,
|
||||||
vector<MessageId> &message_ids) {
|
vector<MessageId> &message_ids) {
|
||||||
if (ordered_message == nullptr) {
|
if (ordered_message == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -263,9 +263,9 @@ vector<MessageId> OrderedMessages::find_messages_by_date(
|
|||||||
return message_ids;
|
return message_ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_traverse_messages(const OrderedMessage *ordered_message,
|
void OrderedMessages::do_traverse_messages(const OrderedMessage *ordered_message,
|
||||||
const std::function<bool(MessageId)> &need_scan_older,
|
const std::function<bool(MessageId)> &need_scan_older,
|
||||||
const std::function<bool(MessageId)> &need_scan_newer) {
|
const std::function<bool(MessageId)> &need_scan_newer) {
|
||||||
if (ordered_message == nullptr) {
|
if (ordered_message == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -14,16 +14,20 @@
|
|||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
struct OrderedMessage {
|
class OrderedMessage {
|
||||||
int32 random_y = 0;
|
public:
|
||||||
|
MessageId message_id;
|
||||||
|
|
||||||
bool have_previous = false;
|
bool have_previous = false;
|
||||||
bool have_next = false;
|
bool have_next = false;
|
||||||
|
|
||||||
MessageId message_id;
|
private:
|
||||||
|
int32 random_y = 0;
|
||||||
|
|
||||||
unique_ptr<OrderedMessage> left;
|
unique_ptr<OrderedMessage> left;
|
||||||
unique_ptr<OrderedMessage> right;
|
unique_ptr<OrderedMessage> right;
|
||||||
|
|
||||||
|
friend class OrderedMessages;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OrderedMessages {
|
class OrderedMessages {
|
||||||
@ -191,6 +195,23 @@ class OrderedMessages {
|
|||||||
const std::function<bool(MessageId)> &need_scan_newer) const;
|
const std::function<bool(MessageId)> &need_scan_newer) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static void do_find_older_messages(const OrderedMessage *ordered_message, MessageId max_message_id,
|
||||||
|
vector<MessageId> &message_ids);
|
||||||
|
|
||||||
|
static void do_find_newer_messages(const OrderedMessage *ordered_message, MessageId min_message_id,
|
||||||
|
vector<MessageId> &message_ids);
|
||||||
|
|
||||||
|
static MessageId do_find_message_by_date(const OrderedMessage *ordered_message, int32 date,
|
||||||
|
const std::function<int32(MessageId)> &get_message_date);
|
||||||
|
|
||||||
|
static void do_find_messages_by_date(const OrderedMessage *ordered_message, int32 min_date, int32 max_date,
|
||||||
|
const std::function<int32(MessageId)> &get_message_date,
|
||||||
|
vector<MessageId> &message_ids);
|
||||||
|
|
||||||
|
static void do_traverse_messages(const OrderedMessage *ordered_message,
|
||||||
|
const std::function<bool(MessageId)> &need_scan_older,
|
||||||
|
const std::function<bool(MessageId)> &need_scan_newer);
|
||||||
|
|
||||||
unique_ptr<OrderedMessage> messages_;
|
unique_ptr<OrderedMessage> messages_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user