From 3139ffd87c85db8524d20d579171a51da3590acc Mon Sep 17 00:00:00 2001 From: Fabien Poussin Date: Wed, 9 Dec 2015 20:07:58 +0100 Subject: [PATCH] Working on duplicate detection. --- doxygen.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doxygen.cpp b/doxygen.cpp index 701234e..60a345d 100644 --- a/doxygen.cpp +++ b/doxygen.cpp @@ -155,6 +155,27 @@ void Doxygen::createDocumentation(const DoxygenSettingsStruct &DoxySettings, Cor return; } + // We don't want to document multiple times. + //QRegExp duplicate("\\brief\s*([^\n\r])+"); + // Todo: fix when doc is not saved + QRegExp duplicate("^(\\s|\t)?\\*/"); + QString text(editorWidget->document()->toPlainText()); + QStringList lines(text.split(QRegExp("\n|\r\n|\r"))); + + for (int i= 1; i <= 10; i++) + { + int prevLine = lastLine - i; + if (prevLine < 0) break; + QString checkText(lines.at(prevLine)); + if (checkText.contains(duplicate)) + { + qDebug() << "Duplicate found in" << editor->document()->filePath().toString() << prevLine; + qDebug() << checkText; + return; + } + } + + QStringList scopes = scopesForSymbol(lastSymbol); Overview overview; overview.showArgumentNames = true;