Browse Source

renamed index

yaml_config_changes
Thomas Knoll 10 months ago
parent
commit
acd1a17082
  1. 6
      util/ConfigYaml.cpp
  2. 6
      util/ConfigYaml.h
  3. 2
      util/Grid.cpp

6
util/ConfigYaml.cpp

@ -104,10 +104,10 @@ bool YAML::convert<Command>::decode(const YAML::Node& node, Command& rhs) {
}
if (node["index"]) {
try {
rhs.index_ = node["index"].as<std::vector<int>>();
rhs.indexes_ = node["index"].as<std::vector<int>>();
}
catch(const std::exception& e) {
rhs.index_ = {node["index"].as<int>()};
rhs.indexes_ = {node["index"].as<int>()};
}
}
@ -250,7 +250,7 @@ YamlConfigParseResult YamlConfigParser::parseConfiguration() {
}
for (auto& module : modules) {
for (auto& command : module.commands_) {
configuration.push_back({command.createExpression(), command.action_, ConfigType::Module, command.overwrite_, module.module_, command.index_});
configuration.push_back({command.createExpression(), command.action_, ConfigType::Module, command.overwrite_, module.module_, command.indexes_});
}
}
for (auto& constant : constants) {

6
util/ConfigYaml.h

@ -22,7 +22,7 @@ struct Configuration
std::string module_ {};
std::string expression_{};
std::string identifier_{};
std::vector<int> index_{0};
std::vector<int> indexes_{0};
ConfigType type_ {ConfigType::Label};
bool overwrite_ {false};
@ -33,7 +33,7 @@ struct Configuration
, ConfigType type
, bool overwrite = false
, std::string module = ""
, std::vector<int> index = {0}) : expression_(expression), identifier_(identifier), type_(type), overwrite_(overwrite), module_{module}, index_(index) {}
, std::vector<int> indexes = {0}) : expression_(expression), identifier_(identifier), type_(type), overwrite_(overwrite), module_{module}, indexes_(indexes) {}
~Configuration() = default;
Configuration(const Configuration&) = default;
@ -100,7 +100,7 @@ struct Command {
std::string action_;
std::string guard_;
std::string update_;
std::vector<int> index_{0};
std::vector<int> indexes_{0};
bool overwrite_ {false};
std::string createExpression() const;

2
util/Grid.cpp

@ -104,7 +104,7 @@ void Grid::applyOverwrites(std::string& str, std::vector<Configuration>& configu
if (!config.overwrite_) {
continue;
}
for (auto& index : config.index_) {
for (auto& index : config.indexes_) {
size_t start_pos;
std::string search;

Loading…
Cancel
Save