StelObjectModule.cpp   StelObjectModule.cpp 
/* /*
* Stellarium * Stellarium
* Copyright (C) 2006 Fabien Chereau * Copyright (C) 2006 Fabien Chereau
* Copyright (C) 2016 Marcos Cardinot
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
skipping to change at line 30 skipping to change at line 31
#include "StelObjectModule.hpp" #include "StelObjectModule.hpp"
StelObjectModule::StelObjectModule() StelObjectModule::StelObjectModule()
: StelModule() : StelModule()
{ {
} }
StelObjectModule::~StelObjectModule() StelObjectModule::~StelObjectModule()
{ {
} }
bool StelObjectModule::matchObjectName(const QString& objName, const QStrin
g& objPrefix, bool useStartOfWords) const
{
if (useStartOfWords)
{
return objName.startsWith(objPrefix, Qt::CaseInsensitive);
}
else
{
return objName.contains(objPrefix, Qt::CaseInsensitive);
}
}
QStringList StelObjectModule::listMatchingObjects(const QString &objPrefix,
int maxNbItem, bool useStartOfWords, bool inEnglish) const
{
QStringList result;
if (maxNbItem <= 0)
{
return result;
}
QStringList names = listAllObjects(inEnglish);
foreach(const QString& name, names)
{
if (!matchObjectName(name, objPrefix, useStartOfWords))
{
continue;
}
result.append(name);
if (result.size() >= maxNbItem)
{
break;
}
}
result.sort();
return result;
}
QStringList StelObjectModule::listAllObjectsByType(const QString &objType,
bool inEnglish) const
{
Q_UNUSED(objType);
Q_UNUSED(inEnglish);
return QStringList();
}
 End of changes. 2 change blocks. 
0 lines changed or deleted 1 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/