2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2008-12-02 12:57:59 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-05-02 15:29:11 +02:00
|
|
|
#include "qmake_global.h"
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QStringList>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2008-12-02 12:57:59 +01:00
|
|
|
QT_BEGIN_NAMESPACE
|
2010-01-14 22:58:55 +01:00
|
|
|
class QDir;
|
2008-12-02 12:57:59 +01:00
|
|
|
class ProFile;
|
|
|
|
|
QT_END_NAMESPACE
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
namespace QmakeProjectManager {
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2012-05-02 15:29:11 +02:00
|
|
|
class QMAKE_EXPORT ProWriter
|
2008-12-02 12:57:59 +01:00
|
|
|
{
|
2008-12-02 12:01:29 +01:00
|
|
|
public:
|
2011-03-02 16:10:29 +01:00
|
|
|
enum PutFlag {
|
|
|
|
|
AppendValues = 0,
|
|
|
|
|
ReplaceValues = 1,
|
|
|
|
|
OneLine = 0, // this works only when replacing (or adding a new assignment)
|
|
|
|
|
MultiLine = 2,
|
|
|
|
|
AssignOperator = 0, // ignored when changing an existing assignment
|
|
|
|
|
AppendOperator = 4
|
|
|
|
|
};
|
|
|
|
|
Q_DECLARE_FLAGS(PutFlags, PutFlag)
|
|
|
|
|
|
|
|
|
|
static void putVarValues(ProFile *profile, QStringList *lines,
|
2011-03-07 21:23:51 +01:00
|
|
|
const QStringList &values, const QString &var, PutFlags flags,
|
2019-02-01 16:50:29 +01:00
|
|
|
const QString &scope, const QString &continuationIndent);
|
2019-10-29 17:11:00 +01:00
|
|
|
|
|
|
|
|
using VarLocation = QPair<QString, int>;
|
|
|
|
|
using VarLocations = QList<VarLocation>;
|
|
|
|
|
static QList<int> removeVarValues(
|
|
|
|
|
ProFile *profile,
|
|
|
|
|
QStringList *lines,
|
|
|
|
|
const QStringList &values,
|
|
|
|
|
const QStringList &vars,
|
|
|
|
|
VarLocations *removedLocations = nullptr
|
|
|
|
|
);
|
2010-06-07 14:56:20 +02:00
|
|
|
|
2019-02-01 16:50:29 +01:00
|
|
|
static void addFiles(ProFile *profile, QStringList *lines, const QStringList &filePaths,
|
|
|
|
|
const QString &var, const QString &continuationIndent);
|
2019-10-29 17:11:00 +01:00
|
|
|
static QStringList removeFiles(
|
|
|
|
|
ProFile *profile,
|
|
|
|
|
QStringList *lines,
|
|
|
|
|
const QDir &proFileDir,
|
|
|
|
|
const QStringList &filePaths,
|
|
|
|
|
const QStringList &vars,
|
|
|
|
|
VarLocations *removedLocations = nullptr);
|
2011-03-02 16:10:29 +01:00
|
|
|
|
|
|
|
|
private:
|
2022-11-30 16:39:21 +01:00
|
|
|
static bool locateVarValues(const QString &device, const ushort *tokPtr, const ushort *tokPtrEnd,
|
2014-03-07 12:56:59 +01:00
|
|
|
const QString &scope, const QString &var, int *scopeStart, int *bestLine);
|
2022-11-30 16:39:21 +01:00
|
|
|
static QString compileScope(const QString &device, const QString &scope);
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2008-12-02 12:57:59 +01:00
|
|
|
} // namespace Internal
|
2013-10-29 18:34:35 +01:00
|
|
|
} // namespace QmakeProjectManager
|
2019-05-15 08:57:53 +03:00
|
|
|
|
|
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(QmakeProjectManager::Internal::ProWriter::PutFlags)
|