mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
Moved smart selector functions to lists
This commit is contained in:
committed by
Mathew Sutcliffe
parent
5e42aa0b95
commit
955b8bafea
@@ -30,5 +30,19 @@ namespace BlackMisc
|
||||
return CDistributor();
|
||||
}
|
||||
|
||||
CDistributor CDistributorList::smartDistributorSelector(const CDistributor &distributorPattern)
|
||||
{
|
||||
if (distributorPattern.hasValidDbKey())
|
||||
{
|
||||
QString k(distributorPattern.getDbKey());
|
||||
CDistributor d(this->findByKey(k));
|
||||
if (d.hasCompleteData()) { return d; }
|
||||
|
||||
// more lenient search
|
||||
return this->findByIdOrAlias(k);
|
||||
}
|
||||
return CDistributor();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -43,6 +43,8 @@ namespace BlackMisc
|
||||
//! Find by id or alias
|
||||
CDistributor findByIdOrAlias(const QString &name);
|
||||
|
||||
//! Best match by given pattern
|
||||
CDistributor smartDistributorSelector(const CDistributor &distributorPattern);
|
||||
};
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user