Commit d400959d authored by Tobias Hunger's avatar Tobias Hunger

CMakeCbpParser: Small cleanups

* Do follow-up fixes to CMakeTool

Change-Id: Ia3c587acb85d613499e91988200d8bbae32eca3d
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent e8683571
......@@ -151,7 +151,7 @@ void CMakeCbpParser::sortFiles()
qCDebug(log) << target.title << target.sourceDirectory << target.includeFiles << target.defines << target.files << "\n";
}
bool CMakeCbpParser::parseCbpFile(Kit *kit, const QString &fileName, const QString &sourceDirectory)
bool CMakeCbpParser::parseCbpFile(const Kit *const kit, const QString &fileName, const QString &sourceDirectory)
{
m_kit = kit;
m_buildDirectory = QFileInfo(fileName).absolutePath();
......@@ -437,14 +437,14 @@ void CMakeCbpParser::parseUnit()
fileName = FileName::fromUserInput(mappedFile);
}
m_parsingCmakeUnit = false;
m_parsingCMakeUnit = false;
m_unitTarget.clear();
while (!atEnd()) {
readNext();
if (isEndElement()) {
if (!fileName.endsWith(QLatin1String(".rule")) && !m_processedUnits.contains(fileName)) {
// Now check whether we found a virtual element beneath
if (m_parsingCmakeUnit) {
if (m_parsingCMakeUnit) {
m_cmakeFileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ProjectFileType, false));
} else {
bool generated = false;
......@@ -475,7 +475,7 @@ void CMakeCbpParser::parseUnit()
void CMakeCbpParser::parseUnitOption()
{
const QXmlStreamAttributes optionAttributes = attributes();
m_parsingCmakeUnit = optionAttributes.hasAttribute(QLatin1String("virtualFolder"));
m_parsingCMakeUnit = optionAttributes.hasAttribute(QLatin1String("virtualFolder"));
m_unitTarget = optionAttributes.value(QLatin1String("target")).toString();
while (!atEnd()) {
......
......@@ -27,13 +27,18 @@
#include "cmakeproject.h"
#include <QXmlStreamReader>
#include <utils/fileutils.h>
#include <QList>
#include <QMap>
#include <QSet>
#include <QString>
#include <QXmlStreamReader>
namespace ProjectExplorer {
class FileNode;
class Kit;
}
} // namespace ProjectExplorer
namespace CMakeProjectManager {
namespace Internal {
......@@ -41,7 +46,8 @@ namespace Internal {
class CMakeCbpParser : public QXmlStreamReader
{
public:
bool parseCbpFile(ProjectExplorer::Kit *kit, const QString &fileName, const QString &sourceDirectory);
bool parseCbpFile(const ProjectExplorer::Kit *const kit, const QString &fileName,
const QString &sourceDirectory);
QList<ProjectExplorer::FileNode *> fileList();
QList<ProjectExplorer::FileNode *> cmakeFileList();
QList<CMakeBuildTarget> buildTargets();
......@@ -67,11 +73,11 @@ private:
void sortFiles();
QMap<Utils::FileName, QString> m_unitTargetMap;
ProjectExplorer::Kit *m_kit = 0;
const ProjectExplorer::Kit *m_kit = 0;
QList<ProjectExplorer::FileNode *> m_fileList;
QList<ProjectExplorer::FileNode *> m_cmakeFileList;
QSet<Utils::FileName> m_processedUnits;
bool m_parsingCmakeUnit;
bool m_parsingCMakeUnit;
CMakeBuildTarget m_buildTarget;
QList<CMakeBuildTarget> m_buildTargets;
......
......@@ -37,7 +37,7 @@
#include <QUuid>
#include <QVariantMap>
using namespace CMakeProjectManager;
namespace CMakeProjectManager {
const char CMAKE_INFORMATION_ID[] = "Id";
const char CMAKE_INFORMATION_COMMAND[] = "Binary";
......@@ -223,7 +223,7 @@ void CMakeTool::setPathMapper(const CMakeTool::PathMapper &pathMapper)
m_pathMapper = pathMapper;
}
QString CMakeTool::mapAllPaths(ProjectExplorer::Kit *kit, const QString &in) const
QString CMakeTool::mapAllPaths(const ProjectExplorer::Kit *kit, const QString &in) const
{
if (m_pathMapper)
return m_pathMapper(kit, in);
......@@ -318,3 +318,5 @@ QStringList CMakeTool::parseVariableOutput(const QString &output)
}
return result;
}
} // namespace CMakeProjectManager
......@@ -52,7 +52,7 @@ public:
AutoDetection
};
typedef std::function<QString (ProjectExplorer::Kit *, const QString &)> PathMapper;
typedef std::function<QString (const ProjectExplorer::Kit *, const QString &)> PathMapper;
explicit CMakeTool(Detection d, const Core::Id &id);
explicit CMakeTool(const QVariantMap &map, bool fromSdk);
......@@ -78,7 +78,7 @@ public:
void setDisplayName(const QString &displayName);
void setPathMapper(const PathMapper &includePathMapper);
QString mapAllPaths(ProjectExplorer::Kit *kit, const QString &in) const;
QString mapAllPaths(const ProjectExplorer::Kit *kit, const QString &in) const;
private:
Utils::SynchronousProcessResponse run(const QString &arg) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment