1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:57:44 +00:00

Take StringView in more places

We should work towards a pattern where we take StringView as function
arguments, and store String as member, to push the String construction
to the last possible moment.
This commit is contained in:
Robin Burchell 2019-06-02 12:26:28 +02:00 committed by Andreas Kling
parent b55b6cd7fc
commit 7bce096afd
14 changed files with 28 additions and 36 deletions

View file

@ -87,7 +87,7 @@ public:
};
static String repeated(char, int count);
bool matches(const String& pattern, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
bool matches(const StringView& pattern, CaseSensitivity = CaseSensitivity::CaseInsensitive) const;
int to_int(bool& ok) const;
unsigned to_uint(bool& ok) const;
@ -122,7 +122,7 @@ public:
return (*m_impl)[i];
}
bool ends_with(const String&) const;
bool ends_with(const StringView&) const;
bool operator==(const String&) const;
bool operator!=(const String& other) const { return !(*this == other); }
@ -166,7 +166,7 @@ public:
StringView view() const { return { characters(), length() }; }
private:
bool match_helper(const String& mask) const;
bool match_helper(const StringView& mask) const;
RetainPtr<StringImpl> m_impl;
};