refactor: make qmutex mutable
This commit is contained in:
parent
7aa85611e3
commit
7593f3fe64
|
@ -4,7 +4,6 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QMutex>
|
|
||||||
#define COMPILER_CLANG "Clang"
|
#define COMPILER_CLANG "Clang"
|
||||||
#define COMPILER_GCC "GCC"
|
#define COMPILER_GCC "GCC"
|
||||||
#define COMPILER_GCC_UTF8 "GCC_UTF8"
|
#define COMPILER_GCC_UTF8 "GCC_UTF8"
|
||||||
|
|
|
@ -142,7 +142,7 @@ void CppParser::clearProjectFiles()
|
||||||
mProjectFiles.clear();
|
mProjectFiles.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<PStatement> CppParser::getListOfFunctions(const QString &fileName, const QString &phrase, int line)
|
QList<PStatement> CppParser::getListOfFunctions(const QString &fileName, const QString &phrase, int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
QList<PStatement> result;
|
QList<PStatement> result;
|
||||||
|
@ -185,7 +185,7 @@ QList<PStatement> CppParser::getListOfFunctions(const QString &fileName, const Q
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PStatement CppParser::findScopeStatement(const QString &filename, int line)
|
PStatement CppParser::findScopeStatement(const QString &filename, int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing) {
|
if (mParsing) {
|
||||||
|
@ -203,13 +203,13 @@ PStatement CppParser::doFindScopeStatement(const QString &filename, int line) co
|
||||||
return fileInfo->findScopeAtLine(line);
|
return fileInfo->findScopeAtLine(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
PParsedFileInfo CppParser::findFileInfo(const QString &filename)
|
PParsedFileInfo CppParser::findFileInfo(const QString &filename) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(filename);
|
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(filename);
|
||||||
return fileInfo;
|
return fileInfo;
|
||||||
}
|
}
|
||||||
QString CppParser::findFirstTemplateParamOf(const QString &fileName, const QString &phrase, const PStatement& currentScope)
|
QString CppParser::findFirstTemplateParamOf(const QString &fileName, const QString &phrase, const PStatement& currentScope) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing)
|
if (mParsing)
|
||||||
|
@ -217,7 +217,7 @@ QString CppParser::findFirstTemplateParamOf(const QString &fileName, const QStri
|
||||||
return doFindFirstTemplateParamOf(fileName,phrase,currentScope);
|
return doFindFirstTemplateParamOf(fileName,phrase,currentScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppParser::findTemplateParamOf(const QString &fileName, const QString &phrase, int index, const PStatement ¤tScope)
|
QString CppParser::findTemplateParamOf(const QString &fileName, const QString &phrase, int index, const PStatement ¤tScope) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing)
|
if (mParsing)
|
||||||
|
@ -225,7 +225,7 @@ QString CppParser::findTemplateParamOf(const QString &fileName, const QString &p
|
||||||
return doFindTemplateParamOf(fileName,phrase,index,currentScope);
|
return doFindTemplateParamOf(fileName,phrase,index,currentScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
PStatement CppParser::findFunctionAt(const QString &fileName, int line)
|
PStatement CppParser::findFunctionAt(const QString &fileName, int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(fileName);
|
PParsedFileInfo fileInfo = mPreprocessor.findFileInfo(fileName);
|
||||||
|
@ -262,7 +262,7 @@ int CppParser::findLastOperator(const QString &phrase) const
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PStatementList CppParser::findNamespace(const QString &name)
|
PStatementList CppParser::findNamespace(const QString &name) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
return doFindNamespace(name);
|
return doFindNamespace(name);
|
||||||
|
@ -274,7 +274,7 @@ PStatementList CppParser::doFindNamespace(const QString &name) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PStatement CppParser::findStatement(const QString &fullname)
|
PStatement CppParser::findStatement(const QString &fullname) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
return doFindStatement(fullname);
|
return doFindStatement(fullname);
|
||||||
|
@ -309,7 +309,7 @@ PStatement CppParser::doFindStatement(const QString &fullname) const
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
PStatement CppParser::findStatementOf(const QString &fileName, const QString &phrase, int line)
|
PStatement CppParser::findStatementOf(const QString &fileName, const QString &phrase, int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing)
|
if (mParsing)
|
||||||
|
@ -324,7 +324,7 @@ PStatement CppParser::doFindStatementOf(const QString &fileName, const QString &
|
||||||
PStatement CppParser::findStatementOf(const QString &fileName,
|
PStatement CppParser::findStatementOf(const QString &fileName,
|
||||||
const QString &phrase,
|
const QString &phrase,
|
||||||
const PStatement& currentScope,
|
const PStatement& currentScope,
|
||||||
PStatement &parentScopeType)
|
PStatement &parentScopeType) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing)
|
if (mParsing)
|
||||||
|
@ -495,7 +495,7 @@ PStatement CppParser::doFindStatementOf(const QString &fileName,
|
||||||
PEvalStatement CppParser::evalExpression(
|
PEvalStatement CppParser::evalExpression(
|
||||||
const QString &fileName,
|
const QString &fileName,
|
||||||
QStringList &phraseExpression,
|
QStringList &phraseExpression,
|
||||||
const PStatement ¤tScope)
|
const PStatement ¤tScope) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing)
|
if (mParsing)
|
||||||
|
@ -518,7 +518,7 @@ PStatement CppParser::doFindStatementOf(const QString &fileName, const QString &
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PStatement CppParser::findStatementOf(const QString &fileName, const QStringList &expression, const PStatement ¤tScope)
|
PStatement CppParser::findStatementOf(const QString &fileName, const QStringList &expression, const PStatement ¤tScope) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing)
|
if (mParsing)
|
||||||
|
@ -588,7 +588,7 @@ PStatement CppParser::doFindStatementOf(const QString &fileName, const QStringLi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PStatement CppParser::findStatementOf(const QString &fileName, const QStringList &expression, int line)
|
PStatement CppParser::findStatementOf(const QString &fileName, const QStringList &expression, int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing)
|
if (mParsing)
|
||||||
|
@ -610,7 +610,7 @@ PStatement CppParser::doFindStatementOf(const QString &fileName, const QStringLi
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
PStatement CppParser::findAliasedStatement(const PStatement &statement)
|
PStatement CppParser::findAliasedStatement(const PStatement &statement) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing)
|
if (mParsing)
|
||||||
|
@ -618,7 +618,7 @@ PStatement CppParser::findAliasedStatement(const PStatement &statement)
|
||||||
return doFindAliasedStatement(statement);
|
return doFindAliasedStatement(statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<PStatement> CppParser::listTypeStatements(const QString &fileName, int line)
|
QList<PStatement> CppParser::listTypeStatements(const QString &fileName, int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing)
|
if (mParsing)
|
||||||
|
@ -764,7 +764,7 @@ PStatement CppParser::findStatementStartingFrom(const QString &fileName, const Q
|
||||||
return PStatement();
|
return PStatement();
|
||||||
}
|
}
|
||||||
|
|
||||||
PStatement CppParser::findTypeDefinitionOf(const QString &fileName, const QString &aType, const PStatement& currentClass)
|
PStatement CppParser::findTypeDefinitionOf(const QString &fileName, const QString &aType, const PStatement& currentClass) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
|
|
||||||
|
@ -774,7 +774,7 @@ PStatement CppParser::findTypeDefinitionOf(const QString &fileName, const QStrin
|
||||||
return doFindTypeDefinitionOf(fileName,aType,currentClass);
|
return doFindTypeDefinitionOf(fileName,aType,currentClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
PStatement CppParser::findTypeDef(const PStatement &statement, const QString &fileName)
|
PStatement CppParser::findTypeDef(const PStatement &statement, const QString &fileName) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
|
|
||||||
|
@ -803,7 +803,7 @@ bool CppParser::freeze(const QString &serialId)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CppParser::getClassesList()
|
QStringList CppParser::getClassesList() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
|
|
||||||
|
@ -825,7 +825,7 @@ QStringList CppParser::getClassesList()
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CppParser::getFileDirectIncludes(const QString &filename)
|
QStringList CppParser::getFileDirectIncludes(const QString &filename) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing)
|
if (mParsing)
|
||||||
|
@ -858,13 +858,13 @@ QSet<QString> CppParser::internalGetIncludedFiles(const QString &filename) const
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<QString> CppParser::getIncludedFiles(const QString &filename)
|
QSet<QString> CppParser::getIncludedFiles(const QString &filename) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
return internalGetIncludedFiles(filename);
|
return internalGetIncludedFiles(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<QString> CppParser::getFileUsings(const QString &filename)
|
QSet<QString> CppParser::getFileUsings(const QString &filename) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
return internalGetFileUsings(filename);
|
return internalGetFileUsings(filename);
|
||||||
|
@ -894,7 +894,7 @@ QSet<QString> CppParser::internalGetFileUsings(const QString &filename) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppParser::getHeaderFileName(const QString &relativeTo, const QString &headerName, bool fromNext)
|
QString CppParser::getHeaderFileName(const QString &relativeTo, const QString &headerName, bool fromNext) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
QString currentDir = includeTrailingPathDelimiter(extractFileDir(relativeTo));
|
QString currentDir = includeTrailingPathDelimiter(extractFileDir(relativeTo));
|
||||||
|
@ -927,7 +927,7 @@ QString CppParser::getHeaderFileName(const QString &relativeTo, const QString &h
|
||||||
projectIncludes);
|
projectIncludes);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppParser::isLineVisible(const QString &fileName, int line)
|
bool CppParser::isLineVisible(const QString &fileName, int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing) {
|
if (mParsing) {
|
||||||
|
@ -955,7 +955,7 @@ void CppParser::invalidateFile(const QString &fileName)
|
||||||
mParsing = false;
|
mParsing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppParser::isIncludeLine(const QString &line)
|
bool CppParser::isIncludeLine(const QString &line) const
|
||||||
{
|
{
|
||||||
QString trimmedLine = line.trimmed();
|
QString trimmedLine = line.trimmed();
|
||||||
if ((trimmedLine.length() > 0)
|
if ((trimmedLine.length() > 0)
|
||||||
|
@ -966,7 +966,7 @@ bool CppParser::isIncludeLine(const QString &line)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppParser::isIncludeNextLine(const QString &line)
|
bool CppParser::isIncludeNextLine(const QString &line) const
|
||||||
{
|
{
|
||||||
QString trimmedLine = line.trimmed();
|
QString trimmedLine = line.trimmed();
|
||||||
if ((trimmedLine.length() > 0)
|
if ((trimmedLine.length() > 0)
|
||||||
|
@ -977,13 +977,13 @@ bool CppParser::isIncludeNextLine(const QString &line)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppParser::isProjectHeaderFile(const QString &fileName)
|
bool CppParser::isProjectHeaderFile(const QString &fileName) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
return ::isSystemHeaderFile(fileName,mPreprocessor.projectIncludePaths());
|
return ::isSystemHeaderFile(fileName,mPreprocessor.projectIncludePaths());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppParser::isSystemHeaderFile(const QString &fileName)
|
bool CppParser::isSystemHeaderFile(const QString &fileName) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
return ::isSystemHeaderFile(fileName,mPreprocessor.includePaths());
|
return ::isSystemHeaderFile(fileName,mPreprocessor.includePaths());
|
||||||
|
@ -1188,7 +1188,7 @@ void CppParser::unFreeze()
|
||||||
mLockCount--;
|
mLockCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppParser::fileScanned(const QString &fileName)
|
bool CppParser::fileScanned(const QString &fileName) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mParsing)
|
if (mParsing)
|
||||||
|
@ -1196,7 +1196,7 @@ bool CppParser::fileScanned(const QString &fileName)
|
||||||
return mPreprocessor.fileScanned(fileName);
|
return mPreprocessor.fileScanned(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppParser::isFileParsed(const QString &filename)
|
bool CppParser::isFileParsed(const QString &filename) const
|
||||||
{
|
{
|
||||||
return mPreprocessor.fileScanned(filename);
|
return mPreprocessor.fileScanned(filename);
|
||||||
}
|
}
|
||||||
|
@ -1214,7 +1214,7 @@ QString CppParser::getScopePrefix(const PStatement& statement) const{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppParser::prettyPrintStatement(const PStatement& statement, const QString& filename, int line)
|
QString CppParser::prettyPrintStatement(const PStatement& statement, const QString& filename, int line) const
|
||||||
{
|
{
|
||||||
QString result;
|
QString result;
|
||||||
switch(statement->kind) {
|
switch(statement->kind) {
|
||||||
|
|
|
@ -56,38 +56,38 @@ public:
|
||||||
void clearProjectFiles();
|
void clearProjectFiles();
|
||||||
QList<PStatement> getListOfFunctions(const QString& fileName,
|
QList<PStatement> getListOfFunctions(const QString& fileName,
|
||||||
const QString& phrase,
|
const QString& phrase,
|
||||||
int line);
|
int line) const;
|
||||||
PStatement findScopeStatement(const QString& filename, int line);
|
PStatement findScopeStatement(const QString& filename, int line) const;
|
||||||
PParsedFileInfo findFileInfo(const QString &filename);
|
PParsedFileInfo findFileInfo(const QString &filename) const;
|
||||||
QString findFirstTemplateParamOf(const QString& fileName,
|
QString findFirstTemplateParamOf(const QString& fileName,
|
||||||
const QString& phrase,
|
const QString& phrase,
|
||||||
const PStatement& currentScope);
|
const PStatement& currentScope) const;
|
||||||
QString findTemplateParamOf(const QString& fileName,
|
QString findTemplateParamOf(const QString& fileName,
|
||||||
const QString& phrase,
|
const QString& phrase,
|
||||||
int index,
|
int index,
|
||||||
const PStatement& currentScope);
|
const PStatement& currentScope) const;
|
||||||
PStatement findFunctionAt(const QString& fileName,
|
PStatement findFunctionAt(const QString& fileName,
|
||||||
int line);
|
int line) const;
|
||||||
int findLastOperator(const QString& phrase) const;
|
int findLastOperator(const QString& phrase) const;
|
||||||
PStatementList findNamespace(const QString& name); // return a list of PSTATEMENTS (of the namespace)
|
PStatementList findNamespace(const QString& name) const; // return a list of PSTATEMENTS (of the namespace)
|
||||||
PStatement findStatement(const QString& fullname);
|
PStatement findStatement(const QString& fullname) const;
|
||||||
PStatement findStatementOf(const QString& fileName,
|
PStatement findStatementOf(const QString& fileName,
|
||||||
const QString& phrase,
|
const QString& phrase,
|
||||||
int line);
|
int line) const;
|
||||||
PStatement findStatementOf(const QString& fileName,
|
PStatement findStatementOf(const QString& fileName,
|
||||||
const QString& phrase,
|
const QString& phrase,
|
||||||
const PStatement& currentScope,
|
const PStatement& currentScope,
|
||||||
PStatement& parentScopeType);
|
PStatement& parentScopeType) const;
|
||||||
|
|
||||||
PStatement findStatementOf(const QString& fileName,
|
PStatement findStatementOf(const QString& fileName,
|
||||||
const QStringList& expression,
|
const QStringList& expression,
|
||||||
const PStatement& currentScope);
|
const PStatement& currentScope) const;
|
||||||
PStatement findStatementOf(const QString& fileName,
|
PStatement findStatementOf(const QString& fileName,
|
||||||
const QStringList& expression,
|
const QStringList& expression,
|
||||||
int line);
|
int line) const;
|
||||||
PStatement findAliasedStatement(const PStatement& statement);
|
PStatement findAliasedStatement(const PStatement& statement) const;
|
||||||
|
|
||||||
QList<PStatement> listTypeStatements(const QString& fileName,int line);
|
QList<PStatement> listTypeStatements(const QString& fileName,int line) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief evaluate the expression
|
* @brief evaluate the expression
|
||||||
|
@ -98,27 +98,27 @@ public:
|
||||||
*/
|
*/
|
||||||
PEvalStatement evalExpression(const QString& fileName,
|
PEvalStatement evalExpression(const QString& fileName,
|
||||||
QStringList& expression,
|
QStringList& expression,
|
||||||
const PStatement& currentScope);
|
const PStatement& currentScope) const;
|
||||||
PStatement findTypeDefinitionOf(const QString& fileName,
|
PStatement findTypeDefinitionOf(const QString& fileName,
|
||||||
const QString& aType,
|
const QString& aType,
|
||||||
const PStatement& currentClass);
|
const PStatement& currentClass) const;
|
||||||
PStatement findTypeDef(const PStatement& statement,
|
PStatement findTypeDef(const PStatement& statement,
|
||||||
const QString& fileName);
|
const QString& fileName) const;
|
||||||
bool freeze(); // Freeze/Lock (stop reparse while searching)
|
bool freeze(); // Freeze/Lock (stop reparse while searching)
|
||||||
bool freeze(const QString& serialId); // Freeze/Lock (stop reparse while searching)
|
bool freeze(const QString& serialId); // Freeze/Lock (stop reparse while searching)
|
||||||
QStringList getClassesList();
|
QStringList getClassesList() const;
|
||||||
QStringList getFileDirectIncludes(const QString& filename);
|
QStringList getFileDirectIncludes(const QString& filename) const;
|
||||||
QSet<QString> getIncludedFiles(const QString& filename);
|
QSet<QString> getIncludedFiles(const QString& filename) const;
|
||||||
QSet<QString> getFileUsings(const QString& filename);
|
QSet<QString> getFileUsings(const QString& filename) const;
|
||||||
|
|
||||||
QString getHeaderFileName(const QString& relativeTo, const QString& headerName, bool fromNext=false);// both
|
QString getHeaderFileName(const QString& relativeTo, const QString& headerName, bool fromNext=false) const;
|
||||||
|
|
||||||
void invalidateFile(const QString& fileName);
|
void invalidateFile(const QString& fileName);
|
||||||
bool isLineVisible(const QString& fileName, int line);
|
bool isLineVisible(const QString& fileName, int line) const;
|
||||||
bool isIncludeLine(const QString &line);
|
bool isIncludeLine(const QString &line) const;
|
||||||
bool isIncludeNextLine(const QString &line);
|
bool isIncludeNextLine(const QString &line) const;
|
||||||
bool isProjectHeaderFile(const QString& fileName);
|
bool isProjectHeaderFile(const QString& fileName) const;
|
||||||
bool isSystemHeaderFile(const QString& fileName);
|
bool isSystemHeaderFile(const QString& fileName) const;
|
||||||
void parseFile(const QString& fileName, bool inProject,
|
void parseFile(const QString& fileName, bool inProject,
|
||||||
bool onlyIfNotParsed = false, bool updateView = true,
|
bool onlyIfNotParsed = false, bool updateView = true,
|
||||||
std::shared_ptr<CppParser> parserPtr = nullptr);
|
std::shared_ptr<CppParser> parserPtr = nullptr);
|
||||||
|
@ -127,11 +127,11 @@ public:
|
||||||
bool parsing() const;
|
bool parsing() const;
|
||||||
void resetParser();
|
void resetParser();
|
||||||
void unFreeze(); // UnFree/UnLock (reparse while searching)
|
void unFreeze(); // UnFree/UnLock (reparse while searching)
|
||||||
bool fileScanned(const QString& fileName);
|
bool fileScanned(const QString& fileName) const;
|
||||||
|
|
||||||
bool isFileParsed(const QString& filename);
|
bool isFileParsed(const QString& filename) const;
|
||||||
|
|
||||||
QString prettyPrintStatement(const PStatement& statement, const QString& filename, int line = -1);
|
QString prettyPrintStatement(const PStatement& statement, const QString& filename, int line = -1) const;
|
||||||
|
|
||||||
bool enabled() const;
|
bool enabled() const;
|
||||||
void setEnabled(bool newEnabled);
|
void setEnabled(bool newEnabled);
|
||||||
|
@ -742,7 +742,7 @@ private:
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
int mLastIndex;
|
int mLastIndex;
|
||||||
#endif
|
#endif
|
||||||
QRecursiveMutex mMutex;
|
mutable QRecursiveMutex mMutex;
|
||||||
QMap<QString,KeywordType> mCppKeywords;
|
QMap<QString,KeywordType> mCppKeywords;
|
||||||
QSet<QString> mCppTypeKeywords;
|
QSet<QString> mCppTypeKeywords;
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ public:
|
||||||
return mScannedFiles;
|
return mScannedFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QSet<QString> &projectIncludePaths() {
|
const QSet<QString> &projectIncludePaths() const {
|
||||||
return mProjectIncludePaths;
|
return mProjectIncludePaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -463,7 +463,7 @@ bool ClassBrowserModel::isScopeStatement(const PStatement &statement)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex ClassBrowserModel::modelIndexForStatement(const QString &key)
|
QModelIndex ClassBrowserModel::modelIndexForStatement(const QString &key) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mUpdating)
|
if (mUpdating)
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
ProjectClassBrowserType classBrowserType() const;
|
ProjectClassBrowserType classBrowserType() const;
|
||||||
void setClassBrowserType(ProjectClassBrowserType newClassBrowserType);
|
void setClassBrowserType(ProjectClassBrowserType newClassBrowserType);
|
||||||
|
|
||||||
QModelIndex modelIndexForStatement(const QString& key);
|
QModelIndex modelIndexForStatement(const QString& key) const;
|
||||||
signals:
|
signals:
|
||||||
void refreshStarted();
|
void refreshStarted();
|
||||||
void refreshEnd();
|
void refreshEnd();
|
||||||
|
@ -86,7 +86,7 @@ private:
|
||||||
PCppParser mParser;
|
PCppParser mParser;
|
||||||
bool mUpdating;
|
bool mUpdating;
|
||||||
int mUpdateCount;
|
int mUpdateCount;
|
||||||
QRecursiveMutex mMutex;
|
mutable QRecursiveMutex mMutex;
|
||||||
QString mCurrentFile;
|
QString mCurrentFile;
|
||||||
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
||||||
ProjectClassBrowserType mClassBrowserType;
|
ProjectClassBrowserType mClassBrowserType;
|
||||||
|
|
|
@ -183,7 +183,7 @@ private:
|
||||||
QSet<QString> mAddedStatements;
|
QSet<QString> mAddedStatements;
|
||||||
QString mMemberPhrase;
|
QString mMemberPhrase;
|
||||||
QString mMemberOperator;
|
QString mMemberOperator;
|
||||||
QRecursiveMutex mMutex;
|
mutable QRecursiveMutex mMutex;
|
||||||
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
||||||
CodeCompletionListItemDelegate* mDelegate;
|
CodeCompletionListItemDelegate* mDelegate;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ static void listIndexOutOfBounds(int index) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Document::parenthesisLevel(int line)
|
int Document::parenthesisLevel(int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line>=0 && line < mLines.size()) {
|
if (line>=0 && line < mLines.size()) {
|
||||||
|
@ -63,7 +63,7 @@ int Document::parenthesisLevel(int line)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::bracketLevel(int line)
|
int Document::bracketLevel(int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line>=0 && line < mLines.size()) {
|
if (line>=0 && line < mLines.size()) {
|
||||||
|
@ -72,7 +72,7 @@ int Document::bracketLevel(int line)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::braceLevel(int line)
|
int Document::braceLevel(int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line>=0 && line < mLines.size()) {
|
if (line>=0 && line < mLines.size()) {
|
||||||
|
@ -81,7 +81,7 @@ int Document::braceLevel(int line)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::lineWidth(int line)
|
int Document::lineWidth(int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line>=0 && line < mLines.size()) {
|
if (line>=0 && line < mLines.size()) {
|
||||||
|
@ -92,7 +92,7 @@ int Document::lineWidth(int line)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::lineWidth(int line, const QString &newText)
|
int Document::lineWidth(int line, const QString &newText) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line >= mLines.size())
|
if (line<0 || line >= mLines.size())
|
||||||
|
@ -105,7 +105,7 @@ int Document::lineWidth(int line, const QString &newText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::blockLevel(int line)
|
int Document::blockLevel(int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line>=0 && line < mLines.size()) {
|
if (line>=0 && line < mLines.size()) {
|
||||||
|
@ -114,7 +114,7 @@ int Document::blockLevel(int line)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::blockStarted(int line)
|
int Document::blockStarted(int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line>=0 && line < mLines.size()) {
|
if (line>=0 && line < mLines.size()) {
|
||||||
|
@ -123,7 +123,7 @@ int Document::blockStarted(int line)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::blockEnded(int line)
|
int Document::blockEnded(int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line>=0 && line < mLines.size()) {
|
if (line>=0 && line < mLines.size()) {
|
||||||
|
@ -135,7 +135,7 @@ int Document::blockEnded(int line)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::maxLineWidth() {
|
int Document::maxLineWidth() const {
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (mIndexOfLongestLine >= 0) {
|
if (mIndexOfLongestLine >= 0) {
|
||||||
return mLines[mIndexOfLongestLine]->width();
|
return mLines[mIndexOfLongestLine]->width();
|
||||||
|
@ -158,7 +158,7 @@ QString Document::lineBreak() const
|
||||||
return "\n";
|
return "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
SyntaxState Document::getSyntaxState(int line)
|
SyntaxState Document::getSyntaxState(int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line>=0 && line < mLines.size()) {
|
if (line>=0 && line < mLines.size()) {
|
||||||
|
@ -189,7 +189,7 @@ void Document::addItem(const QString &s)
|
||||||
endUpdate();
|
endUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Document::getAppendNewLineAtEOF()
|
bool Document::getAppendNewLineAtEOF() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
return mAppendNewLineAtEOF;
|
return mAppendNewLineAtEOF;
|
||||||
|
@ -210,7 +210,7 @@ void Document::setSyntaxState(int line, const SyntaxState& state)
|
||||||
mLines[line]->setSyntaxState(state);
|
mLines[line]->setSyntaxState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Document::getLine(int line)
|
QString Document::getLine(int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=mLines.count()) {
|
if (line<0 || line>=mLines.count()) {
|
||||||
|
@ -219,7 +219,7 @@ QString Document::getLine(int line)
|
||||||
return mLines[line]->lineText();
|
return mLines[line]->lineText();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::getLineGlyphsCount(int line)
|
int Document::getLineGlyphsCount(int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=mLines.count()) {
|
if (line<0 || line>=mLines.count()) {
|
||||||
|
@ -237,13 +237,13 @@ int Document::getLineGlyphsCount(int line)
|
||||||
// return mLines[index]->glyphStartCharList();
|
// return mLines[index]->glyphStartCharList();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
int Document::count()
|
int Document::count() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
return mLines.count();
|
return mLines.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Document::text()
|
QString Document::text() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
return getTextStr();
|
return getTextStr();
|
||||||
|
@ -274,7 +274,7 @@ void Document::setContents(const QStringList &text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Document::contents()
|
QStringList Document::contents() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
QStringList result;
|
QStringList result;
|
||||||
|
@ -332,7 +332,7 @@ void Document::addLines(const QStringList &strings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::getTextLength()
|
int Document::getTextLength() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
int Result = 0;
|
int Result = 0;
|
||||||
|
@ -790,13 +790,13 @@ void Document::saveToFile(QFile &file, const QByteArray& encoding,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Document::glyph(int line, int glyphIdx)
|
QString Document::glyph(int line, int glyphIdx) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
return mLines[line]->glyph(glyphIdx);
|
return mLines[line]->glyph(glyphIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Document::glyphAt(int line, int charPos)
|
QString Document::glyphAt(int line, int charPos) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=count())
|
if (line<0 || line>=count())
|
||||||
|
@ -806,7 +806,7 @@ QString Document::glyphAt(int line, int charPos)
|
||||||
return mLines[line]->glyph(glyphIdx);
|
return mLines[line]->glyph(glyphIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::charToGlyphStartChar(int line, int charPos)
|
int Document::charToGlyphStartChar(int line, int charPos) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=count())
|
if (line<0 || line>=count())
|
||||||
|
@ -889,7 +889,7 @@ int GlyphCalculator::stringWidth(const QString &str, int left, const QFontMetric
|
||||||
return right - left;
|
return right - left;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::glyphCount(int line)
|
int Document::glyphCount(int line) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=count())
|
if (line<0 || line>=count())
|
||||||
|
@ -897,7 +897,7 @@ int Document::glyphCount(int line)
|
||||||
return mLines[line]->glyphsCount();
|
return mLines[line]->glyphsCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::glyphStartChar(int line, int glyphIdx)
|
int Document::glyphStartChar(int line, int glyphIdx) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=count())
|
if (line<0 || line>=count())
|
||||||
|
@ -905,7 +905,7 @@ int Document::glyphStartChar(int line, int glyphIdx)
|
||||||
return mLines[line]->glyphStartChar(glyphIdx);
|
return mLines[line]->glyphStartChar(glyphIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::glyphLength(int line, int glyphIdx)
|
int Document::glyphLength(int line, int glyphIdx) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=count())
|
if (line<0 || line>=count())
|
||||||
|
@ -913,7 +913,7 @@ int Document::glyphLength(int line, int glyphIdx)
|
||||||
return mLines[line]->glyphLength(glyphIdx);
|
return mLines[line]->glyphLength(glyphIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::glyphStartPostion(int line, int glyphIdx)
|
int Document::glyphStartPostion(int line, int glyphIdx) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=count())
|
if (line<0 || line>=count())
|
||||||
|
@ -921,7 +921,7 @@ int Document::glyphStartPostion(int line, int glyphIdx)
|
||||||
return mLines[line]->glyphStartPosition(glyphIdx);
|
return mLines[line]->glyphStartPosition(glyphIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::glyphWidth(int line, int glyphIdx)
|
int Document::glyphWidth(int line, int glyphIdx) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=count())
|
if (line<0 || line>=count())
|
||||||
|
@ -929,7 +929,7 @@ int Document::glyphWidth(int line, int glyphIdx)
|
||||||
return mLines[line]->glyphWidth(glyphIdx);
|
return mLines[line]->glyphWidth(glyphIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::charToGlyphIndex(int line, int charIdx)
|
int Document::charToGlyphIndex(int line, int charIdx) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=count())
|
if (line<0 || line>=count())
|
||||||
|
@ -974,7 +974,7 @@ QList<int> GlyphCalculator::calcGlyphPositionList(const QString &lineText, const
|
||||||
return glyphPostionList;
|
return glyphPostionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::xposToGlyphIndex(int line, int xpos)
|
int Document::xposToGlyphIndex(int line, int xpos) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=count())
|
if (line<0 || line>=count())
|
||||||
|
@ -996,7 +996,7 @@ int Document::xposToGlyphIndex(int strWidth, QList<int> glyphPositionList, int x
|
||||||
// return glyphPositionList.length()-1;
|
// return glyphPositionList.length()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::charToGlyphStartPosition(int line, int charPos)
|
int Document::charToGlyphStartPosition(int line, int charPos) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=count())
|
if (line<0 || line>=count())
|
||||||
|
@ -1006,7 +1006,7 @@ int Document::charToGlyphStartPosition(int line, int charPos)
|
||||||
return mLines[line]->glyphStartPosition(glyphIdx);
|
return mLines[line]->glyphStartPosition(glyphIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::xposToGlyphStartChar(int line, int xpos)
|
int Document::xposToGlyphStartChar(int line, int xpos) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=count())
|
if (line<0 || line>=count())
|
||||||
|
@ -1016,7 +1016,7 @@ int Document::xposToGlyphStartChar(int line, int xpos)
|
||||||
return mLines[line]->glyphStartChar(glyphIdx);
|
return mLines[line]->glyphStartChar(glyphIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::charToGlyphStartPosition(int line, const QString newStr, int charPos)
|
int Document::charToGlyphStartPosition(int line, const QString newStr, int charPos) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line>=0 && line<count() && mLines[line]->lineText() == newStr) {
|
if (line>=0 && line<count() && mLines[line]->lineText() == newStr) {
|
||||||
|
@ -1033,7 +1033,7 @@ int Document::charToGlyphStartPosition(int line, const QString newStr, int charP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Document::xposToGlyphStartChar(int line, const QString newStr, int xpos)
|
int Document::xposToGlyphStartChar(int line, const QString newStr, int xpos) const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (line<0 || line>=count())
|
if (line<0 || line>=count())
|
||||||
|
@ -1233,7 +1233,7 @@ int Document::getLineWidth(int line)
|
||||||
return mLines[line]->mWidth;
|
return mLines[line]->mWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewlineType Document::getNewlineType()
|
NewlineType Document::getNewlineType() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
return mNewlineType;
|
return mNewlineType;
|
||||||
|
@ -1245,7 +1245,7 @@ void Document::setNewlineType(const NewlineType &fileEndingType)
|
||||||
mNewlineType = fileEndingType;
|
mNewlineType = fileEndingType;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Document::empty()
|
bool Document::empty() const
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
return mLines.count()==0;
|
return mLines.count()==0;
|
||||||
|
|
|
@ -295,7 +295,7 @@ public:
|
||||||
* @param line line index (starts from 0)
|
* @param line line index (starts from 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int parenthesisLevel(int line);
|
int parenthesisLevel(int line) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get nesting level of brackets at the end of the specified line
|
* @brief get nesting level of brackets at the end of the specified line
|
||||||
|
@ -305,7 +305,7 @@ public:
|
||||||
* @param line line index (starts from 0)
|
* @param line line index (starts from 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int bracketLevel(int line);
|
int bracketLevel(int line) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get nesting level of braces at the end of the specified line
|
* @brief get nesting level of braces at the end of the specified line
|
||||||
|
@ -315,7 +315,7 @@ public:
|
||||||
* @param line line index (starts from 0)
|
* @param line line index (starts from 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int braceLevel(int line);
|
int braceLevel(int line) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get width of the specified line
|
* @brief get width of the specified line
|
||||||
|
@ -325,7 +325,7 @@ public:
|
||||||
* @param line line index (starts frome 0)
|
* @param line line index (starts frome 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int lineWidth(int line);
|
int lineWidth(int line) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get width of the specified text / line
|
* @brief get width of the specified text / line
|
||||||
|
@ -340,7 +340,7 @@ public:
|
||||||
* @param newText the new text
|
* @param newText the new text
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int lineWidth(int line, const QString &newText);
|
int lineWidth(int line, const QString &newText) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get block (indent) level of the specified line
|
* @brief get block (indent) level of the specified line
|
||||||
|
@ -350,21 +350,21 @@ public:
|
||||||
* @param line line index (starts frome 0)
|
* @param line line index (starts frome 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int blockLevel(int line);
|
int blockLevel(int line) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get count of new blocks (indent) started on the specified line
|
* @brief get count of new blocks (indent) started on the specified line
|
||||||
* @param line line index (starts frome 0)
|
* @param line line index (starts frome 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int blockStarted(int line);
|
int blockStarted(int line) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get count of blocks (indent) ended on the specified line
|
* @brief get count of blocks (indent) ended on the specified line
|
||||||
* @param line line index (starts frome 0)
|
* @param line line index (starts frome 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int blockEnded(int line);
|
int blockEnded(int line) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get index of the longest line (has the max width)
|
* @brief get index of the longest line (has the max width)
|
||||||
|
@ -373,7 +373,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int maxLineWidth();
|
int maxLineWidth() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get line break of the current document
|
* @brief get line break of the current document
|
||||||
|
@ -390,7 +390,7 @@ public:
|
||||||
* @param line line index (starts frome 0)
|
* @param line line index (starts frome 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
SyntaxState getSyntaxState(int line);
|
SyntaxState getSyntaxState(int line) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief set state of the syntax highlighter after parsing the specified line.
|
* @brief set state of the syntax highlighter after parsing the specified line.
|
||||||
|
@ -410,7 +410,7 @@ public:
|
||||||
* @param line line index (starts frome 0)
|
* @param line line index (starts frome 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
QString getLine(int line);
|
QString getLine(int line) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get count of the glyphs on the specified line.
|
* @brief get count of the glyphs on the specified line.
|
||||||
|
@ -420,7 +420,7 @@ public:
|
||||||
* @param line line index (starts frome 0)
|
* @param line line index (starts frome 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int getLineGlyphsCount(int line);
|
int getLineGlyphsCount(int line) const;
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * @brief get position list of the glyphs on the specified line.
|
// * @brief get position list of the glyphs on the specified line.
|
||||||
|
@ -440,7 +440,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int count();
|
int count() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get all the text in the document.
|
* @brief get all the text in the document.
|
||||||
|
@ -450,7 +450,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
QString text();
|
QString text() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief set the text of the document
|
* @brief set the text of the document
|
||||||
|
@ -478,7 +478,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
QStringList contents();
|
QStringList contents() const;
|
||||||
|
|
||||||
void putLine(int index, const QString& s, bool notify=true);
|
void putLine(int index, const QString& s, bool notify=true);
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ public:
|
||||||
int addLine(const QString& s);
|
int addLine(const QString& s);
|
||||||
void addLines(const QStringList& strings);
|
void addLines(const QStringList& strings);
|
||||||
|
|
||||||
int getTextLength();
|
int getTextLength() const;
|
||||||
void clear();
|
void clear();
|
||||||
void deleteAt(int index);
|
void deleteAt(int index);
|
||||||
void deleteLines(int index, int numLines);
|
void deleteLines(int index, int numLines);
|
||||||
|
@ -500,17 +500,17 @@ public:
|
||||||
void saveToFile(QFile& file, const QByteArray& encoding,
|
void saveToFile(QFile& file, const QByteArray& encoding,
|
||||||
const QByteArray& defaultEncoding, QByteArray& realEncoding);
|
const QByteArray& defaultEncoding, QByteArray& realEncoding);
|
||||||
|
|
||||||
QString glyph(int line, int glyphIdx);
|
QString glyph(int line, int glyphIdx) const;
|
||||||
QString glyphAt(int line, int charPos);
|
QString glyphAt(int line, int charPos) const;
|
||||||
|
|
||||||
int stringWidth(const QString &str, int left) const {
|
int stringWidth(const QString &str, int left) const {
|
||||||
return mGlyphCalculator.stringWidth(str, left);
|
return mGlyphCalculator.stringWidth(str, left);
|
||||||
}
|
}
|
||||||
|
|
||||||
int charToGlyphStartChar(int line, int charPos);
|
int charToGlyphStartChar(int line, int charPos) const;
|
||||||
//int columnToGlyphStartColumn(int line, int charPos);
|
//int columnToGlyphStartColumn(int line, int charPos);
|
||||||
|
|
||||||
int glyphCount(int line);
|
int glyphCount(int line) const;
|
||||||
/**
|
/**
|
||||||
* @brief get start index of the chars representing the specified glyph in the specified line.
|
* @brief get start index of the chars representing the specified glyph in the specified line.
|
||||||
*
|
*
|
||||||
|
@ -520,7 +520,7 @@ public:
|
||||||
* @param glyphIdx index of the glyph in the line (starting from 0)
|
* @param glyphIdx index of the glyph in the line (starting from 0)
|
||||||
* @return char index in the line text (start from 0)
|
* @return char index in the line text (start from 0)
|
||||||
*/
|
*/
|
||||||
int glyphStartChar(int line, int glyphIdx);
|
int glyphStartChar(int line, int glyphIdx) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get count of the chars representing the specified glyph in the specified line.
|
* @brief get count of the chars representing the specified glyph in the specified line.
|
||||||
|
@ -531,7 +531,7 @@ public:
|
||||||
* @param glyphIdx index of the glyph in the line (starting from 0)
|
* @param glyphIdx index of the glyph in the line (starting from 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int glyphLength(int line, int glyphIdx);
|
int glyphLength(int line, int glyphIdx) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get start column of the specified glyph in the specified line.
|
* @brief get start column of the specified glyph in the specified line.
|
||||||
|
@ -542,7 +542,7 @@ public:
|
||||||
* @param glyphIdx index of the glyph in the line (starting from 0)
|
* @param glyphIdx index of the glyph in the line (starting from 0)
|
||||||
* @return the column (starting from 1)
|
* @return the column (starting from 1)
|
||||||
*/
|
*/
|
||||||
int glyphStartPostion(int line, int glyphIdx);
|
int glyphStartPostion(int line, int glyphIdx) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get width (in columns) of the specified glyph in the specified line.
|
* @brief get width (in columns) of the specified glyph in the specified line.
|
||||||
|
@ -553,7 +553,7 @@ public:
|
||||||
* @param glyphIdx index of the glyph in the line (starting from 0)
|
* @param glyphIdx index of the glyph in the line (starting from 0)
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int glyphWidth(int line, int glyphIdx);
|
int glyphWidth(int line, int glyphIdx) const;
|
||||||
|
|
||||||
int glyphWidth(const QString &glyph, int left) const {
|
int glyphWidth(const QString &glyph, int left) const {
|
||||||
return mGlyphCalculator.glyphWidth(glyph,left);
|
return mGlyphCalculator.glyphWidth(glyph,left);
|
||||||
|
@ -568,7 +568,7 @@ public:
|
||||||
* @param charIdx position of the char in the line text (starting from 0)
|
* @param charIdx position of the char in the line text (starting from 0)
|
||||||
* @return glyph index in the line (starting from 0)
|
* @return glyph index in the line (starting from 0)
|
||||||
*/
|
*/
|
||||||
int charToGlyphIndex(int line, int charPos);
|
int charToGlyphIndex(int line, int charPos) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get index of the glyph displayed on the specified column
|
* @brief get index of the glyph displayed on the specified column
|
||||||
|
@ -579,20 +579,20 @@ public:
|
||||||
* @param column the column (starting from 1)
|
* @param column the column (starting from 1)
|
||||||
* @return glyph index in the line (starting from 0)
|
* @return glyph index in the line (starting from 0)
|
||||||
*/
|
*/
|
||||||
int xposToGlyphIndex(int line, int xpos);
|
int xposToGlyphIndex(int line, int xpos) const;
|
||||||
|
|
||||||
int charToGlyphStartPosition(int line, int charPos);
|
int charToGlyphStartPosition(int line, int charPos) const;
|
||||||
int xposToGlyphStartChar(int line, int xpos);
|
int xposToGlyphStartChar(int line, int xpos) const;
|
||||||
int charToGlyphStartPosition(int line, const QString newStr, int charPos);
|
int charToGlyphStartPosition(int line, const QString newStr, int charPos) const;
|
||||||
int xposToGlyphStartChar(int line, const QString newStr, int xpos);
|
int xposToGlyphStartChar(int line, const QString newStr, int xpos) const;
|
||||||
|
|
||||||
bool getAppendNewLineAtEOF();
|
bool getAppendNewLineAtEOF() const;
|
||||||
void setAppendNewLineAtEOF(bool appendNewLineAtEOF);
|
void setAppendNewLineAtEOF(bool appendNewLineAtEOF);
|
||||||
|
|
||||||
NewlineType getNewlineType();
|
NewlineType getNewlineType() const;
|
||||||
void setNewlineType(const NewlineType &fileEndingType);
|
void setNewlineType(const NewlineType &fileEndingType);
|
||||||
|
|
||||||
bool empty();
|
bool empty() const;
|
||||||
|
|
||||||
int tabSize() const { return mGlyphCalculator.tabSize(); }
|
int tabSize() const { return mGlyphCalculator.tabSize(); }
|
||||||
|
|
||||||
|
@ -662,7 +662,7 @@ private:
|
||||||
|
|
||||||
int mSetLineWidthLockCount;
|
int mSetLineWidthLockCount;
|
||||||
bool mMaxLineChangedInSetLinesWidth;
|
bool mMaxLineChangedInSetLinesWidth;
|
||||||
QRecursiveMutex mMutex;
|
mutable QRecursiveMutex mMutex;
|
||||||
|
|
||||||
GlyphCalculator mGlyphCalculator;
|
GlyphCalculator mGlyphCalculator;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue