mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:45:06 +00:00
Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
This commit is contained in:
parent
689ca370d4
commit
359d6e7b0b
111 changed files with 517 additions and 503 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue