Add serialization support for plugin configuration

This commit is contained in:
Robbert van der Helm
2020-07-22 17:05:24 +02:00
parent 479852a4d0
commit 44044324f3
+13
View File
@@ -21,8 +21,11 @@
#endif
#include <boost/filesystem.hpp>
#include <bitsery/ext/std_optional.h>
#include <optional>
#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<std::string> matched_pattern;
template <typename S>
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); });
}
};