From 17fddff91bfc424f604add967c7d2215821da6a2 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 6 Apr 2024 18:10:49 +0800 Subject: [PATCH] clean code refactor: rename fileIncludes to fileInfo --- RedPandaIDE/compiler/projectcompiler.cpp | 4 +- RedPandaIDE/compiler/sdccprojectcompiler.cpp | 4 +- RedPandaIDE/editor.cpp | 10 -- RedPandaIDE/mainwindow.cpp | 6 - RedPandaIDE/parser/cppparser.cpp | 119 +++++++++---------- RedPandaIDE/parser/cpppreprocessor.cpp | 100 +++++----------- RedPandaIDE/parser/cpppreprocessor.h | 20 ++-- RedPandaIDE/parser/cpptokenizer.cpp | 2 - RedPandaIDE/utils.cpp | 3 - RedPandaIDE/widgets/codecompletionpopup.cpp | 1 - libs/qsynedit/qsynedit/qsynedit.cpp | 9 -- 11 files changed, 99 insertions(+), 179 deletions(-) diff --git a/RedPandaIDE/compiler/projectcompiler.cpp b/RedPandaIDE/compiler/projectcompiler.cpp index e30b7906..ce98693a 100644 --- a/RedPandaIDE/compiler/projectcompiler.cpp +++ b/RedPandaIDE/compiler/projectcompiler.cpp @@ -384,11 +384,11 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file) QString objStr = escapeFilenameForMakefilePrerequisite(shortFileName); // if we have scanned it, use scanned info if (parser && parser->fileScanned(unit->fileName())) { - QSet fileIncludes = parser->getIncludedFiles(unit->fileName()); + QSet includedFiles = parser->getIncludedFiles(unit->fileName()); foreach(const PProjectUnit &unit2, projectUnits) { if (unit2==unit) continue; - if (fileIncludes.contains(unit2->fileName())) { + if (includedFiles.contains(unit2->fileName())) { if (mProject->options().usePrecompiledHeader && unit2->fileName() == mProject->options().precompiledHeader) precompileStr = " $(PCH) "; diff --git a/RedPandaIDE/compiler/sdccprojectcompiler.cpp b/RedPandaIDE/compiler/sdccprojectcompiler.cpp index c1ac2be4..a754f732 100644 --- a/RedPandaIDE/compiler/sdccprojectcompiler.cpp +++ b/RedPandaIDE/compiler/sdccprojectcompiler.cpp @@ -219,11 +219,11 @@ void SDCCProjectCompiler::writeMakeObjFilesRules(QFile &file) QString objStr = escapeFilenameForMakefilePrerequisite(shortFileName); // if we have scanned it, use scanned info if (parser && parser->fileScanned(unit->fileName())) { - QSet fileIncludes = parser->getIncludedFiles(unit->fileName()); + QSet includedFiles = parser->getIncludedFiles(unit->fileName()); foreach(const PProjectUnit &unit2, projectUnits) { if (unit2==unit) continue; - if (fileIncludes.contains(unit2->fileName())) { + if (includedFiles.contains(unit2->fileName())) { QString header = extractRelativePath(mProject->makeFileName(),unit2->fileName()); objStr = objStr + ' ' + escapeFilenameForMakefilePrerequisite(header); } diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index f091497c..17191194 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1307,13 +1307,6 @@ bool Editor::onGetSpecialLineColors(int Line, QColor &foreground, QColor &backgr backgroundColor = mBreakpointBackgroundColor; return true; } -// end else if Line = fErrorLine then begin -// StrToThemeColor(tc, devEditor.Syntax.Values[cErr]); -// BG := tc.Background; -// FG := tc.Foreground; -// if (BG <> clNone) or (FG<>clNone) then -// Special := TRUE; -// end; return false; } @@ -2789,8 +2782,6 @@ bool Editor::handleParentheseCompletion() } return true; } -// if (status == QuoteStatus::NotQuote) && FunctionTipAllowed then - // fFunctionTip.Activated := true; return false; } @@ -4150,7 +4141,6 @@ QString Editor::getParserHint(const QStringList& expression,const QString &/*s*/ } else { // hard defines result = mParser->prettyPrintStatement(statement, mFilename); } -// Result := StringReplace(Result, '|', #5, [rfReplaceAll]); return result; } diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 9822affa..2f079a8d 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -5940,10 +5940,6 @@ void MainWindow::onCompileIssue(PCompileIssue issue) return; ui->tableIssues->addIssue(issue); - // Update tab caption -// if CompilerOutput.Items.Count = 1 then -// CompSheet.Caption := Lang[ID_SHEET_COMP] + ' (' + IntToStr(CompilerOutput.Items.Count) + ')'; - if (issue->type == CompileIssueType::Error || issue->type == CompileIssueType::Warning) { Editor* e = mEditorList->getOpenedEditorByFilename(issue->filename); @@ -7183,8 +7179,6 @@ void MainWindow::on_actionNew_Project_triggered() } } -// if cbDefault.Checked then -// devData.DefCpp := rbCpp.Checked; QDir projectDir = QDir(location); if (!projectDir.isEmpty()) { if (QMessageBox::question( diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index e48ecefc..d5e8db7b 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -200,20 +200,20 @@ PStatement CppParser::findScopeStatement(const QString &filename, int line) PStatement CppParser::doFindScopeStatement(const QString &filename, int line) const { - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename); - if (!fileIncludes) + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(filename); + if (!fileInfo) return PStatement(); - return fileIncludes->scopes.findScopeAtLine(line); + return fileInfo->scopes.findScopeAtLine(line); } PParsedFileInfo CppParser::findFileIncludes(const QString &filename, bool deleteIt) { QMutexLocker locker(&mMutex); - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename); - if (deleteIt && fileIncludes) + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(filename); + if (deleteIt && fileInfo) mPreprocessor.removeFileIncludes(filename); - return fileIncludes; + return fileInfo; } QString CppParser::findFirstTemplateParamOf(const QString &fileName, const QString &phrase, const PStatement& currentScope) { @@ -234,10 +234,10 @@ QString CppParser::findTemplateParamOf(const QString &fileName, const QString &p PStatement CppParser::findFunctionAt(const QString &fileName, int line) { QMutexLocker locker(&mMutex); - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(fileName); - if (!fileIncludes) + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(fileName); + if (!fileInfo) return PStatement(); - for (PStatement& statement : fileIncludes->statements) { + for (PStatement& statement : fileInfo->statements) { if (statement->kind != StatementKind::Function && statement->kind != StatementKind::Constructor && statement->kind != StatementKind::Destructor) @@ -664,15 +664,15 @@ PStatement CppParser::doFindAliasedStatement(const PStatement &statement, QSettype.mid(0,pos); QString name = statement->type.mid(pos+2); - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(statement->fileName); - if (!fileIncludes) + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(statement->fileName); + if (!fileInfo) return PStatement(); foundSet.insert(statement.get()); PStatement result; if (nsName.isEmpty()) { QList resultList = findMembersOfStatement(name,PStatement()); foreach(const PStatement& resultStatement,resultList) { - if (fileIncludes->includeFiles.contains(resultStatement->fileName)) { + if (fileInfo->includeFiles.contains(resultStatement->fileName)) { result = resultStatement; break; } @@ -685,7 +685,7 @@ PStatement CppParser::doFindAliasedStatement(const PStatement &statement, QSet resultList = findMembersOfStatement(name,namespaceStatement); foreach(const PStatement& resultStatement,resultList) { - if (fileIncludes->includeFiles.contains(resultStatement->fileName)) { + if (fileInfo->includeFiles.contains(resultStatement->fileName)) { result = resultStatement; break; } @@ -838,10 +838,10 @@ QStringList CppParser::getFileDirectIncludes(const QString &filename) return QStringList(); if (filename.isEmpty()) return QStringList(); - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename); + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(filename); - if (fileIncludes) { - return fileIncludes->directIncludes; + if (fileInfo) { + return fileInfo->directIncludes; } return QStringList(); @@ -854,10 +854,10 @@ QSet CppParser::internalGetIncludedFiles(const QString &filename) const if (filename.isEmpty()) return list; list.insert(filename); - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename); + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(filename); - if (fileIncludes) { - foreach (const QString& file, fileIncludes->includeFiles.keys()) { + if (fileInfo) { + foreach (const QString& file, fileInfo->includeFiles.keys()) { list.insert(file); } } @@ -883,13 +883,13 @@ QSet CppParser::internalGetFileUsings(const QString &filename) const return result; // if (mParsing) // return result; - PParsedFileInfo fileIncludes= mPreprocessor.findFileIncludes(filename); - if (fileIncludes) { - foreach (const QString& usingName, fileIncludes->usings) { + PParsedFileInfo fileInfo= mPreprocessor.findFileInfo(filename); + if (fileInfo) { + foreach (const QString& usingName, fileInfo->usings) { result.insert(usingName); } - foreach (const QString& subFile,fileIncludes->includeFiles.keys()){ - PParsedFileInfo subIncludes = mPreprocessor.findFileIncludes(subFile); + foreach (const QString& subFile,fileInfo->includeFiles.keys()){ + PParsedFileInfo subIncludes = mPreprocessor.findFileInfo(subFile); if (subIncludes) { foreach (const QString& usingName, subIncludes->usings) { result.insert(usingName); @@ -939,10 +939,10 @@ bool CppParser::isLineVisible(const QString &fileName, int line) if (mParsing) { return true; } - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(fileName); - if (!fileIncludes) + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(fileName); + if (!fileInfo) return true; - return fileIncludes->isLineVisible(line); + return fileInfo->isLineVisible(line); } void CppParser::invalidateFile(const QString &fileName) @@ -1436,9 +1436,9 @@ PStatement CppParser::addStatement(const PStatement& parent, if (oldStatement && !oldStatement->hasDefinition()) { oldStatement->setHasDefinition(true); if (oldStatement->fileName!=fileName) { - PParsedFileInfo fileIncludes=mPreprocessor.findFileIncludes(fileName); - if (fileIncludes) { - fileIncludes->statements.insert(oldStatement->fullName, + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(fileName); + if (fileInfo) { + fileInfo->statements.insert(oldStatement->fullName, oldStatement); } } @@ -1497,9 +1497,9 @@ PStatement CppParser::addStatement(const PStatement& parent, } if (result->kind!= StatementKind::Block) { - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(fileName); - if (fileIncludes) { - fileIncludes->statements.insert(result->fullName,result); + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(fileName); + if (fileInfo) { + fileInfo->statements.insert(result->fullName,result); } } return result; @@ -1744,10 +1744,10 @@ void CppParser::addSoloScopeLevel(PStatement& statement, int line, bool shouldRe mCurrentScope.append(statement); - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(mCurrentFile); + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(mCurrentFile); - if (fileIncludes) { - fileIncludes->scopes.addScope(line,statement); + if (fileInfo) { + fileInfo->scopes.addScope(line,statement); } // Set new scope @@ -1776,17 +1776,17 @@ void CppParser::removeScopeLevel(int line, int maxIndex) // qDebug()<<"--remove scope"<kind == StatementKind::Block) { if (currentScope->children.isEmpty()) { // remove no children block - if (fileIncludes) - fileIncludes->scopes.removeLastScope(); + if (fileInfo) + fileInfo->scopes.removeLastScope(); mStatementList.deleteStatement(currentScope); } else { - if (fileIncludes) - fileIncludes->statements.insert(currentScope->fullName,currentScope); + if (fileInfo) + fileInfo->statements.insert(currentScope->fullName,currentScope); } } else if (currentScope->kind == StatementKind::Class) { mIndex=indexOfNextSemicolon(mIndex, maxIndex); @@ -1797,9 +1797,8 @@ void CppParser::removeScopeLevel(int line, int maxIndex) // Set new scope currentScope = getCurrentScope(); - // fileIncludes:=FindFileIncludes(fCurrentFile); - if (fileIncludes && fileIncludes->scopes.lastScope()!=currentScope) { - fileIncludes->scopes.addScope(line,currentScope); + if (fileInfo && fileInfo->scopes.lastScope()!=currentScope) { + fileInfo->scopes.addScope(line,currentScope); } if (!currentScope) { @@ -1841,10 +1840,10 @@ QStringList CppParser::sortFilesByIncludeRelations(const QSet &files) while (!fileSet.isEmpty()) { bool found=false; foreach (const QString& file,fileSet) { - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(file); + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(file); bool hasInclude=false; - if (fileIncludes) { - foreach(const QString& inc,fileIncludes->includeFiles.keys()) { + if (fileInfo) { + foreach(const QString& inc,fileInfo->includeFiles.keys()) { if (fileSet.contains(inc)) { hasInclude=true; break; @@ -3391,9 +3390,9 @@ void CppParser::handlePreprocessor() if (delimPos>=0) { // qDebug()<line<baseFile; + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(mCurrentFile); + if (fileInfo) { + mCurrentFile = fileInfo->baseFile; } else { mCurrentFile.squeeze(); } @@ -3974,7 +3973,7 @@ void CppParser::handleUsing(int maxIndex) scopeStatement->usingList.insert(fullName); } } else { - PParsedFileInfo fileInfo = mPreprocessor.findFileIncludes(mCurrentFile); + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(mCurrentFile); if (!fileInfo) return; if (mNamespaces.contains(usingName)) { @@ -4281,9 +4280,9 @@ void CppParser::handleInheritance(PStatement derivedStatement, PClassInheritance inheritanceInfo->visibility); // inheritanceInfo->parentClassFilename = statement->fileName; inheritanceInfo->handled = true; - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(statement->fileName); - Q_ASSERT(fileIncludes!=nullptr); - fileIncludes->handledInheritances.append(inheritanceInfo); + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(statement->fileName); + Q_ASSERT(fileInfo!=nullptr); + fileInfo->handledInheritances.append(inheritanceInfo); } } @@ -4479,7 +4478,7 @@ PStatement CppParser::findMacro(const QString &phrase, const QString &fileName) if (statementMap.isEmpty()) return PStatement(); StatementList statements = statementMap.values(phrase); - PParsedFileInfo includes = mPreprocessor.findFileIncludes(fileName); + PParsedFileInfo includes = mPreprocessor.findFileInfo(fileName); foreach (const PStatement& s, statements) { if (s->kind == StatementKind::Preprocessor) { if (includes && fileName != s->fileName && !includes->includeFiles.contains(s->fileName)) @@ -4542,14 +4541,14 @@ PStatement CppParser::findMemberOfStatement(const QString& filename, return statementMap.value(s,PStatement()); } else { QList stats = statementMap.values(s); - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(filename); + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(filename); foreach(const PStatement &s,stats) { if (s->line==-1) { return s; // hard defines } if (s->fileName == filename || s->definitionFileName==filename) { return s; - } else if (fileIncludes && (fileIncludes->includeFiles.contains(s->fileName) - || fileIncludes->includeFiles.contains(s->definitionFileName))) { + } else if (fileInfo && (fileInfo->includeFiles.contains(s->fileName) + || fileInfo->includeFiles.contains(s->definitionFileName))) { return s; } } @@ -5963,8 +5962,8 @@ QSet CppParser::calculateFilesToBeReparsed(const QString &fileName) QSet result; result.insert(fileName); foreach (const QString& file, mProjectFiles) { - PParsedFileInfo fileIncludes = mPreprocessor.findFileIncludes(file); - if (fileIncludes && fileIncludes->includeFiles.contains(fileName)) { + PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(file); + if (fileInfo && fileInfo->includeFiles.contains(fileName)) { result.insert(file); } } diff --git a/RedPandaIDE/parser/cpppreprocessor.cpp b/RedPandaIDE/parser/cpppreprocessor.cpp index 0fef272c..3e760625 100644 --- a/RedPandaIDE/parser/cpppreprocessor.cpp +++ b/RedPandaIDE/parser/cpppreprocessor.cpp @@ -33,7 +33,7 @@ void CppPreprocessor::clear() //Result across processings. //used by parser even preprocess finished - mIncludesList.clear(); + mFileInfos.clear(); mFileDefines.clear(); //dictionary to save defines for each headerfile; mFileUndefines.clear(); //dictionary to save undefines for each headerfile; mScannedFiles.clear(); @@ -57,7 +57,7 @@ void CppPreprocessor::clearTempResults() mFileName=""; mBuffer.clear(); mResult.clear(); - mCurrentIncludes=nullptr; + mCurrentFileInfo=nullptr; mIncludes.clear(); // stack of files we've stepped into. last one is current file, first one is source file mBranchResults.clear();// stack of branch results (boolean). last one is current branch, first one is outermost branch //mDefines.clear(); // working set, editable @@ -224,8 +224,8 @@ void CppPreprocessor::dumpIncludesListTo(const QString &fileName) const QFile file(fileName); if (file.open(QIODevice::WriteOnly|QIODevice::Truncate)) { QTextStream stream(&file); - for (const PParsedFileInfo& fileIncludes:mIncludesList) { - stream<baseFile<<" : " + for (const PParsedFileInfo& fileInfo:mFileInfos) { + stream<baseFile<<" : " #if QT_VERSION >= QT_VERSION_CHECK(5,15,0) <includeFiles.keys()) { + foreach (const QString& s,fileInfo->includeFiles.keys()) { stream<<"\t--"+s #if QT_VERSION >= QT_VERSION_CHECK(5,15,0) <= QT_VERSION_CHECK(5,15,0) - <= QT_VERSION_CHECK(5,15,0) - <= QT_VERSION_CHECK(5,15,0) -// <usings) { -// stream<<"\t++"+s -// #if QT_VERSION >= QT_VERSION_CHECK(5,15,0) -// <= QT_VERSION_CHECK(5,15,0) -// <statements) { -// if (statement) { -// stream<command,statement->fullName) -// #if QT_VERSION >= QT_VERSION_CHECK(5,15,0) -// <baseFile; + PParsedFileInfo fileInfo = findFileInfo(fileName); + if (fileInfo) { + fileName = fileInfo->baseFile; } else { fileName.squeeze(); } @@ -818,15 +775,15 @@ void CppPreprocessor::openInclude(QString fileName) // } bool alreadyIncluded = false; for (PParsedFile& parsedFile:mIncludes) { - if (parsedFile->fileIncludes->includeFiles.contains(fileName)) { + if (parsedFile->fileInfo->includeFiles.contains(fileName)) { alreadyIncluded = true; continue; } - parsedFile->fileIncludes->includeFiles.insert(fileName,false); + parsedFile->fileInfo->includeFiles.insert(fileName,false); } PParsedFile innerMostFile = mIncludes.back(); - innerMostFile->fileIncludes->includeFiles.insert(fileName,true); - innerMostFile->fileIncludes->directIncludes.append(fileName); + innerMostFile->fileInfo->includeFiles.insert(fileName,true); + innerMostFile->fileInfo->directIncludes.append(fileName); if (alreadyIncluded) return; // Backup old position if we're entering a new file @@ -844,14 +801,14 @@ void CppPreprocessor::openInclude(QString fileName) // Keep track of files we include here // Only create new items for files we have NOT scanned yet - mCurrentIncludes = getFileIncludesEntry(fileName); - if (!mCurrentIncludes) { + mCurrentFileInfo = findFileInfo(fileName); + if (!mCurrentFileInfo) { // do NOT create a new item for a file that's already in the list - mCurrentIncludes = std::make_shared(); - mCurrentIncludes->baseFile = fileName; - mIncludesList.insert(fileName,mCurrentIncludes); + mCurrentFileInfo = std::make_shared(); + mCurrentFileInfo->baseFile = fileName; + mFileInfos.insert(fileName,mCurrentFileInfo); } - parsedFile->fileIncludes = mCurrentIncludes; + parsedFile->fileInfo = mCurrentFileInfo; // Don't parse stuff we have already parsed if (!mScannedFiles.contains(fileName)) { @@ -872,11 +829,11 @@ void CppPreprocessor::openInclude(QString fileName) } else { //add defines of already parsed including headers; addDefinesInFile(fileName); - PParsedFileInfo fileIncludes = getFileIncludesEntry(fileName); - if (fileIncludes) { + PParsedFileInfo fileInfo = findFileInfo(fileName); + if (fileInfo) { for (PParsedFile& file:mIncludes) { - foreach (const QString& incFile,fileIncludes->includeFiles.keys()) { - file->fileIncludes->includeFiles.insert(incFile,false); + foreach (const QString& incFile,fileInfo->includeFiles.keys()) { + file->fileInfo->includeFiles.insert(incFile,false); } } } @@ -924,8 +881,7 @@ void CppPreprocessor::closeInclude() // Start augmenting previous include list again - //fCurrentIncludes := GetFileIncludesEntry(fFileName); - mCurrentIncludes = parsedFile->fileIncludes; + mCurrentFileInfo = parsedFile->fileInfo; // Update result file (we've left the previous file) mResult.append( @@ -959,9 +915,9 @@ void CppPreprocessor::addDefinesInFile(const QString &fileName) } } - PParsedFileInfo fileIncludes = getFileIncludesEntry(fileName); - if (fileIncludes) { - foreach (const QString& file, fileIncludes->includeFiles.keys()) { + PParsedFileInfo fileInfo = findFileInfo(fileName); + if (fileInfo) { + foreach (const QString& file, fileInfo->includeFiles.keys()) { addDefinesInFile(file); } } diff --git a/RedPandaIDE/parser/cpppreprocessor.h b/RedPandaIDE/parser/cpppreprocessor.h index f70fb86a..130ad1b7 100644 --- a/RedPandaIDE/parser/cpppreprocessor.h +++ b/RedPandaIDE/parser/cpppreprocessor.h @@ -41,7 +41,7 @@ struct ParsedFile { QString fileName; // Record filename, but not used now QStringList buffer; // do not concat them all int branches; //branch levels; - PParsedFileInfo fileIncludes; // includes of this file + PParsedFileInfo fileInfo; // info of this file }; using PParsedFile = std::shared_ptr; @@ -91,12 +91,12 @@ public: return mResult; }; - PParsedFileInfo findFileIncludes(const QString& fileName) const { - return mIncludesList.value(fileName); + PParsedFileInfo findFileInfo(const QString& fileName) const { + return mFileInfos.value(fileName); } void removeFileIncludes(const QString& fileName) { - mIncludesList.remove(fileName); + mFileInfos.remove(fileName); } bool fileScanned(const QString& fileName) const { @@ -169,7 +169,7 @@ private: } void setCurrentBranch(BranchResult value){ if (!sameResultWithCurrentBranch(value)) { - mCurrentIncludes->branches.insert(mIndex+1,value==BranchResult::isTrue); + mCurrentFileInfo->branches.insert(mIndex+1,value==BranchResult::isTrue); } mBranchResults.append(value); } @@ -179,13 +179,9 @@ private: mBranchResults.pop_back(); } if (!sameResultWithCurrentBranch(value)) { - mCurrentIncludes->branches.insert(mIndex,getCurrentBranch()==BranchResult::isTrue); + mCurrentFileInfo->branches.insert(mIndex,getCurrentBranch()==BranchResult::isTrue); } } - // include stuff - PParsedFileInfo getFileIncludesEntry(const QString& fileName){ - return mIncludesList.value(fileName,PParsedFileInfo()); - } void addDefinesInFile(const QString& fileName); void addDefineByParts(const QString& name, const QString& args, const QString& value, bool hardCoded); @@ -262,7 +258,7 @@ private: QString mFileName; QStringList mBuffer; QStringList mResult; - PParsedFileInfo mCurrentIncludes; + PParsedFileInfo mCurrentFileInfo; int mPreProcIndex; QList mIncludes; // stack of files we've stepped into. last one is current file, first one is source file QList mBranchResults;// stack of branch results (boolean). last one is current branch, first one is outermost branch @@ -272,7 +268,7 @@ private: //Result across processings. //used by parser even preprocess finished - QHash mIncludesList; + QHash mFileInfos; QHash mFileDefines; //dictionary to save defines for each headerfile; QHash mFileUndefines; //dictionary to save defines for each headerfile; QSet mScannedFiles; diff --git a/RedPandaIDE/parser/cpptokenizer.cpp b/RedPandaIDE/parser/cpptokenizer.cpp index 26ef60c9..c732ae11 100644 --- a/RedPandaIDE/parser/cpptokenizer.cpp +++ b/RedPandaIDE/parser/cpptokenizer.cpp @@ -437,8 +437,6 @@ QString CppTokenizer::getPreprocessor() QString CppTokenizer::getWord() { bool bFoundTemplate = false; - // bIsSmartPointer:=False; - // Skip spaces skipToNextToken(); diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp index acf6a4b9..15a7efbb 100644 --- a/RedPandaIDE/utils.cpp +++ b/RedPandaIDE/utils.cpp @@ -238,9 +238,6 @@ void resetCppParser(std::shared_ptr parser, int compilerSetIndex) return; // Configure parser parser->resetParser(); - //paser->enabled = pSettings-> devCodeCompletion.Enabled; -// CppParser.ParseLocalHeaders := devCodeCompletion.ParseLocalHeaders; -// CppParser.ParseGlobalHeaders := devCodeCompletion.ParseGlobalHeaders; parser->setEnabled(true); parser->setParseGlobalHeaders(true); parser->setParseLocalHeaders(true); diff --git a/RedPandaIDE/widgets/codecompletionpopup.cpp b/RedPandaIDE/widgets/codecompletionpopup.cpp index c31ef68c..19b70a5b 100644 --- a/RedPandaIDE/widgets/codecompletionpopup.cpp +++ b/RedPandaIDE/widgets/codecompletionpopup.cpp @@ -88,7 +88,6 @@ void CodeCompletionPopup::prepareSearch( QMutexLocker locker(&mMutex); if (!isEnabled()) return; - //Screen.Cursor := crHourglass; QCursor oldCursor = cursor(); setCursor(Qt::CursorShape::WaitCursor); diff --git a/libs/qsynedit/qsynedit/qsynedit.cpp b/libs/qsynedit/qsynedit/qsynedit.cpp index e2ce2be5..3be655cf 100644 --- a/libs/qsynedit/qsynedit/qsynedit.cpp +++ b/libs/qsynedit/qsynedit/qsynedit.cpp @@ -63,7 +63,6 @@ QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent), mFontDummy.setStyleStrategy(QFont::PreferAntialias); mDocument = std::make_shared(mFontDummy, this); - //fPlugins := TList.Create; mMouseMoved = false; mMouseOrigin = QPoint(0,0); mUndoing = false; @@ -103,11 +102,7 @@ QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent), mGutter.setRightOffset(21); mGutter.connect(&mGutter, &Gutter::changed, this, &QSynEdit::onGutterChanged); mGutterWidth = mGutter.realGutterWidth(charWidth()); - //ControlStyle := ControlStyle + [csOpaque, csSetCaption, csNeedsBorderPaint]; - //Height := 150; - //Width := 200; this->setCursor(Qt::CursorShape::IBeamCursor); - //TabStop := True; mInserting = true; mLineSpacingFactor = 1.0; @@ -121,9 +116,6 @@ QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent), //stop qt to auto fill background setAutoFillBackground(false); - //fFocusList := TList.Create; - //fKbdHandler := TSynEditKbdHandler.Create; - //fMarkList.OnChange := MarkListChange; setDefaultKeystrokes(); mRightEdgeColor = Qt::lightGray; @@ -1158,7 +1150,6 @@ void QSynEdit::processGutterClick(QMouseEvent *event) PCodeFoldingRange foldRange = foldStartAtLine(line); if (foldRange) { // See if we actually clicked on the rectangle... - //rect.Left := Gutter.RealGutterWidth(CharWidth) - Gutter.RightOffset; QRect rect; rect.setLeft(mGutterWidth - mGutter.rightOffset()); rect.setRight(rect.left() + mGutter.rightOffset() - 4);