mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Add StringView(String const&) constructor
This allows us to pass the new String type to functions that take a StringView directly, having to call bytes_as_string_view() every time gets old quickly.
This commit is contained in:
@@ -16,11 +16,18 @@
|
||||
#ifndef KERNEL
|
||||
# include <AK/DeprecatedString.h>
|
||||
# include <AK/FlyString.h>
|
||||
# include <AK/String.h>
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
|
||||
#ifndef KERNEL
|
||||
StringView::StringView(String const& string)
|
||||
: m_characters(reinterpret_cast<char const*>(string.bytes().data()))
|
||||
, m_length(string.bytes().size())
|
||||
{
|
||||
}
|
||||
|
||||
StringView::StringView(DeprecatedString const& string)
|
||||
: m_characters(string.characters())
|
||||
, m_length(string.length())
|
||||
|
||||
Reference in New Issue
Block a user