mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +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:
parent
4364a28d3d
commit
54d149bc25
4 changed files with 21 additions and 19 deletions
|
@ -45,6 +45,12 @@ public:
|
|||
// NOTE: This is primarily interesting to unit tests.
|
||||
[[nodiscard]] bool is_short_string() const;
|
||||
|
||||
// Returns the underlying UTF-8 encoded bytes.
|
||||
// NOTE: There is no guarantee about null-termination.
|
||||
[[nodiscard]] ReadonlyBytes bytes() const;
|
||||
|
||||
[[nodiscard]] bool operator==(StringBase const&) const;
|
||||
|
||||
protected:
|
||||
// NOTE: If the least significant bit of the pointer is set, this is a short string.
|
||||
static constexpr uintptr_t SHORT_STRING_FLAG = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue