Fixed is_nil() method on ConfigOptions.

PlaceholderParser was extended to support external config.
The external config has a lowest priority when looking up a variable.
This commit is contained in:
bubnikv 2019-07-24 12:39:01 +02:00
parent 6ea3a8e2b4
commit 42c8940795
4 changed files with 20 additions and 12 deletions

View file

@ -12,7 +12,7 @@ namespace Slic3r {
class PlaceholderParser
{
public:
PlaceholderParser();
PlaceholderParser(const DynamicConfig *external_config = nullptr);
// Return a list of keys, which should be changed in m_config from rhs.
// This contains keys, which are found in rhs, but not in m_config.
@ -35,6 +35,8 @@ public:
DynamicConfig& config_writable() { return m_config; }
const DynamicConfig& config() const { return m_config; }
const ConfigOption* option(const std::string &key) const { return m_config.option(key); }
// External config is not owned by PlaceholderParser. It has a lowest priority when looking up an option.
const DynamicConfig* external_config() const { return m_external_config; }
// Fill in the template using a macro processing language.
// Throws std::runtime_error on syntax or runtime error.
@ -50,7 +52,9 @@ public:
void update_timestamp() { update_timestamp(m_config); }
private:
DynamicConfig m_config;
// config has a higher priority than external_config when looking up a symbol.
DynamicConfig m_config;
const DynamicConfig *m_external_config;
};
}