Make OrderedMessages::iterator private.

This commit is contained in:
levlam 2023-05-03 11:51:09 +03:00
parent 85aedaa8c0
commit 503a1e0e7e

View File

@ -137,18 +137,6 @@ class OrderedMessages {
} }
}; };
class Iterator final : public IteratorBase {
public:
Iterator() = default;
Iterator(OrderedMessage *root, MessageId message_id) : IteratorBase(root, message_id) {
}
OrderedMessage *operator*() const {
return const_cast<OrderedMessage *>(IteratorBase::operator*());
}
};
class ConstIterator final : public IteratorBase { class ConstIterator final : public IteratorBase {
public: public:
ConstIterator() = default; ConstIterator() = default;
@ -161,10 +149,6 @@ class OrderedMessages {
} }
}; };
Iterator get_iterator(MessageId message_id) {
return Iterator(messages_.get(), message_id);
}
ConstIterator get_const_iterator(MessageId message_id) const { ConstIterator get_const_iterator(MessageId message_id) const {
return ConstIterator(messages_.get(), message_id); return ConstIterator(messages_.get(), message_id);
} }
@ -199,6 +183,22 @@ class OrderedMessages {
const std::function<bool(MessageId)> &need_scan_newer) const; const std::function<bool(MessageId)> &need_scan_newer) const;
private: private:
class Iterator final : public IteratorBase {
public:
Iterator() = default;
Iterator(OrderedMessage *root, MessageId message_id) : IteratorBase(root, message_id) {
}
OrderedMessage *operator*() const {
return const_cast<OrderedMessage *>(IteratorBase::operator*());
}
};
Iterator get_iterator(MessageId message_id) {
return Iterator(messages_.get(), message_id);
}
static void do_find_older_messages(const OrderedMessage *ordered_message, MessageId max_message_id, static void do_find_older_messages(const OrderedMessage *ordered_message, MessageId max_message_id,
vector<MessageId> &message_ids); vector<MessageId> &message_ids);