1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:37:35 +00:00

AK+LibIPC: Make all enums codable

If an enum has a supported underlying type we can provide encoding and
decoding for the enum as well.
This commit is contained in:
Timothy 2021-07-04 14:44:34 +10:00 committed by Ali Mohammad Pur
parent 60f84f3154
commit e42484bb65
3 changed files with 25 additions and 0 deletions

View file

@ -6,6 +6,8 @@
#pragma once
#include <AK/Concepts.h>
#include <AK/StdLibExtras.h>
#include <LibIPC/Forward.h>
#include <LibIPC/Message.h>
@ -62,6 +64,13 @@ public:
return *this;
}
template<Enum T>
Encoder& operator<<(T const& enum_value)
{
*this << AK::to_underlying(enum_value);
return *this;
}
template<typename T>
Encoder& operator<<(const T& value)
{