forked from qt-creator/qt-creator
Meson: Inline one of the findTool() into its only user
Change-Id: I6cadbc4a7c70fe8fc7590c12a638dd472df3f327 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -207,18 +207,6 @@ std::optional<FilePath> findTool(ToolType toolType)
|
||||
|
||||
std::vector<MesonTools::Tool_t> s_tools;
|
||||
|
||||
static MesonTools::Tool_t findTool(const Id &id, ToolType toolType)
|
||||
{
|
||||
const auto tool = std::find_if(std::cbegin(s_tools),
|
||||
std::cend(s_tools),
|
||||
[&id](const MesonTools::Tool_t &tool) {
|
||||
return tool->id() == id;
|
||||
});
|
||||
if (tool != std::cend(s_tools) && (*tool)->toolType() == toolType)
|
||||
return *tool;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MesonTools::Tool_t MesonTools::autoDetectedTool(ToolType toolType)
|
||||
{
|
||||
for (const auto &tool : s_tools) {
|
||||
@@ -287,7 +275,14 @@ void MesonTools::removeTool(const Id &id)
|
||||
|
||||
std::shared_ptr<ToolWrapper> MesonTools::toolById(const Id &id, ToolType toolType)
|
||||
{
|
||||
return findTool(id, toolType);
|
||||
const auto tool = std::find_if(std::cbegin(s_tools),
|
||||
std::cend(s_tools),
|
||||
[&id](const MesonTools::Tool_t &tool) {
|
||||
return tool->id() == id;
|
||||
});
|
||||
if (tool != std::cend(s_tools) && (*tool)->toolType() == toolType)
|
||||
return *tool;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MesonTools *MesonTools::instance()
|
||||
|
||||
@@ -77,6 +77,7 @@ std::optional<Utils::FilePath> findTool(ToolType toolType);
|
||||
class MesonTools : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
MesonTools() {}
|
||||
~MesonTools() {}
|
||||
|
||||
@@ -94,10 +95,11 @@ public:
|
||||
static std::shared_ptr<ToolWrapper> toolById(const Utils::Id &id, ToolType toolType);
|
||||
static std::shared_ptr<ToolWrapper> autoDetectedTool(ToolType toolType);
|
||||
|
||||
Q_SIGNAL void toolAdded(const Tool_t &tool);
|
||||
Q_SIGNAL void toolRemoved(const Tool_t &tool);
|
||||
|
||||
static MesonTools *instance();
|
||||
|
||||
signals:
|
||||
void toolAdded(const Tool_t &tool);
|
||||
void toolRemoved(const Tool_t &tool);
|
||||
};
|
||||
|
||||
} // MesonProjectManager::Internal
|
||||
|
||||
Reference in New Issue
Block a user