Refactored the Config XS bindings

This commit is contained in:
Alessandro Ranellucci 2015-12-16 12:33:19 +01:00
parent c73378744f
commit 3c862836f2
18 changed files with 104 additions and 194 deletions

View file

@ -150,6 +150,16 @@ ConfigBase::setenv_()
#endif
}
const ConfigOption*
ConfigBase::option(const t_config_option_key &opt_key) const {
return const_cast<ConfigBase*>(this)->option(opt_key, false);
}
ConfigOption*
ConfigBase::option(const t_config_option_key &opt_key, bool create) {
return this->optptr(opt_key, create);
}
DynamicConfig& DynamicConfig::operator= (DynamicConfig other)
{
this->swap(other);
@ -175,7 +185,7 @@ DynamicConfig::DynamicConfig (const DynamicConfig& other) {
}
ConfigOption*
DynamicConfig::option(const t_config_option_key &opt_key, bool create) {
DynamicConfig::optptr(const t_config_option_key &opt_key, bool create) {
if (this->options.count(opt_key) == 0) {
if (create) {
const ConfigOptionDef* optdef = this->def->get(opt_key);
@ -231,11 +241,6 @@ template ConfigOptionBool* DynamicConfig::opt<ConfigOptionBool>(const t_config_o
template ConfigOptionBools* DynamicConfig::opt<ConfigOptionBools>(const t_config_option_key &opt_key, bool create);
template ConfigOptionPercent* DynamicConfig::opt<ConfigOptionPercent>(const t_config_option_key &opt_key, bool create);
const ConfigOption*
DynamicConfig::option(const t_config_option_key &opt_key) const {
return const_cast<DynamicConfig*>(this)->option(opt_key, false);
}
t_config_option_keys
DynamicConfig::keys() const {
t_config_option_keys keys;
@ -273,10 +278,4 @@ StaticConfig::keys() const {
return keys;
}
const ConfigOption*
StaticConfig::option(const t_config_option_key &opt_key) const
{
return const_cast<StaticConfig*>(this)->option(opt_key, false);
}
}