1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

LibIPC: Add a simple IPC::Dictionary type (String key -> String value)

This commit is contained in:
Andreas Kling 2020-05-03 22:15:27 +02:00
parent dce3faff08
commit 78943f031e
9 changed files with 101 additions and 0 deletions

View file

@ -25,6 +25,7 @@
*/
#include <AK/String.h>
#include <LibIPC/Dictionary.h>
#include <LibIPC/Encoder.h>
namespace IPC {
@ -139,4 +140,13 @@ Encoder& Encoder::operator<<(const String& value)
return *this << value.view();
}
Encoder& Encoder::operator<<(const Dictionary& dictionary)
{
*this << (u64)dictionary.size();
dictionary.for_each_entry([this](auto& key, auto& value) {
*this << key << value;
});
return *this;
}
}