diff --git a/Userland/Libraries/LibCore/Object.cpp b/Userland/Libraries/LibCore/Object.cpp index 13c57baebf..3711653547 100644 --- a/Userland/Libraries/LibCore/Object.cpp +++ b/Userland/Libraries/LibCore/Object.cpp @@ -195,7 +195,7 @@ void Object::save_to(JsonObject& json) } } -JsonValue Object::property(const StringView& name) const +JsonValue Object::property(String const& name) const { auto it = m_properties.find(name); if (it == m_properties.end()) @@ -203,7 +203,7 @@ JsonValue Object::property(const StringView& name) const return it->value->get(); } -bool Object::set_property(const StringView& name, const JsonValue& value) +bool Object::set_property(String const& name, JsonValue const& value) { auto it = m_properties.find(name); if (it == m_properties.end()) diff --git a/Userland/Libraries/LibCore/Object.h b/Userland/Libraries/LibCore/Object.h index 21980c8b0e..dd76f2592a 100644 --- a/Userland/Libraries/LibCore/Object.h +++ b/Userland/Libraries/LibCore/Object.h @@ -75,7 +75,7 @@ public: virtual const char* class_name() const = 0; const String& name() const { return m_name; } - void set_name(const StringView& name) { m_name = name; } + void set_name(String name) { m_name = move(name); } NonnullRefPtrVector& children() { return m_children; } const NonnullRefPtrVector& children() const { return m_children; } @@ -120,8 +120,8 @@ public: void save_to(JsonObject&); - bool set_property(const StringView& name, const JsonValue& value); - JsonValue property(const StringView& name) const; + bool set_property(String const& name, const JsonValue& value); + JsonValue property(String const& name) const; const HashMap>& properties() const { return m_properties; } static IntrusiveList, &Object::m_all_objects_list_node>& all_objects();