mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:47:47 +00:00
AK: Move String::hash() and String::String() to StringBase
This commit is contained in:
parent
1b09a1851e
commit
d6290c4684
4 changed files with 16 additions and 16 deletions
|
@ -30,6 +30,12 @@ static_assert(__builtin_offsetof(ShortString, byte_count_and_short_string_flag)
|
|||
|
||||
class StringBase {
|
||||
public:
|
||||
// Creates an empty (zero-length) String.
|
||||
constexpr StringBase()
|
||||
: StringBase(ShortString { SHORT_STRING_FLAG, {} })
|
||||
{
|
||||
}
|
||||
|
||||
StringBase(StringBase const&);
|
||||
|
||||
constexpr StringBase(StringBase&& other)
|
||||
|
@ -54,6 +60,7 @@ public:
|
|||
// Returns the underlying UTF-8 encoded bytes.
|
||||
// NOTE: There is no guarantee about null-termination.
|
||||
[[nodiscard]] ReadonlyBytes bytes() const;
|
||||
[[nodiscard]] u32 hash() const;
|
||||
|
||||
[[nodiscard]] bool operator==(StringBase const&) const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue