* Find the matching plugins in the registered plugins table. * * @param packerName The packer name for which the plugins are found. * @param packerVersion The packer version for which the plugins are found. * * @return The list of matched plugins. */
| 33 | * @return The list of matched plugins. |
| 34 | */ |
| 35 | PluginList PluginMgr::matchingPlugins(const std::string& packerName, const std::string& packerVersion) |
| 36 | { |
| 37 | // Iterate over all plugins for this packer name and match it against the used packer version |
| 38 | PluginList matchedPlugins; |
| 39 | for (const auto& plugin : plugins) |
| 40 | { |
| 41 | if (!utils::areEqualCaseInsensitive(plugin->getInfo()->name, packerName)) |
| 42 | continue; |
| 43 | |
| 44 | matchedPlugins.push_back(plugin); |
| 45 | } |
| 46 | |
| 47 | // For wildcard just return the all versions of this packers |
| 48 | if (packerVersion == WILDCARD_ALL_VERSIONS) |
| 49 | return matchedPlugins; |
| 50 | |
| 51 | PluginList result; |
| 52 | for (const auto& plugin : matchedPlugins) |
| 53 | { |
| 54 | // Non case-sensitive regular expressions to match against packerVersion |
| 55 | std::regex versionRegex(plugin->getInfo()->packerVersion, std::regex::icase); |
| 56 | if (std::regex_search(packerVersion, versionRegex)) |
| 57 | result.push_back(plugin); |
| 58 | } |
| 59 | |
| 60 | return result; |
| 61 | } |
| 62 | |
| 63 | } // namepsace unpackertool |
| 64 | } // namepsace retdec |
nothing calls this directly
no test coverage detected