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

AK: Some FlyString improvements

We're now clever enough to notice when we're constructing a FlyString
from a String that is actually already a FlyString. :^)
This commit is contained in:
Andreas Kling 2020-05-05 10:08:14 +02:00
parent 2a29e668bd
commit e4b9cf9b6c
2 changed files with 24 additions and 0 deletions

View file

@ -33,10 +33,30 @@ namespace AK {
class FlyString {
public:
FlyString() {}
FlyString(const FlyString& other)
: m_impl(other.impl())
{
}
FlyString(FlyString&& other)
: m_impl(move(other.m_impl))
{
}
FlyString(const String&);
FlyString(const StringView&);
FlyString(const char*);
FlyString& operator=(const FlyString& other)
{
m_impl = other.m_impl;
return *this;
}
FlyString& operator=(FlyString&& other)
{
m_impl = move(other.m_impl);
return *this;
}
bool is_empty() const { return !m_impl || !m_impl->length(); }
bool is_null() const { return !m_impl; }