From 38abdbee50ec6739d6ee1f9e7da9ee2c622a8554 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Tue, 27 Apr 2021 17:54:46 +0200 Subject: [PATCH] Rearrange the configuration options --- src/common/configuration.cpp | 14 +++++++------- src/common/configuration.h | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/common/configuration.cpp b/src/common/configuration.cpp index 862bb48d..8bdd6d53 100644 --- a/src/common/configuration.cpp +++ b/src/common/configuration.cpp @@ -78,7 +78,13 @@ Configuration::Configuration(const fs::path& config_path, // their defaults. At this point I'd really wish C++ could do pattern // matching. 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()) { cache_time_info = parsed_value->get(); } else { @@ -113,12 +119,6 @@ Configuration::Configuration(const fs::path& config_path, } else { 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") { if (const auto parsed_value = value.as_boolean()) { vst3_no_scaling = parsed_value->get(); diff --git a/src/common/configuration.h b/src/common/configuration.h index b99418c3..66a4c95b 100644 --- a/src/common/configuration.h +++ b/src/common/configuration.h @@ -74,6 +74,13 @@ class Configuration { Configuration(const boost::filesystem::path& config_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 group; + /** * If set to `true`, then after an `audioMasterGetTime()` call all * subsequent calls to that function during a single processing cycle will @@ -151,13 +158,6 @@ class Configuration { */ 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 group; - /** * The path to the configuration file that was parsed. */ @@ -189,6 +189,9 @@ class Configuration { template 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(editor_double_embed); s.value1b(editor_force_dnd); @@ -197,8 +200,6 @@ class Configuration { [](S& s, auto& v) { s.value4b(v); }); s.value1b(vst3_no_scaling); 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& s, auto& v) { s.ext(v, bitsery::ext::BoostPath{}); });