Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-12-18 14:14:09 +0300
committerbubnikv <bubnikv@gmail.com>2017-12-18 14:14:09 +0300
commitbb61de83795b10f77107e81384b62405ba2bbc89 (patch)
tree6a03fede6e62dcdb112f37eeac092d789e9ade67 /xs/src/libslic3r/PlaceholderParser.hpp
parentbbfb9a4190adea0a2864ecf3a98cb0ab9942035e (diff)
Fixed a regression error: The "current_extruder" identifier was not set
at the placeholder parser. Implemented a new PlaceholderParser::evaluate_boolean_expression() functionality to evaluate just a boolean expression using the full expressive power of the macro processing syntax. This function will now be used for deciding, which print or filament preset is compatible with which printer preset.
Diffstat (limited to 'xs/src/libslic3r/PlaceholderParser.hpp')
-rw-r--r--xs/src/libslic3r/PlaceholderParser.hpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/xs/src/libslic3r/PlaceholderParser.hpp b/xs/src/libslic3r/PlaceholderParser.hpp
index 25264d461..ec2b837ad 100644
--- a/xs/src/libslic3r/PlaceholderParser.hpp
+++ b/xs/src/libslic3r/PlaceholderParser.hpp
@@ -26,11 +26,17 @@ public:
void set(const std::string &key, double value) { this->set(key, new ConfigOptionFloat(value)); }
void set(const std::string &key, const std::vector<std::string> &values) { this->set(key, new ConfigOptionStrings(values)); }
void set(const std::string &key, ConfigOption *opt) { m_config.set_key_value(key, opt); }
- const ConfigOption* option(const std::string &key) const { return m_config.option(key); }
+ const DynamicConfig& config() const { return m_config; }
+ const ConfigOption* option(const std::string &key) const { return m_config.option(key); }
- // Fill in the template.
+ // Fill in the template using a macro processing language.
+ // Throws std::runtime_error on syntax or runtime error.
std::string process(const std::string &templ, unsigned int current_extruder_id, const DynamicConfig *config_override = nullptr) const;
+ // Evaluate a boolean expression using the full expressive power of the PlaceholderParser boolean expression syntax.
+ // Throws std::runtime_error on syntax or runtime error.
+ static bool evaluate_boolean_expression(const std::string &templ, const DynamicConfig &config);
+
private:
DynamicConfig m_config;
};