diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-11-07 23:09:45 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-08 21:46:13 +0100 |
commit | c930e026240c2c255b77ad8b2322aeea9ab92ea3 (patch) | |
tree | a336d00c0a938ebec0080105b5452171c4ec3c3b /Libraries/LibIPC/Encoder.cpp | |
parent | 705ad670f3609821be28be6b23e6ec8009f3ba16 (diff) | |
download | serenity-c930e026240c2c255b77ad8b2322aeea9ab92ea3.zip |
LibIPC: Add support for passing around ByteBuffers and HashMap<K, V>
It should be noted that using a shared buffer should still be preferred
over passing a raw ByteBuffer over the wire.
Diffstat (limited to 'Libraries/LibIPC/Encoder.cpp')
-rw-r--r-- | Libraries/LibIPC/Encoder.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibIPC/Encoder.cpp b/Libraries/LibIPC/Encoder.cpp index af93c9918e..c0eb8d670e 100644 --- a/Libraries/LibIPC/Encoder.cpp +++ b/Libraries/LibIPC/Encoder.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <AK/ByteBuffer.h> #include <AK/String.h> #include <AK/URL.h> #include <LibIPC/Dictionary.h> @@ -141,6 +142,13 @@ Encoder& Encoder::operator<<(const String& value) return *this << value.view(); } +Encoder& Encoder::operator<<(const ByteBuffer& value) +{ + *this << static_cast<i32>(value.size()); + m_buffer.append(value.data(), value.size()); + return *this; +} + Encoder& Encoder::operator<<(const URL& value) { return *this << value.to_string(); |