Utils: Remove Utils::optional

Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.

Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Eike Ziller
2022-08-26 10:30:00 +02:00
parent 34a9491a08
commit 04e50438eb
247 changed files with 1053 additions and 3751 deletions

View File

@@ -1188,7 +1188,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
const auto buildDirAspect = aspect<BuildDirectoryAspect>();
buildDirAspect->setValueAcceptor(
[](const QString &oldDir, const QString &newDir) -> Utils::optional<QString> {
[](const QString &oldDir, const QString &newDir) -> std::optional<QString> {
if (oldDir.isEmpty())
return newDir;
@@ -1204,7 +1204,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
== QMessageBox::Ok) {
return newDir;
}
return Utils::nullopt;
return std::nullopt;
}
return newDir;
});

View File

@@ -166,7 +166,7 @@ QString CMakeConfigItem::typeToTypeString(const CMakeConfigItem::Type t)
return {};
}
Utils::optional<bool> CMakeConfigItem::toBool(const QString &value)
std::optional<bool> CMakeConfigItem::toBool(const QString &value)
{
// Taken from CMakes if(<constant>) documentation:
// "Named boolean constants are case-insensitive."

View File

@@ -5,11 +5,12 @@
#include "cmake_global.h"
#include <utils/optional.h>
#include <QByteArray>
#include <QStringList>
#include <optional>
namespace Utils {
class FilePath;
class MacroExpander;
@@ -33,7 +34,7 @@ public:
static QStringList cmakeSplitValue(const QString &in, bool keepEmpty = false);
static Type typeStringToType(const QByteArray &typeString);
static QString typeToTypeString(const Type t);
static Utils::optional<bool> toBool(const QString &value);
static std::optional<bool> toBool(const QString &value);
bool isNull() const { return key.isEmpty(); }
QString expandedValue(const ProjectExplorer::Kit *k) const;

View File

@@ -8,11 +8,11 @@
#include <projectexplorer/ioutputparser.h>
#include <projectexplorer/task.h>
#include <utils/optional.h>
#include <QDir>
#include <QRegularExpression>
#include <optional>
namespace CMakeProjectManager {
class CMAKE_EXPORT CMakeParser : public ProjectExplorer::OutputTaskParser
@@ -31,7 +31,7 @@ private:
TripleLineError m_expectTripleLineErrorData = NONE;
Utils::optional<QDir> m_sourceDirectory;
std::optional<QDir> m_sourceDirectory;
ProjectExplorer::Task m_lastTask;
QRegularExpression m_commonError;
QRegularExpression m_nextSubError;

View File

@@ -39,7 +39,7 @@ bool CMakeListsNode::showInSimpleTree() const
return false;
}
Utils::optional<Utils::FilePath> CMakeListsNode::visibleAfterAddFileAction() const
std::optional<Utils::FilePath> CMakeListsNode::visibleAfterAddFileAction() const
{
return filePath().pathAppended("CMakeLists.txt");
}
@@ -169,7 +169,7 @@ void CMakeTargetNode::setConfig(const CMakeConfig &config)
m_config = config;
}
Utils::optional<Utils::FilePath> CMakeTargetNode::visibleAfterAddFileAction() const
std::optional<Utils::FilePath> CMakeTargetNode::visibleAfterAddFileAction() const
{
return filePath().pathAppended("CMakeLists.txt");
}

View File

@@ -22,7 +22,7 @@ public:
CMakeListsNode(const Utils::FilePath &cmakeListPath);
bool showInSimpleTree() const final;
Utils::optional<Utils::FilePath> visibleAfterAddFileAction() const override;
std::optional<Utils::FilePath> visibleAfterAddFileAction() const override;
};
class CMakeProjectNode : public ProjectExplorer::ProjectNode
@@ -45,7 +45,7 @@ public:
Utils::FilePath buildDirectory() const;
void setBuildDirectory(const Utils::FilePath &directory);
Utils::optional<Utils::FilePath> visibleAfterAddFileAction() const override;
std::optional<Utils::FilePath> visibleAfterAddFileAction() const override;
void build() override;

View File

@@ -49,7 +49,7 @@ namespace Internal {
const char READER_TYPE_FILEAPI[] = "fileapi";
static Utils::optional<CMakeTool::ReaderType> readerTypeFromString(const QString &input)
static std::optional<CMakeTool::ReaderType> readerTypeFromString(const QString &input)
{
// Do not try to be clever here, just use whatever is in the string!
if (input == READER_TYPE_FILEAPI)
@@ -331,7 +331,7 @@ CMakeTool::PathMapper CMakeTool::pathMapper() const
return [](const FilePath &fn) { return fn; };
}
Utils::optional<CMakeTool::ReaderType> CMakeTool::readerType() const
std::optional<CMakeTool::ReaderType> CMakeTool::readerType() const
{
if (m_readerType)
return m_readerType; // Allow overriding the auto-detected value via .user files

View File

@@ -9,7 +9,8 @@
#include <utils/fileutils.h>
#include <utils/id.h>
#include <utils/optional.h>
#include <optional>
namespace Utils { class QtcProcess; }
@@ -83,7 +84,7 @@ public:
void setPathMapper(const PathMapper &includePathMapper);
PathMapper pathMapper() const;
Utils::optional<ReaderType> readerType() const;
std::optional<ReaderType> readerType() const;
static Utils::FilePath searchQchFile(const Utils::FilePath &executable);
@@ -115,7 +116,7 @@ private:
QString m_detectionSource;
bool m_autoCreateBuildDirectory = false;
Utils::optional<ReaderType> m_readerType;
std::optional<ReaderType> m_readerType;
std::unique_ptr<Internal::IntrospectionData> m_introspection;

View File

@@ -9,13 +9,13 @@
#include <projectexplorer/rawprojectpart.h>
#include <utils/fileutils.h>
#include <utils/optional.h>
#include <QList>
#include <QSet>
#include <QString>
#include <memory>
#include <optional>
namespace CMakeProjectManager {
namespace Internal {

View File

@@ -195,8 +195,8 @@ public:
QList<Utils::FilePath> artifacts;
QString installPrefix;
std::vector<InstallDestination> installDestination;
Utils::optional<LinkInfo> link;
Utils::optional<ArchiveInfo> archive;
std::optional<LinkInfo> link;
std::optional<ArchiveInfo> archive;
std::vector<DependencyInfo> dependencies;
std::vector<SourceInfo> sources;
std::vector<QString> sourceGroups;

View File

@@ -12,13 +12,13 @@
#include <projectexplorer/treescanner.h>
#include <utils/filesystemwatcher.h>
#include <utils/optional.h>
#include <QDateTime>
#include <QFuture>
#include <QObject>
#include <memory>
#include <optional>
namespace ProjectExplorer {
class ProjectNode;
@@ -92,7 +92,7 @@ private:
bool m_usesAllCapsTargets = false;
int m_lastCMakeExitCode = 0;
Utils::optional<QFuture<std::shared_ptr<FileApiQtcData>>> m_future;
std::optional<QFuture<std::shared_ptr<FileApiQtcData>>> m_future;
// Update related:
bool m_isParsing = false;