mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-25 10:48:53 +00:00
BufferStream: Support "bool" as a streaming type
This commit is contained in:
parent
659ddddd20
commit
b04dae7faa
Notes:
sideshowbarker
2024-07-19 12:55:11 +09:00
Author: https://github.com/awesomekling
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
Add a link
Reference in a new issue