mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:57:35 +00:00
LibGUI: Add IPC encode and decode for FileTypeFilter
Allows the use of GUI::FileTypeFilter in IPC.
This commit is contained in:
parent
95da08e035
commit
106ad6bb13
1 changed files with 23 additions and 0 deletions
|
@ -9,6 +9,8 @@
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/Optional.h>
|
#include <AK/Optional.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
|
#include <LibIPC/Decoder.h>
|
||||||
|
#include <LibIPC/Encoder.h>
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
@ -28,3 +30,24 @@ struct FileTypeFilter {
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace IPC {
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline ErrorOr<void> encode(Encoder& encoder, GUI::FileTypeFilter const& response)
|
||||||
|
{
|
||||||
|
TRY(encoder.encode(response.name));
|
||||||
|
TRY(encoder.encode(response.extensions));
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline ErrorOr<GUI::FileTypeFilter> decode(Decoder& decoder)
|
||||||
|
{
|
||||||
|
auto name = TRY(decoder.decode<DeprecatedString>());
|
||||||
|
auto extensions = TRY(decoder.decode<Optional<Vector<AK::DeprecatedString>>>());
|
||||||
|
|
||||||
|
return GUI::FileTypeFilter { move(name), move(extensions) };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue