mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:48:10 +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:
parent
8e3d0a23d5
commit
9ad076178a
6 changed files with 58 additions and 25 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue