work save
This commit is contained in:
parent
428b293196
commit
b38f75b732
|
@ -95,23 +95,30 @@ void CppParser::clearProjectFiles()
|
|||
mProjectFiles.clear();
|
||||
}
|
||||
|
||||
void CppParser::fillListOfFunctions(const QString &fileName, const QString &phrase, int line, QStringList &list)
|
||||
QList<PStatement> CppParser::getListOfFunctions(const QString &fileName, const QString &phrase, int line)
|
||||
{
|
||||
QMutexLocker locker(&mMutex);
|
||||
list.clear();
|
||||
QList<PStatement> result;
|
||||
if (mParsing)
|
||||
return result;
|
||||
|
||||
PStatement statement = findStatementOf(fileName,phrase, line);
|
||||
if (!statement)
|
||||
return;
|
||||
return result;
|
||||
PStatement parentScope = statement->parentScope.lock();
|
||||
if (parentScope && parentScope->kind == StatementKind::skNamespace) {
|
||||
PStatementList namespaceStatementsList = findNamespace(parentScope->command);
|
||||
if (namespaceStatementsList) {
|
||||
for (PStatement& namespaceStatement : *namespaceStatementsList) {
|
||||
fillListOfFunctions(fileName,line,statement,namespaceStatement,list);
|
||||
result.append(
|
||||
getListOfFunctions(fileName,line,statement,namespaceStatement));
|
||||
}
|
||||
}
|
||||
} else
|
||||
fillListOfFunctions(fileName,line,statement,parentScope,list);
|
||||
result.append(
|
||||
getListOfFunctions(fileName,line,statement,parentScope)
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
PStatement CppParser::findAndScanBlockAt(const QString &filename, int line)
|
||||
|
@ -123,7 +130,6 @@ PStatement CppParser::findAndScanBlockAt(const QString &filename, int line)
|
|||
if (!fileIncludes)
|
||||
return PStatement();
|
||||
|
||||
|
||||
PStatement statement = fileIncludes->scopes.findScopeAtLine(line);
|
||||
return statement;
|
||||
}
|
||||
|
@ -3133,6 +3139,25 @@ void CppParser::fillListOfFunctions(const QString& fileName, int line,
|
|||
}
|
||||
}
|
||||
|
||||
QList<PStatement> CppParser::getListOfFunctions(const QString &fileName, int line, const PStatement &statement, const PStatement &scopeStatement)
|
||||
{
|
||||
QList<PStatement> result;
|
||||
StatementMap children = mStatementList.childrenStatements(scopeStatement);
|
||||
for (const PStatement& child:children) {
|
||||
if ((statement->command == child->command)
|
||||
#ifdef Q_OS_WIN
|
||||
|| (statement->command +'A' == child->command)
|
||||
|| (statement->command +'W' == child->command)
|
||||
#endif
|
||||
) {
|
||||
if (line < child->line && (child->fileName == fileName))
|
||||
continue;
|
||||
result.append(child);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
PStatement CppParser::findMemberOfStatement(const QString &phrase,
|
||||
const PStatement& scopeStatement)
|
||||
{
|
||||
|
|
|
@ -24,10 +24,9 @@ public:
|
|||
void clearIncludePaths();
|
||||
void clearProjectIncludePaths();
|
||||
void clearProjectFiles();
|
||||
void fillListOfFunctions(const QString& fileName,
|
||||
QList<PStatement> getListOfFunctions(const QString& fileName,
|
||||
const QString& phrase,
|
||||
int line,
|
||||
QStringList& list);
|
||||
int line);
|
||||
PStatement findAndScanBlockAt(const QString& filename, int line);
|
||||
PFileIncludes findFileIncludes(const QString &filename, bool deleteIt = false);
|
||||
QString findFirstTemplateParamOf(const QString& fileName,
|
||||
|
@ -194,6 +193,9 @@ private:
|
|||
void fillListOfFunctions(const QString& fileName, int line,
|
||||
const PStatement& statement,
|
||||
const PStatement& scopeStatement, QStringList& list);
|
||||
QList<PStatement> getListOfFunctions(const QString& fileName, int line,
|
||||
const PStatement& statement,
|
||||
const PStatement& scopeStatement);
|
||||
PStatement findMemberOfStatement(
|
||||
const QString& phrase,
|
||||
const PStatement& scopeStatement);
|
||||
|
|
Loading…
Reference in New Issue