mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:07:35 +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
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();
|
update_totals();
|
||||||
return error_accumulator;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
TreeNode const& child_at(size_t i) const { return m_children->at(i); }
|
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;
|
void sort_children_by_area() const;
|
||||||
HashMap<int, int> populate_filesize_tree(Vector<MountInfo>& mounts, Function<void(size_t)> on_progress);
|
HashMap<int, int> populate_filesize_tree(Vector<MountInfo>& mounts, Function<void(size_t)> on_progress);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue