diff --git a/Userland/Libraries/LibCore/Object.h b/Userland/Libraries/LibCore/Object.h index 8e5503776f..cea9759599 100644 --- a/Userland/Libraries/LibCore/Object.h +++ b/Userland/Libraries/LibCore/Object.h @@ -128,13 +128,27 @@ public: requires IsBaseOf; template - T* find_child_of_type_named(DeprecatedString const&) + T* find_child_of_type_named(StringView) requires IsBaseOf; + template + ALWAYS_INLINE T* find_child_of_type_named(char const (&string_literal)[N]) + requires IsBaseOf + { + return find_child_of_type_named(StringView { string_literal, N - 1 }); + } + template - T* find_descendant_of_type_named(DeprecatedString const&) + T* find_descendant_of_type_named(StringView) requires IsBaseOf; + template + ALWAYS_INLINE T* find_descendant_of_type_named(char const (&string_literal)[N]) + requires IsBaseOf + { + return find_descendant_of_type_named(StringView { string_literal, N - 1 }); + } + bool is_ancestor_of(Object const&) const; Object* parent() { return m_parent; } @@ -243,7 +257,7 @@ requires IsBaseOf } template -T* Object::find_child_of_type_named(DeprecatedString const& name) +T* Object::find_child_of_type_named(StringView name) requires IsBaseOf { T* found_child = nullptr; @@ -259,7 +273,7 @@ requires IsBaseOf } template -T* Object::find_descendant_of_type_named(DeprecatedString const& name) +T* Object::find_descendant_of_type_named(StringView name) requires IsBaseOf { if (is(*this) && this->name() == name) {