mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-04 12:34:22 +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:
committed by
Andrew Kaster
parent
4364a28d3d
commit
54d149bc25
@@ -59,4 +59,18 @@ bool StringBase::is_short_string() const
|
||||
return has_short_string_bit(reinterpret_cast<uintptr_t>(m_data));
|
||||
}
|
||||
|
||||
ReadonlyBytes StringBase::bytes() const
|
||||
{
|
||||
if (is_short_string())
|
||||
return m_short_string.bytes();
|
||||
return m_data->bytes();
|
||||
}
|
||||
|
||||
bool StringBase::operator==(StringBase const& other) const
|
||||
{
|
||||
if (is_short_string())
|
||||
return m_data == other.m_data;
|
||||
return bytes() == other.bytes();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user