Browse Source

changed configuration comment handling

pull/3/head
Thomas Knoll 1 year ago
parent
commit
b5a470ee0c
  1. 15
      util/ConfigYaml.cpp
  2. 3
      util/ConfigYaml.h

15
util/ConfigYaml.cpp

@ -26,26 +26,26 @@ std::ostream& operator << (std::ostream& os, const Module& module) {
std::string Label::createExpression() const { std::string Label::createExpression() const {
if (overwrite_) { if (overwrite_) {
return "label \"" + label_ + "\" = " + text_ + "; // Overwrite";
return "label \"" + label_ + "\" = " + text_ + Configuration::overwrite_identifier_;
} }
return "label \"" + label_ + "\" = " + text_ + ";";
return "label \"" + label_ + "\" = " + text_ + Configuration::configuration_identifier_;
} }
std::string Formula::createExpression() const { std::string Formula::createExpression() const {
if (overwrite_) { if (overwrite_) {
return "formula " + formula_ + " = " + content_ + "; // Overwrite";
return "formula " + formula_ + " = " + content_ + Configuration::overwrite_identifier_;
} }
return "formula " + formula_ + " = " + content_ + ";";
return "formula " + formula_ + " = " + content_ + Configuration::configuration_identifier_;
} }
std::string Action::createExpression() const { std::string Action::createExpression() const {
if (overwrite_) { if (overwrite_) {
return action_ + "\t" + guard_ + "-> " + update_ + "; // Overwrite";
return action_ + "\t" + guard_ + "-> " + update_ + Configuration::overwrite_identifier_;
} }
return "\t" + action_ + "\t" + guard_ + "-> " + update_ + ";";
return "\t" + action_ + "\t" + guard_ + "-> " + update_+ Configuration::configuration_identifier_;
} }
YAML::Node YAML::convert<Module>::encode(const Module& rhs) { YAML::Node YAML::convert<Module>::encode(const Module& rhs) {
@ -142,6 +142,9 @@ bool YAML::convert<Formula>::decode(const YAML::Node& node, Formula& rhs) {
return true; return true;
} }
const std::string Configuration::configuration_identifier_ { "; // created through configuration"};
const std::string Configuration::overwrite_identifier_{"; // Overwritten through configuration"};
std::vector<Configuration> YamlConfigParser::parseConfiguration() { std::vector<Configuration> YamlConfigParser::parseConfiguration() {
std::vector<Configuration> configuration; std::vector<Configuration> configuration;

3
util/ConfigYaml.h

@ -14,6 +14,9 @@ enum class ConfigType : char {
struct Configuration struct Configuration
{ {
static const std::string overwrite_identifier_;
static const std::string configuration_identifier_;
std::string module_ {}; std::string module_ {};
std::string expression_{}; std::string expression_{};
std::string identifier_{}; std::string identifier_{};

Loading…
Cancel
Save