Commit 16d54aa7 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

custom-definesandincludes: port foreach -> range-based for

parent 123b2024
......@@ -188,7 +188,8 @@ Path::List GccLikeCompiler::includes(Utils::LanguageType type, const QString& ar
Status mode = Initial;
const auto output = QString::fromLocal8Bit( proc.readAllStandardOutput() );
foreach (const auto& line, output.splitRef(QLatin1Char('\n'))) {
const auto lines = output.splitRef(QLatin1Char('\n'));
for (const auto& line : lines) {
switch ( mode ) {
case Initial:
if ( line.indexOf( QLatin1String("#include \"...\"") ) != -1 ) {
......
......@@ -272,7 +272,8 @@ QVector<ConfigEntry> convertedPaths( KConfig* cfg )
return {};
QVector<ConfigEntry> paths;
foreach( const QString &grpName, sorted(group.groupList()) ) {
const auto sortedGroupNames = sorted(group.groupList());
for (const QString& grpName : sortedGroupNames) {
KConfigGroup subgroup = group.group( grpName );
if ( !subgroup.isValid() )
continue;
......
......@@ -52,7 +52,8 @@ CompilersWidget::CompilersWidget(QWidget* parent)
auto settings = SettingsManager::globalInstance();
auto provider = settings->provider();
foreach (const auto& factory, provider->compilerFactories()) {
const auto compilerFactories = provider->compilerFactories();
for (const auto& factory : compilerFactories) {
auto* action = new QAction(m_addMenu);
const QString fname = factory->name();
action->setText(fname);
......@@ -99,7 +100,8 @@ void CompilersWidget::deleteCompiler()
{
qCDebug(DEFINESANDINCLUDES) << "Deleting compiler";
auto selectionModel = m_ui->compilers->selectionModel();
foreach (const QModelIndex& row, selectionModel->selectedIndexes()) {
const auto selectedRowsBefore = selectionModel->selectedIndexes();
for (const QModelIndex& row : selectedRowsBefore) {
if (row.column() == 1) {
//Don't remove the same compiler twice
continue;
......@@ -118,7 +120,8 @@ void CompilersWidget::addCompiler(const QString& factoryName)
{
auto settings = SettingsManager::globalInstance();
auto provider = settings->provider();
foreach (const auto& factory, provider->compilerFactories()) {
const auto compilerFactories = provider->compilerFactories();
for (const auto& factory : compilerFactories) {
if (factoryName == factory->name()) {
//add compiler without any information, the user will fill the data in later
auto compilerIndex = m_compilersModel->addCompiler(factory->createCompiler(QString(), QString()));
......
......@@ -84,7 +84,7 @@ bool ProjectPathsModel::setData( const QModelIndex& index, const QVariant& value
QString addedPath = sanitizePath( value.toString(), false );
// Do not allow duplicates
foreach( const ConfigEntry& existingConfig, projectPaths ) {
for (const ConfigEntry& existingConfig : qAsConst(projectPaths)) {
if( addedPath == existingConfig.path ) {
return false;
}
......@@ -191,7 +191,7 @@ void ProjectPathsModel::addPathInternal( const ConfigEntry& config, bool prepend
Q_ASSERT(!config.parserArguments.isAnyEmpty());
// Do not allow duplicates
foreach( const ConfigEntry& existingConfig, projectPaths ) {
for (const ConfigEntry& existingConfig : qAsConst(projectPaths)) {
if( config.path == existingConfig.path ) {
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment