LibIPC+LibGfx: Templatize IPC encoding as well as decoding

Now most classes dictate how they are serialized and deserialized when
transmitted across LibIPC sockets. This also makes the IPC compiler
a bit simpler. :^)
This commit is contained in:
Andreas Kling 2020-05-12 18:05:43 +02:00
commit 3775983dfe
Notes: sideshowbarker 2024-07-19 06:42:23 +09:00
10 changed files with 83 additions and 45 deletions

View file

@ -28,6 +28,7 @@
#include <AK/String.h>
#include <LibGfx/Size.h>
#include <LibIPC/Decoder.h>
#include <LibIPC/Encoder.h>
namespace Gfx {
@ -45,6 +46,12 @@ const LogStream& operator<<(const LogStream& stream, const Size& value)
namespace IPC {
bool encode(Encoder& encoder, const Gfx::Size& size)
{
encoder << size.width() << size.height();
return true;
}
bool decode(Decoder& decoder, Gfx::Size& size)
{
int width = 0;