1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:34:57 +00:00

AK: Forward substring creation with shared superstring to StringBase

This commit is contained in:
Dan Klishch 2023-10-28 17:50:24 -04:00 committed by Andrew Kaster
parent 5d6cd65e29
commit e7700e16ee
5 changed files with 34 additions and 5 deletions

View file

@ -64,6 +64,7 @@ public:
// NOTE: There is no guarantee about null-termination.
[[nodiscard]] ReadonlyBytes bytes() const;
[[nodiscard]] u32 hash() const;
[[nodiscard]] size_t byte_count() const;
[[nodiscard]] bool operator==(StringBase const&) const;
@ -100,6 +101,10 @@ protected:
callback(buffer);
}
// This is not a trivial operation with storage, so it does not belong here. Unfortunately, it
// is impossible to implement it without access to StringData.
ErrorOr<StringBase> substring_from_byte_offset_with_shared_superstring(size_t start, size_t byte_count) const;
union {
ShortString m_short_string;
Detail::StringData const* m_data { nullptr };