mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
StringView: Make it easy to construct from a ByteBuffer.
This commit is contained in:
@@ -10,6 +10,12 @@ StringView::StringView(const String& string)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringView::StringView(const ByteBuffer& buffer)
|
||||||
|
: m_characters((const char*)buffer.data())
|
||||||
|
, m_length(buffer.size())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Vector<StringView> StringView::split_view(const char separator) const
|
Vector<StringView> StringView::split_view(const char separator) const
|
||||||
{
|
{
|
||||||
if (is_empty())
|
if (is_empty())
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
||||||
|
class ByteBuffer;
|
||||||
class String;
|
class String;
|
||||||
class StringImpl;
|
class StringImpl;
|
||||||
|
|
||||||
@@ -28,7 +29,9 @@ public:
|
|||||||
++m_length;
|
++m_length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StringView(const String& string);
|
|
||||||
|
StringView(const ByteBuffer&);
|
||||||
|
StringView(const String&);
|
||||||
|
|
||||||
bool is_null() const { return !m_characters; }
|
bool is_null() const { return !m_characters; }
|
||||||
bool is_empty() const { return m_length == 0; }
|
bool is_empty() const { return m_length == 0; }
|
||||||
|
|||||||
Reference in New Issue
Block a user