diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2015-12-16 14:33:19 +0300 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2015-12-16 14:33:19 +0300 |
commit | 3c862836f284a09b283404680094abb45f3a7464 (patch) | |
tree | 6d31052b3fc426d0aec8948a028d443711735924 /xs/src/libslic3r/Config.cpp | |
parent | c73378744f0d6e8c4a07952d9228069f35fcb56e (diff) |
Refactored the Config XS bindings
Diffstat (limited to 'xs/src/libslic3r/Config.cpp')
-rw-r--r-- | xs/src/libslic3r/Config.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/xs/src/libslic3r/Config.cpp b/xs/src/libslic3r/Config.cpp index 3fa3b5db5..fe5c7beb5 100644 --- a/xs/src/libslic3r/Config.cpp +++ b/xs/src/libslic3r/Config.cpp @@ -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); -} - } |