Moved smart selector functions to lists

This commit is contained in:
Klaus Basan
2015-10-14 19:56:31 +02:00
committed by Mathew Sutcliffe
parent 5e42aa0b95
commit 955b8bafea
12 changed files with 135 additions and 83 deletions

View File

@@ -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

View File

@@ -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