1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

LibCore: Add CObject::for_each_child(callback).

This commit is contained in:
Andreas Kling 2019-05-27 03:52:19 +02:00
parent 3654c33c56
commit 906fde8f8c
2 changed files with 13 additions and 3 deletions

View file

@ -20,6 +20,15 @@ public:
Vector<CObject*>& children() { return m_children; }
const Vector<CObject*>& children() const { return m_children; }
template<typename Callback>
void for_each_child(Callback callback)
{
for (auto* child : m_children) {
if (callback(*child) == IterationDecision::Abort)
return;
}
}
CObject* parent() { return m_parent; }
const CObject* parent() const { return m_parent; }