ProjectExplorer: Remove some Id use from DeployConfig interface

There's a 1:1 relation between the involved types, having either
the factory or the id implies having the other. So shorten interfaces
that used both so far. Also canCreate() == canHandle() && id matches,
so use that directly.

Also drop/QTC_ASSERT former canHandle() checks that are implicit
in preceding ::find() calls.

Change-Id: I686ea5774c5a01b05b3b4882b3d59080a812a677
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-01-22 13:14:22 +01:00
parent 197f2b5f2a
commit 7f3de881e3
4 changed files with 7 additions and 33 deletions

View File

@@ -190,19 +190,9 @@ void DeployConfigurationFactory::setConfigBaseId(Core::Id deployConfigBaseId)
m_deployConfigBaseId = deployConfigBaseId;
}
bool DeployConfigurationFactory::canCreate(Target *parent, Core::Id id) const
DeployConfiguration *DeployConfigurationFactory::create(Target *parent)
{
if (!canHandle(parent))
return false;
if (!id.name().startsWith(m_deployConfigBaseId.name()))
return false;
return true;
}
DeployConfiguration *DeployConfigurationFactory::create(Target *parent, Core::Id id)
{
if (!canCreate(parent, id))
return nullptr;
QTC_ASSERT(canHandle(parent), return nullptr);
QTC_ASSERT(m_creator, return nullptr);
DeployConfiguration *dc = m_creator(parent);
if (!dc)