forked from qt-creator/qt-creator
CppTools: De-duplicate and rename function in ProjectPart
Change-Id: I675ce4c9059d8ae4046f6a13aa7c04b88141d443 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -54,7 +54,7 @@ void RawProjectPart::setFiles(const QStringList &files, FileClassifier fileClass
|
||||
this->fileClassifier = fileClassifier;
|
||||
}
|
||||
|
||||
void RawProjectPart::setProjectFile(const QString &projectFile, int line, int column)
|
||||
void RawProjectPart::setProjectFileLocation(const QString &projectFile, int line, int column)
|
||||
{
|
||||
this->projectFile = projectFile;
|
||||
projectFileLine = line;
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
using FileClassifier = std::function<ProjectFile::Kind (const QString &filePath)>;
|
||||
void setFiles(const QStringList &files, FileClassifier fileClassifier = FileClassifier());
|
||||
|
||||
void setProjectFile(const QString &projectFile, int line = -1, int column = -1);
|
||||
void setProjectFileLocation(const QString &projectFile, int line = -1, int column = -1);
|
||||
void setConfigFileName(const QString &configFileName);
|
||||
void setCallGroupId(const QString &id);
|
||||
|
||||
|
||||
@@ -63,16 +63,22 @@ ProjectPart::Ptr ProjectPart::copy() const
|
||||
|
||||
QString ProjectPart::id() const
|
||||
{
|
||||
QString projectPartId = QDir::fromNativeSeparators(projectFile);
|
||||
if (projectFileLine > 0)
|
||||
projectPartId += ":" + QString::number(projectFileLine);
|
||||
if (projectFileColumn > 0)
|
||||
projectPartId += ":" + QString::number(projectFileColumn);
|
||||
QString projectPartId = projectFileLocation();
|
||||
if (!displayName.isEmpty())
|
||||
projectPartId.append(QLatin1Char(' ') + displayName);
|
||||
return projectPartId;
|
||||
}
|
||||
|
||||
QString ProjectPart::projectFileLocation() const
|
||||
{
|
||||
QString location = QDir::fromNativeSeparators(projectFile);
|
||||
if (projectFileLine > 0)
|
||||
location += ":" + QString::number(projectFileLine);
|
||||
if (projectFileColumn > 0)
|
||||
location += ":" + QString::number(projectFileColumn);
|
||||
return location;
|
||||
}
|
||||
|
||||
QByteArray ProjectPart::readProjectConfigFile(const Ptr &projectPart)
|
||||
{
|
||||
QByteArray result;
|
||||
|
||||
@@ -93,6 +93,7 @@ public:
|
||||
|
||||
public:
|
||||
QString id() const;
|
||||
QString projectFileLocation() const;
|
||||
|
||||
Ptr copy() const;
|
||||
void updateLanguageFeatures();
|
||||
|
||||
Reference in New Issue
Block a user