neteja cppcheck (44 → 0) i aïllar impls de tercers
This commit is contained in:
@@ -1054,9 +1054,8 @@ void CommandRegistry::registerHandlers() { // NOLINT(readability-function-cogni
|
||||
dynamic_providers_["PALETTE"] = []() -> std::vector<std::string> {
|
||||
std::vector<std::string> result = {"NEXT", "PREV", "SORT", "DEFAULT"};
|
||||
if (Screen::get() != nullptr) {
|
||||
for (const auto& name : Screen::get()->getPaletteNames()) {
|
||||
result.push_back(toUpper(name));
|
||||
}
|
||||
const auto NAMES = Screen::get()->getPaletteNames();
|
||||
std::ranges::transform(NAMES, std::back_inserter(result), [](const auto& name) { return toUpper(name); });
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -1065,10 +1064,11 @@ void CommandRegistry::registerHandlers() { // NOLINT(readability-function-cogni
|
||||
dynamic_providers_["SHADER PRESET"] = []() -> std::vector<std::string> {
|
||||
std::vector<std::string> result = {"NEXT", "PREV"};
|
||||
const bool IS_CRTPI = Options::video.shader.current_shader == Rendering::ShaderType::CRTPI;
|
||||
auto upper_name = [](const auto& p) { return toUpper(p.name); };
|
||||
if (IS_CRTPI) {
|
||||
for (const auto& p : Options::crtpi_presets) { result.push_back(toUpper(p.name)); }
|
||||
std::ranges::transform(Options::crtpi_presets, std::back_inserter(result), upper_name);
|
||||
} else {
|
||||
for (const auto& p : Options::postfx_presets) { result.push_back(toUpper(p.name)); }
|
||||
std::ranges::transform(Options::postfx_presets, std::back_inserter(result), upper_name);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -1162,7 +1162,7 @@ void CommandRegistry::load(const std::string& yaml_path) { // NOLINT(readabilit
|
||||
if (cat_node.contains("scope")) {
|
||||
const auto& scope_node = cat_node["scope"];
|
||||
if (scope_node.is_sequence()) {
|
||||
for (const auto& s : scope_node) { cat_scopes.push_back(s.get_value<std::string>()); }
|
||||
std::ranges::transform(scope_node, std::back_inserter(cat_scopes), [](const auto& s) { return s.template get_value<std::string>(); });
|
||||
} else {
|
||||
cat_scopes.push_back(scope_node.get_value<std::string>());
|
||||
}
|
||||
@@ -1187,7 +1187,7 @@ void CommandRegistry::load(const std::string& yaml_path) { // NOLINT(readabilit
|
||||
if (cmd_node.contains("scope")) {
|
||||
const auto& scope_node = cmd_node["scope"];
|
||||
if (scope_node.is_sequence()) {
|
||||
for (const auto& s : scope_node) { def.scopes.push_back(s.get_value<std::string>()); }
|
||||
std::ranges::transform(scope_node, std::back_inserter(def.scopes), [](const auto& s) { return s.template get_value<std::string>(); });
|
||||
} else {
|
||||
def.scopes.push_back(scope_node.get_value<std::string>());
|
||||
}
|
||||
@@ -1203,9 +1203,8 @@ void CommandRegistry::load(const std::string& yaml_path) { // NOLINT(readabilit
|
||||
for (auto it = completions_node.begin(); it != completions_node.end(); ++it) {
|
||||
auto path = it.key().get_value<std::string>();
|
||||
std::vector<std::string> opts;
|
||||
for (const auto& opt : *it) {
|
||||
opts.push_back(opt.get_value<std::string>());
|
||||
}
|
||||
const auto& options_node = *it;
|
||||
std::ranges::transform(options_node, std::back_inserter(opts), [](const auto& opt) { return opt.template get_value<std::string>(); });
|
||||
def.completions[path] = std::move(opts);
|
||||
}
|
||||
}
|
||||
@@ -1224,9 +1223,8 @@ void CommandRegistry::load(const std::string& yaml_path) { // NOLINT(readabilit
|
||||
for (auto it = extras_completions.begin(); it != extras_completions.end(); ++it) {
|
||||
auto path = it.key().get_value<std::string>();
|
||||
std::vector<std::string> opts;
|
||||
for (const auto& opt : *it) {
|
||||
opts.push_back(opt.get_value<std::string>());
|
||||
}
|
||||
const auto& options_node = *it;
|
||||
std::ranges::transform(options_node, std::back_inserter(opts), [](const auto& opt) { return opt.template get_value<std::string>(); });
|
||||
def.completions[path] = std::move(opts);
|
||||
}
|
||||
}
|
||||
@@ -1285,9 +1283,8 @@ void CommandRegistry::load(const std::string& yaml_path) { // NOLINT(readabilit
|
||||
dynamic_providers_["HELP KEYS"] = []() -> std::vector<std::string> {
|
||||
std::vector<std::string> names;
|
||||
if (KeyConfig::get() != nullptr) {
|
||||
for (const auto& scope : KeyConfig::get()->getScopes()) {
|
||||
names.push_back(scope.name);
|
||||
}
|
||||
const auto& scopes = KeyConfig::get()->getScopes();
|
||||
std::ranges::transform(scopes, std::back_inserter(names), [](const auto& sc) { return sc.name; });
|
||||
}
|
||||
return names;
|
||||
};
|
||||
@@ -1321,10 +1318,8 @@ auto CommandRegistry::generateKeysHelp(const std::string& scope_filter) -> std::
|
||||
}
|
||||
|
||||
auto CommandRegistry::findCommand(const std::string& keyword) const -> const CommandDef* {
|
||||
for (const auto& cmd : commands_) {
|
||||
if (cmd.keyword == keyword) { return &cmd; }
|
||||
}
|
||||
return nullptr;
|
||||
auto it = std::ranges::find_if(commands_, [&](const auto& cmd) { return cmd.keyword == keyword; });
|
||||
return (it != commands_.end()) ? &(*it) : nullptr;
|
||||
}
|
||||
|
||||
auto CommandRegistry::execute(const std::string& keyword, const std::vector<std::string>& args) const -> std::string {
|
||||
|
||||
Reference in New Issue
Block a user