mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Add support for the new FlyString to StringView
This commit is contained in:
parent
b61f8cd130
commit
e96c64cdb4
Notes:
sideshowbarker
2024-07-17 09:49:48 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/e96c64cdb4 Pull-request: https://github.com/SerenityOS/serenity/pull/17217
2 changed files with 10 additions and 1 deletions
|
@ -15,6 +15,7 @@
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
# include <AK/DeprecatedFlyString.h>
|
# include <AK/DeprecatedFlyString.h>
|
||||||
# include <AK/DeprecatedString.h>
|
# include <AK/DeprecatedString.h>
|
||||||
|
# include <AK/FlyString.h>
|
||||||
# include <AK/String.h>
|
# include <AK/String.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -27,6 +28,12 @@ StringView::StringView(String const& string)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringView::StringView(FlyString const& string)
|
||||||
|
: m_characters(reinterpret_cast<char const*>(string.bytes().data()))
|
||||||
|
, m_length(string.bytes().size())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
StringView::StringView(DeprecatedString const& string)
|
StringView::StringView(DeprecatedString const& string)
|
||||||
: m_characters(string.characters())
|
: m_characters(string.characters())
|
||||||
, m_length(string.length())
|
, m_length(string.length())
|
||||||
|
|
|
@ -49,6 +49,7 @@ public:
|
||||||
StringView(ByteBuffer const&);
|
StringView(ByteBuffer const&);
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
StringView(String const&);
|
StringView(String const&);
|
||||||
|
StringView(FlyString const&);
|
||||||
StringView(DeprecatedString const&);
|
StringView(DeprecatedString const&);
|
||||||
StringView(DeprecatedFlyString const&);
|
StringView(DeprecatedFlyString const&);
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,11 +57,12 @@ public:
|
||||||
explicit StringView(ByteBuffer&&) = delete;
|
explicit StringView(ByteBuffer&&) = delete;
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
explicit StringView(String&&) = delete;
|
explicit StringView(String&&) = delete;
|
||||||
|
explicit StringView(FlyString&&) = delete;
|
||||||
explicit StringView(DeprecatedString&&) = delete;
|
explicit StringView(DeprecatedString&&) = delete;
|
||||||
explicit StringView(DeprecatedFlyString&&) = delete;
|
explicit StringView(DeprecatedFlyString&&) = delete;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<OneOf<String, DeprecatedString, DeprecatedFlyString, ByteBuffer> StringType>
|
template<OneOf<String, FlyString, DeprecatedString, DeprecatedFlyString, ByteBuffer> StringType>
|
||||||
StringView& operator=(StringType&&) = delete;
|
StringView& operator=(StringType&&) = delete;
|
||||||
|
|
||||||
[[nodiscard]] constexpr bool is_null() const
|
[[nodiscard]] constexpr bool is_null() const
|
||||||
|
|
Loading…
Reference in a new issue