diff options
author | Andreas Kling <kling@serenityos.org> | 2023-03-06 17:16:25 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-03-06 23:46:35 +0100 |
commit | 359d6e7b0b0ef7add9eb2015d0dd664a82cf73d7 (patch) | |
tree | be51963e0f0dc7e1eeeb670188c8fe1fa5eea37f /Userland/Libraries/LibGUI/FileSystemModel.cpp | |
parent | 689ca370d4eca80eb5c3856a69c3eed4ed848a29 (diff) | |
download | serenity-359d6e7b0b0ef7add9eb2015d0dd664a82cf73d7.zip |
Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
Diffstat (limited to 'Userland/Libraries/LibGUI/FileSystemModel.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/FileSystemModel.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp index d1d2e18e64..ca1027f81e 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.cpp +++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp @@ -33,7 +33,7 @@ ModelIndex FileSystemModel::Node::index(int column) const if (!m_parent) return {}; for (size_t row = 0; row < m_parent->m_children.size(); ++row) { - if (&m_parent->m_children[row] == this) + if (m_parent->m_children[row] == this) return m_model.create_index(row, column, const_cast<Node*>(this)); } VERIFY_NOT_REACHED(); @@ -111,8 +111,8 @@ void FileSystemModel::Node::traverse_if_needed() } quick_sort(child_names); - NonnullOwnPtrVector<Node> directory_children; - NonnullOwnPtrVector<Node> file_children; + Vector<NonnullOwnPtr<Node>> directory_children; + Vector<NonnullOwnPtr<Node>> file_children; for (auto& child_name : child_names) { auto maybe_child = create_child(child_name); @@ -229,7 +229,7 @@ Optional<FileSystemModel::Node const&> FileSystemModel::node_for_path(Deprecated resolved_path = path; LexicalPath lexical_path(resolved_path); - Node const* node = m_root->m_parent_of_root ? &m_root->m_children.first() : m_root; + Node const* node = m_root->m_parent_of_root ? m_root->m_children.first() : m_root.ptr(); if (lexical_path.string() == "/") return *node; @@ -238,9 +238,9 @@ Optional<FileSystemModel::Node const&> FileSystemModel::node_for_path(Deprecated auto& part = parts[i]; bool found = false; for (auto& child : node->m_children) { - if (child.name == part) { - const_cast<Node&>(child).reify_if_needed(); - node = &child; + if (child->name == part) { + const_cast<Node&>(*child).reify_if_needed(); + node = child; found = true; if (i == parts.size() - 1) return *node; @@ -494,7 +494,7 @@ ModelIndex FileSystemModel::index(int row, int column, ModelIndex const& parent) const_cast<Node&>(node).reify_if_needed(); if (static_cast<size_t>(row) >= node.m_children.size()) return {}; - return create_index(row, column, &node.m_children[row]); + return create_index(row, column, node.m_children[row].ptr()); } ModelIndex FileSystemModel::parent_index(ModelIndex const& index) const @@ -801,9 +801,9 @@ Vector<ModelIndex> FileSystemModel::matches(StringView searching, unsigned flags node.reify_if_needed(); Vector<ModelIndex> found_indices; for (auto& child : node.m_children) { - if (string_matches(child.name, searching, flags)) { - const_cast<Node&>(child).reify_if_needed(); - found_indices.append(child.index(Column::Name)); + if (string_matches(child->name, searching, flags)) { + const_cast<Node&>(*child).reify_if_needed(); + found_indices.append(child->index(Column::Name)); if (flags & FirstMatchOnly) break; } |