diff --git a/AK/StringView.cpp b/AK/StringView.cpp index 1d8e6fe152..4252dcea35 100644 --- a/AK/StringView.cpp +++ b/AK/StringView.cpp @@ -15,6 +15,7 @@ #ifndef KERNEL # include # include +# include # include #endif @@ -27,6 +28,12 @@ StringView::StringView(String const& string) { } +StringView::StringView(FlyString const& string) + : m_characters(reinterpret_cast(string.bytes().data())) + , m_length(string.bytes().size()) +{ +} + StringView::StringView(DeprecatedString const& string) : m_characters(string.characters()) , m_length(string.length()) diff --git a/AK/StringView.h b/AK/StringView.h index 6e0c497a64..3bcd0072a2 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -49,6 +49,7 @@ public: StringView(ByteBuffer const&); #ifndef KERNEL StringView(String const&); + StringView(FlyString const&); StringView(DeprecatedString const&); StringView(DeprecatedFlyString const&); #endif @@ -56,11 +57,12 @@ public: explicit StringView(ByteBuffer&&) = delete; #ifndef KERNEL explicit StringView(String&&) = delete; + explicit StringView(FlyString&&) = delete; explicit StringView(DeprecatedString&&) = delete; explicit StringView(DeprecatedFlyString&&) = delete; #endif - template StringType> + template StringType> StringView& operator=(StringType&&) = delete; [[nodiscard]] constexpr bool is_null() const