ConstellationMgr.cpp   ConstellationMgr.cpp 
skipping to change at line 1129 skipping to change at line 1129
{ {
QString objwcap = (*iter)->englishName.toUpper(); QString objwcap = (*iter)->englishName.toUpper();
if (objwcap==objw) return *iter; if (objwcap==objw) return *iter;
objwcap = (*iter)->abbreviation.toUpper(); objwcap = (*iter)->abbreviation.toUpper();
if (objwcap==objw) return *iter; if (objwcap==objw) return *iter;
} }
return NULL; return NULL;
} }
QStringList ConstellationMgr::listMatchingObjectsI18n(const QString& objPre fix, int maxNbItem) const QStringList ConstellationMgr::listMatchingObjectsI18n(const QString& objPre fix, int maxNbItem, bool useStartOfWords) const
{ {
QStringList result; QStringList result;
if (maxNbItem==0) return result; if (maxNbItem==0) return result;
QString cn; QString cn;
bool find;
vector < Constellation * >::const_iterator iter; vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); ++iter) for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
{ {
cn = (*iter)->getNameI18n(); cn = (*iter)->getNameI18n();
if (cn.contains(objPrefix,Qt::CaseInsensitive)) find = false;
if (useStartOfWords)
{
if (objPrefix.toUpper()==cn.mid(0, objPrefix.size())
.toUpper())
find = true;
}
else
{
if (cn.contains(objPrefix,Qt::CaseInsensitive))
find = true;
}
if (find)
{ {
result << cn; result << cn;
if (result.size()==maxNbItem) if (result.size()==maxNbItem)
return result; return result;
} }
} }
return result; return result;
} }
QStringList ConstellationMgr::listMatchingObjects(const QString& objPrefix, int maxNbItem) const QStringList ConstellationMgr::listMatchingObjects(const QString& objPrefix, int maxNbItem, bool useStartOfWords) const
{ {
QStringList result; QStringList result;
if (maxNbItem==0) return result; if (maxNbItem==0) return result;
QString cn; QString cn;
bool find;
vector < Constellation * >::const_iterator iter; vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); ++iter) for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
{ {
cn = (*iter)->getEnglishName(); cn = (*iter)->getEnglishName();
if (cn.contains(objPrefix, Qt::CaseInsensitive)) find = false;
if (useStartOfWords)
{
if (objPrefix.toUpper()==cn.mid(0, objPrefix.size())
.toUpper())
find = true;
}
else
{
if (cn.contains(objPrefix,Qt::CaseInsensitive))
find = true;
}
if (find)
{ {
result << cn; result << cn;
if (result.size()==maxNbItem) if (result.size()==maxNbItem)
return result; return result;
} }
} }
return result; return result;
} }
QStringList ConstellationMgr::listAllObjects(bool inEnglish) const QStringList ConstellationMgr::listAllObjects(bool inEnglish) const
 End of changes. 6 change blocks. 
4 lines changed or deleted 30 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/