1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:07:45 +00:00

LibIPC+IPCCompiler: Templatize encoding/decoding of Optional<T>

This was the last one! IPCCompiler no longer has any type-specific
encoding/decoding logic! :^)
This commit is contained in:
Andreas Kling 2020-05-12 19:02:44 +02:00
parent 6800f6eff5
commit 413ab652c8
3 changed files with 29 additions and 21 deletions

View file

@ -76,6 +76,15 @@ public:
return *this;
}
template<typename T>
Encoder& operator<<(const Optional<T>& optional)
{
*this << optional.has_value();
if (optional.has_value())
*this << optional.value();
return *this;
}
template<typename T>
void encode(const T& value)
{