mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-22 23:55:12 +00:00
GIODevice: Add a read_all() that returns a ByteBuffer with all we can read.
Use this to implement file opening in TextEditor.
This commit is contained in:
@@ -92,6 +92,15 @@ ByteBuffer String::to_byte_buffer() const
|
||||
return ByteBuffer::copy(reinterpret_cast<const byte*>(characters()), length());
|
||||
}
|
||||
|
||||
String String::from_byte_buffer(const ByteBuffer& buffer)
|
||||
{
|
||||
if (buffer.is_null())
|
||||
return nullptr;
|
||||
if (buffer.is_empty())
|
||||
return empty();
|
||||
return String((const char*)buffer.pointer(), buffer.size());
|
||||
}
|
||||
|
||||
unsigned String::to_uint(bool& ok) const
|
||||
{
|
||||
unsigned value = 0;
|
||||
|
||||
Reference in New Issue
Block a user