From 44044324f3599cb10af255db22a5816851ca1952 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 22 Jul 2020 17:05:24 +0200 Subject: [PATCH] Add serialization support for plugin configuration --- src/common/configuration.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/common/configuration.h b/src/common/configuration.h index 128cddaf..c2ba393c 100644 --- a/src/common/configuration.h +++ b/src/common/configuration.h @@ -21,8 +21,11 @@ #endif #include +#include #include +#include "bitsery/ext/boost-path.h" + /** * An object that's used to provide plugin-specific configuration. Right now * this is only used to declare plugin groups. A plugin group is a set of @@ -86,4 +89,14 @@ class Configuration { * The matched glob pattern in the above configuration file. */ std::optional matched_pattern; + + template + void serialize(S& s) { + s.ext(group, bitsery::ext::StdOptional(), + [](S& s, auto& v) { s.text1b(v, 4096); }); + s.ext(matched_file, bitsery::ext::StdOptional(), + [](S& s, auto& v) { s.ext(v, bitsery::ext::BoostPath()); }); + s.ext(matched_pattern, bitsery::ext::StdOptional(), + [](S& s, auto& v) { s.text1b(v, 4096); }); + } };