mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 14:57:34 +00:00
Everywhere: Stop using NonnullRefPtrVector
This class had slightly confusing semantics and the added weirdness doesn't seem worth it just so we can say "." instead of "->" when iterating over a vector of NNRPs. This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
This commit is contained in:
parent
104be6c8ac
commit
8a48246ed1
168 changed files with 1280 additions and 1280 deletions
|
@ -17,7 +17,7 @@ void AccountHolder::add_account_with_name_and_mailboxes(DeprecatedString name, V
|
|||
auto account = AccountNode::create(move(name));
|
||||
|
||||
// This holds all of the ancestors of the current leaf folder.
|
||||
NonnullRefPtrVector<MailboxNode> folder_stack;
|
||||
Vector<NonnullRefPtr<MailboxNode>> folder_stack;
|
||||
|
||||
for (auto& mailbox : mailboxes) {
|
||||
// mailbox.name is converted to StringView to get access to split by string.
|
||||
|
@ -44,7 +44,7 @@ void AccountHolder::add_account_with_name_and_mailboxes(DeprecatedString name, V
|
|||
// Only keep the ancestors of the current leaf folder.
|
||||
folder_stack.shrink(subfolders.size() - 1);
|
||||
|
||||
parent_folder.add_child(mailbox_node);
|
||||
parent_folder->add_child(mailbox_node);
|
||||
VERIFY(!mailbox_node->has_parent());
|
||||
mailbox_node->set_parent(parent_folder);
|
||||
|
||||
|
@ -54,7 +54,7 @@ void AccountHolder::add_account_with_name_and_mailboxes(DeprecatedString name, V
|
|||
} else {
|
||||
// FIXME: This assumes that the server has the "CHILDREN" capability.
|
||||
if (mailbox.flags & (unsigned)IMAP::MailboxFlag::HasChildren) {
|
||||
if (!folder_stack.is_empty() && folder_stack.first().select_name() != mailbox.name) {
|
||||
if (!folder_stack.is_empty() && folder_stack.first()->select_name() != mailbox.name) {
|
||||
// This is a new root folder, clear the stack as there are no ancestors of the current leaf folder at this point.
|
||||
folder_stack.clear();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
m_mailboxes.append(move(mailbox));
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<MailboxNode> const& mailboxes() const { return m_mailboxes; }
|
||||
Vector<NonnullRefPtr<MailboxNode>> const& mailboxes() const { return m_mailboxes; }
|
||||
DeprecatedString const& name() const { return m_name; }
|
||||
|
||||
private:
|
||||
|
@ -44,7 +44,7 @@ private:
|
|||
}
|
||||
|
||||
DeprecatedString m_name;
|
||||
NonnullRefPtrVector<MailboxNode> m_mailboxes;
|
||||
Vector<NonnullRefPtr<MailboxNode>> m_mailboxes;
|
||||
};
|
||||
|
||||
class MailboxNode final : public BaseNode {
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
void set_parent(NonnullRefPtr<MailboxNode> parent) { m_parent = parent; }
|
||||
|
||||
bool has_children() const { return !m_children.is_empty(); }
|
||||
NonnullRefPtrVector<MailboxNode> const& children() const { return m_children; }
|
||||
Vector<NonnullRefPtr<MailboxNode>> const& children() const { return m_children; }
|
||||
void add_child(NonnullRefPtr<MailboxNode> child) { m_children.append(child); }
|
||||
|
||||
private:
|
||||
|
@ -81,7 +81,7 @@ private:
|
|||
IMAP::ListItem m_mailbox;
|
||||
DeprecatedString m_display_name;
|
||||
|
||||
NonnullRefPtrVector<MailboxNode> m_children;
|
||||
Vector<NonnullRefPtr<MailboxNode>> m_children;
|
||||
RefPtr<MailboxNode> m_parent;
|
||||
};
|
||||
|
||||
|
@ -96,7 +96,7 @@ public:
|
|||
|
||||
void add_account_with_name_and_mailboxes(DeprecatedString, Vector<IMAP::ListItem> const&);
|
||||
|
||||
NonnullRefPtrVector<AccountNode> const& accounts() const { return m_accounts; }
|
||||
Vector<NonnullRefPtr<AccountNode>> const& accounts() const { return m_accounts; }
|
||||
MailboxTreeModel& mailbox_tree_model() { return *m_mailbox_tree_model; }
|
||||
|
||||
private:
|
||||
|
@ -104,6 +104,6 @@ private:
|
|||
|
||||
void rebuild_tree();
|
||||
|
||||
NonnullRefPtrVector<AccountNode> m_accounts;
|
||||
Vector<NonnullRefPtr<AccountNode>> m_accounts;
|
||||
RefPtr<MailboxTreeModel> m_mailbox_tree_model;
|
||||
};
|
||||
|
|
|
@ -48,14 +48,14 @@ GUI::ModelIndex MailboxTreeModel::parent_index(GUI::ModelIndex const& index) con
|
|||
|
||||
if (!mailbox_node.has_parent()) {
|
||||
for (size_t row = 0; row < mailbox_node.associated_account().mailboxes().size(); ++row) {
|
||||
if (&mailbox_node.associated_account().mailboxes()[row] == &mailbox_node) {
|
||||
if (mailbox_node.associated_account().mailboxes()[row] == &mailbox_node) {
|
||||
return create_index(row, index.column(), &mailbox_node.associated_account());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
VERIFY(mailbox_node.parent()->has_children());
|
||||
for (size_t row = 0; row < mailbox_node.parent()->children().size(); ++row) {
|
||||
if (&mailbox_node.parent()->children()[row] == &mailbox_node) {
|
||||
if (mailbox_node.parent()->children()[row] == &mailbox_node) {
|
||||
return create_index(row, index.column(), mailbox_node.parent());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue