From b04dae7faac6e7c221d23985517c6e30f6ed60e7 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 3 Aug 2019 17:02:42 +0200 Subject: [PATCH] BufferStream: Support "bool" as a streaming type --- AK/BufferStream.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/AK/BufferStream.h b/AK/BufferStream.h index 0b829a26c5..703330a253 100644 --- a/AK/BufferStream.h +++ b/AK/BufferStream.h @@ -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;