mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
BufferStream: Support "bool" as a streaming type
This commit is contained in:
parent
659ddddd20
commit
b04dae7faa
1 changed files with 15 additions and 0 deletions
|
@ -47,6 +47,21 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
BufferStream& operator<<(bool value)
|
||||
{
|
||||
m_buffer[m_offset++] = value;
|
||||
return *this;
|
||||
}
|
||||
BufferStream& operator>>(bool& value )
|
||||
{
|
||||
if (m_offset + sizeof(value) >= unsigned(m_buffer.size())) {
|
||||
m_read_failure = true;
|
||||
return *this;
|
||||
}
|
||||
value = m_buffer[m_offset++];
|
||||
return *this;
|
||||
}
|
||||
|
||||
BufferStream& operator<<(char value)
|
||||
{
|
||||
m_buffer[m_offset++] = (u8)value;
|
||||
|
|
Loading…
Add table
Reference in a new issue