summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore/Object.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-04-16 19:59:31 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-17 01:27:29 +0200
commit942a5afd23ff41803118482551e7c961cb37281f (patch)
treefb3d2ef4dcf0c4a68a8018b7fc7c8e918bec3c28 /Userland/Libraries/LibCore/Object.h
parent73aa59ccf1f844588e3ba6edbdd3520ccf640768 (diff)
downloadserenity-942a5afd23ff41803118482551e7c961cb37281f.zip
LibCore: Don't needlessly use StringView in Core::Object APIs
Taking a StringView parameter that gets immediately converted to a String anyway is silly. Just take a String directly instead. This pattern is the main reason we have the "StringView internal StringImpl pointer" optimization, and I suspect that we can throw that whole thing out if we make a couple more patches like this.
Diffstat (limited to 'Userland/Libraries/LibCore/Object.h')
-rw-r--r--Userland/Libraries/LibCore/Object.h6
1 files changed, 3 insertions, 3 deletions
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<Object>& children() { return m_children; }
const NonnullRefPtrVector<Object>& 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<String, NonnullOwnPtr<Property>>& properties() const { return m_properties; }
static IntrusiveList<Object, RawPtr<Object>, &Object::m_all_objects_list_node>& all_objects();