Rearrange the configuration options

This commit is contained in:
Robbert van der Helm
2021-04-27 17:54:46 +02:00
parent b52362e698
commit 38abdbee50
2 changed files with 17 additions and 16 deletions
+7 -7
View File
@@ -78,7 +78,13 @@ Configuration::Configuration(const fs::path& config_path,
// their defaults. At this point I'd really wish C++ could do pattern // their defaults. At this point I'd really wish C++ could do pattern
// matching. // matching.
for (const auto& [key, value] : table) { for (const auto& [key, value] : table) {
if (key == "cache_time_info") { if (key == "group") {
if (const auto parsed_value = value.as_string()) {
group = parsed_value->get();
} else {
invalid_options.push_back(key);
}
} else if (key == "cache_time_info") {
if (const auto parsed_value = value.as_boolean()) { if (const auto parsed_value = value.as_boolean()) {
cache_time_info = parsed_value->get(); cache_time_info = parsed_value->get();
} else { } else {
@@ -113,12 +119,6 @@ Configuration::Configuration(const fs::path& config_path,
} else { } else {
invalid_options.push_back(key); invalid_options.push_back(key);
} }
} else if (key == "group") {
if (const auto parsed_value = value.as_string()) {
group = parsed_value->get();
} else {
invalid_options.push_back(key);
}
} else if (key == "vst3_no_scaling") { } else if (key == "vst3_no_scaling") {
if (const auto parsed_value = value.as_boolean()) { if (const auto parsed_value = value.as_boolean()) {
vst3_no_scaling = parsed_value->get(); vst3_no_scaling = parsed_value->get();
+10 -9
View File
@@ -74,6 +74,13 @@ class Configuration {
Configuration(const boost::filesystem::path& config_path, Configuration(const boost::filesystem::path& config_path,
const boost::filesystem::path& yabridge_path); const boost::filesystem::path& yabridge_path);
/**
* The name of the plugin group that should be used for the plugin this
* configuration object was created for. If not set, then the plugin should
* be hosted individually instead.
*/
std::optional<std::string> group;
/** /**
* If set to `true`, then after an `audioMasterGetTime()` call all * If set to `true`, then after an `audioMasterGetTime()` call all
* subsequent calls to that function during a single processing cycle will * subsequent calls to that function during a single processing cycle will
@@ -151,13 +158,6 @@ class Configuration {
*/ */
bool vst3_prefer_32bit = false; bool vst3_prefer_32bit = false;
/**
* The name of the plugin group that should be used for the plugin this
* configuration object was created for. If not set, then the plugin should
* be hosted individually instead.
*/
std::optional<std::string> group;
/** /**
* The path to the configuration file that was parsed. * The path to the configuration file that was parsed.
*/ */
@@ -189,6 +189,9 @@ class Configuration {
template <typename S> template <typename S>
void serialize(S& s) { void serialize(S& s) {
s.ext(group, bitsery::ext::StdOptional(),
[](S& s, auto& v) { s.text1b(v, 4096); });
s.value1b(cache_time_info); s.value1b(cache_time_info);
s.value1b(editor_double_embed); s.value1b(editor_double_embed);
s.value1b(editor_force_dnd); s.value1b(editor_force_dnd);
@@ -197,8 +200,6 @@ class Configuration {
[](S& s, auto& v) { s.value4b(v); }); [](S& s, auto& v) { s.value4b(v); });
s.value1b(vst3_no_scaling); s.value1b(vst3_no_scaling);
s.value1b(vst3_prefer_32bit); s.value1b(vst3_prefer_32bit);
s.ext(group, bitsery::ext::StdOptional(),
[](S& s, auto& v) { s.text1b(v, 4096); });
s.ext(matched_file, bitsery::ext::StdOptional(), s.ext(matched_file, bitsery::ext::StdOptional(),
[](S& s, auto& v) { s.ext(v, bitsery::ext::BoostPath{}); }); [](S& s, auto& v) { s.ext(v, bitsery::ext::BoostPath{}); });