Commit 31e4e528 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

kdevplastform/language/assistant: port foreach -> range-based for

parent 7d38f5e5
......@@ -90,8 +90,8 @@ void RenameAction::execute()
{
DocumentChangeSet changes;
foreach (const RevisionedFileRanges& ranges, d->m_oldDeclarationUses) {
foreach (const RangeInRevision range, ranges.ranges) {
for (const RevisionedFileRanges& ranges : qAsConst(d->m_oldDeclarationUses)) {
for (const RangeInRevision range : ranges.ranges) {
KTextEditor::Range currentRange;
if (ranges.revision && ranges.revision->valid()) {
currentRange = ranges.revision->transformToCurrentRevision(range);
......
......@@ -170,7 +170,7 @@ void RenameAssistant::textChanged(KTextEditor::Document* doc, const KTextEditor:
for (auto it = declUses.constBegin();
it != declUses.constEnd(); ++it) {
foreach (const RangeInRevision range, it.value()) {
for (const RangeInRevision range : qAsConst(it.value())) {
KTextEditor::Range currentRange = declAtCursor->transformFromLocalRevision(range);
if (currentRange.isEmpty() ||
doc->text(currentRange) != declAtCursor->identifier().identifier().str()) {
......
......@@ -65,7 +65,8 @@ StaticAssistantsManager::StaticAssistantsManager(QObject* parent)
this, [&](IDocument* document) {
d->documentLoaded(document);
});
foreach (IDocument* document, ICore::self()->documentController()->openDocuments()) {
const auto documents = ICore::self()->documentController()->openDocuments();
for (IDocument* document : documents) {
d->documentLoaded(document);
}
......@@ -113,7 +114,7 @@ void StaticAssistantsManagerPrivate::documentLoaded(IDocument* document)
void StaticAssistantsManagerPrivate::textInserted(Document* doc, const Cursor& cursor, const QString& text)
{
auto changed = false;
Q_FOREACH (auto assistant, m_registeredAssistants) {
for (auto& assistant : qAsConst(m_registeredAssistants)) {
auto range = Range(cursor, cursor + Cursor(0, text.size()));
auto wasUseful = assistant->isUseful();
assistant->textChanged(doc, range, {});
......@@ -131,7 +132,7 @@ void StaticAssistantsManagerPrivate::textRemoved(Document* doc, const Range& ran
const QString& removedText)
{
auto changed = false;
Q_FOREACH (auto assistant, m_registeredAssistants) {
for (auto& assistant : qAsConst(m_registeredAssistants)) {
auto wasUseful = assistant->isUseful();
assistant->textChanged(doc, range, removedText);
if (wasUseful != assistant->isUseful()) {
......@@ -147,7 +148,7 @@ void StaticAssistantsManagerPrivate::textRemoved(Document* doc, const Range& ran
void StaticAssistantsManager::notifyAssistants(const IndexedString& url,
const KDevelop::ReferencedTopDUContext& context)
{
Q_FOREACH (auto assistant, d->m_registeredAssistants) {
for (auto& assistant : qAsConst(d->m_registeredAssistants)) {
assistant->updateReady(url, context);
}
}
......@@ -168,7 +169,7 @@ QVector<KDevelop::Problem::Ptr> KDevelop::StaticAssistantsManager::problemsForCo
auto ret = QVector<KDevelop::Problem::Ptr>();
qCDebug(LANGUAGE) << "Trying to find assistants for language" << language->name();
foreach (const auto& assistant, d->m_registeredAssistants) {
for (const auto& assistant : qAsConst(d->m_registeredAssistants)) {
if (assistant->supportedLanguage() != language)
continue;
......
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