mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
SpaceAnalyzer: Add a method to TreeNode to get a child node by name
This will make it easier to get to a tree node given a file path
This commit is contained in:
parent
0d67e60559
commit
ba33267132
Notes:
sideshowbarker
2024-07-17 18:46:57 +09:00
Author: https://github.com/kuzux Commit: https://github.com/SerenityOS/serenity/commit/ba33267132 Pull-request: https://github.com/SerenityOS/serenity/pull/16462 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/linusg
2 changed files with 11 additions and 0 deletions
|
@ -128,3 +128,13 @@ HashMap<int, int> TreeNode::populate_filesize_tree(Vector<MountInfo>& mounts, Fu
|
|||
update_totals();
|
||||
return error_accumulator;
|
||||
}
|
||||
|
||||
Optional<TreeNode const&> TreeNode::child_with_name(DeprecatedString name) const
|
||||
{
|
||||
for (auto& child : *m_children) {
|
||||
if (child.name() == name)
|
||||
return child;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
return 0;
|
||||
}
|
||||
TreeNode const& child_at(size_t i) const { return m_children->at(i); }
|
||||
Optional<TreeNode const&> child_with_name(DeprecatedString name) const;
|
||||
void sort_children_by_area() const;
|
||||
HashMap<int, int> populate_filesize_tree(Vector<MountInfo>& mounts, Function<void(size_t)> on_progress);
|
||||
|
||||
|
|
Loading…
Reference in a new issue