Audacity 3.2.0
ConfigInterface.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file ConfigInterface.cpp
6
7**********************************************************************/
8#include "ConfigInterface.h"
9
10#include "PluginManager.h"
11
12namespace PluginSettings {
13
16 const RegistryPath & group)
17{
18 auto &pluginManager = PluginManager::Get();
19 const auto &id = pluginManager.GetID(&ident);
20 if (pluginManager.HasConfigGroup(type, id, group))
21 return true;
22 if (auto id2 = pluginManager.OldGetID(&ident); id != id2)
23 return pluginManager.HasConfigGroup(type, id2, group);
24 return false;
25}
26
29 const RegistryPath & group, RegistryPaths &subgroups)
30{
31 auto &pluginManager = PluginManager::Get();
32 const auto &id = pluginManager.GetID(&ident);
33 if (pluginManager.GetConfigSubgroups(
34 type, id, group, subgroups))
35 return true;
36 if (auto id2 = pluginManager.OldGetID(&ident); id != id2)
37 return pluginManager.GetConfigSubgroups(type, id2, group, subgroups);
38 return false;
39}
40
43 const RegistryPath & group, const RegistryPath & key)
44{
45 auto &pluginManager = PluginManager::Get();
46 const auto &id = pluginManager.GetID(&ident);
47 if (pluginManager.HasConfigValue(type, id, group, key))
48 return true;
49 if (auto id2 = pluginManager.OldGetID(&ident); id != id2)
50 return pluginManager.HasConfigValue(type, id2, group, key);
51 return false;
52}
53
56 const RegistryPath & group, const RegistryPath & key,
58{
59 auto &pluginManager = PluginManager::Get();
60 const auto &id = pluginManager.GetID(&ident);
61 if (pluginManager.GetConfigValue(type, id, group, key, var, defval))
62 return true;
63 if (auto id2 = pluginManager.OldGetID(&ident); id != id2)
64 return pluginManager.GetConfigValue(type, id2, group, key, var, defval);
65 return false;
66}
67
70 const RegistryPath & group, const RegistryPath & key,
72{
73 auto &pluginManager = PluginManager::Get();
74 const auto &id = pluginManager.GetID(&ident);
75 return pluginManager.SetConfigValue(type, id, group, key, value);
76}
77
80 const RegistryPath & group)
81{
82 auto &pluginManager = PluginManager::Get();
83 const auto &id = pluginManager.GetID(&ident);
84 const auto &id2 = pluginManager.OldGetID(&ident);
85 return pluginManager.RemoveConfigSubgroup(type, id, group)
86 || (id2 != id && pluginManager.RemoveConfigSubgroup(type, id2, group));
87}
88
91 const RegistryPath & group, const RegistryPath & key)
92{
93 auto &pluginManager = PluginManager::Get();
94 const auto &id = pluginManager.GetID(&ident);
95 const auto &id2 = pluginManager.OldGetID(&ident);
96 return pluginManager.RemoveConfig(type, id, group, key)
97 || (id2 != id && pluginManager.RemoveConfig(type, id2, group, key));
98}
99
100}
wxString RegistryPath
Definition: Identifier.h:218
std::vector< RegistryPath > RegistryPaths
Definition: Identifier.h:219
static CommandHandlerObject & ident(AudacityProject &project)
static const AudacityProject::AttachedObjects::RegisteredFactory key
EffectDefinitionInterface is a ComponentInterface that adds some basic read-only information about ef...
static PluginManager & Get()
bool RemoveConfigSubgroup(const EffectDefinitionInterface &ident, PluginSettings::ConfigurationType type, const RegistryPath &group)
bool GetConfigSubgroups(const EffectDefinitionInterface &ident, PluginSettings::ConfigurationType type, const RegistryPath &group, RegistryPaths &subgroups)
bool HasConfigValue(const EffectDefinitionInterface &ident, PluginSettings::ConfigurationType type, const RegistryPath &group, const RegistryPath &key)
TypeListVisitor::VariantOfReferences_t< false, ConfigValueTypes > ConfigReference
Define a reference to a variable of one of the types in ConfigValueTypes.
bool GetConfigValue(const EffectDefinitionInterface &ident, PluginSettings::ConfigurationType type, const RegistryPath &group, const RegistryPath &key, ConfigReference var, ConfigConstReference defval)
bool RemoveConfig(const EffectDefinitionInterface &ident, PluginSettings::ConfigurationType type, const RegistryPath &group, const RegistryPath &key)
bool SetConfigValue(const EffectDefinitionInterface &ident, PluginSettings::ConfigurationType type, const RegistryPath &group, const RegistryPath &key, ConfigConstReference value)
TypeListVisitor::VariantOfReferences_t< true, ConfigValueTypes > ConfigConstReference
bool HasConfigGroup(const EffectDefinitionInterface &ident, PluginSettings::ConfigurationType type, const RegistryPath &group)