1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:17:35 +00:00

AK: Move String::bytes() and String::operator==(String) to StringBase

The idea is to eventually get rid of protected state in StringBase. To
do this, we first need to remove all references to m_data and
m_short_string from String.
This commit is contained in:
Dan Klishch 2023-10-28 15:37:10 -04:00 committed by Andrew Kaster
parent 4364a28d3d
commit 54d149bc25
4 changed files with 21 additions and 19 deletions

View file

@ -121,10 +121,6 @@ public:
// Returns an iterable view over the Unicode code points.
[[nodiscard]] Utf8View code_points() const;
// Returns the underlying UTF-8 encoded bytes.
// NOTE: There is no guarantee about null-termination.
[[nodiscard]] ReadonlyBytes bytes() const;
// Returns true if the String is zero-length.
[[nodiscard]] bool is_empty() const;
@ -146,7 +142,7 @@ public:
Optional<size_t> find_byte_offset(u32 code_point, size_t from_byte_offset = 0) const;
Optional<size_t> find_byte_offset(StringView substring, size_t from_byte_offset = 0) const;
[[nodiscard]] bool operator==(String const&) const;
[[nodiscard]] bool operator==(String const&) const = default;
[[nodiscard]] bool operator==(FlyString const&) const;
[[nodiscard]] bool operator==(StringView) const;
[[nodiscard]] bool operator==(char const* cstring) const;