diff --git a/src/libs/utils/expected.h b/src/libs/utils/expected.h index f5e5350590c..fccd979d69c 100644 --- a/src/libs/utils/expected.h +++ b/src/libs/utils/expected.h @@ -11,9 +11,6 @@ namespace Utils { using namespace tl; -template -using expected_str = tl::expected; - } // namespace Utils //! If 'expected' has an error the error will be printed and the 'action' will be executed. diff --git a/src/plugins/appstatisticsmonitor/idataprovider.cpp b/src/plugins/appstatisticsmonitor/idataprovider.cpp index 0d5d8a2fe8c..1f6d98525b5 100644 --- a/src/plugins/appstatisticsmonitor/idataprovider.cpp +++ b/src/plugins/appstatisticsmonitor/idataprovider.cpp @@ -3,9 +3,9 @@ #include "idataprovider.h" -#include #include #include +#include #include #include @@ -84,7 +84,7 @@ public: { const FilePath statusMemory = FilePath::fromString( QStringLiteral("/proc/%1/status").arg(m_pid)); - const expected_str statusMemoryContent = statusMemory.fileContents(); + const Result statusMemoryContent = statusMemory.fileContents(); if (!statusMemoryContent) return 0; @@ -99,7 +99,7 @@ public: } const FilePath meminfoFile("/proc/meminfo"); - const expected_str meminfoContent = meminfoFile.fileContents(); + const Result meminfoContent = meminfoFile.fileContents(); if (!meminfoContent) return 0; @@ -120,8 +120,8 @@ public: const FilePath status = FilePath::fromString(QStringLiteral("/proc/%1/stat").arg(m_pid)); const FilePath uptimeFile = FilePath::fromString(QStringLiteral("/proc/uptime")); const double clkTck = static_cast(sysconf(_SC_CLK_TCK)); - const expected_str statusFileContent = status.fileContents(); - const expected_str uptimeFileContent = uptimeFile.fileContents(); + const Result statusFileContent = status.fileContents(); + const Result uptimeFileContent = uptimeFile.fileContents(); if (!statusFileContent.has_value() || !uptimeFileContent.has_value() || clkTck == 0) return 0; diff --git a/src/plugins/axivion/axivionperspective.cpp b/src/plugins/axivion/axivionperspective.cpp index c5301f8a175..872fc195882 100644 --- a/src/plugins/axivion/axivionperspective.cpp +++ b/src/plugins/axivion/axivionperspective.cpp @@ -558,7 +558,7 @@ void IssuesWidget::initDashboardList(const QString &preferredProject) void IssuesWidget::reinitProjectList(const QString ¤tProject) { const auto onDashboardInfoFetched - = [this, currentProject] (const expected_str &info) { + = [this, currentProject] (const Result &info) { if (!info) { m_issuesView->hideProgressIndicator(); return; diff --git a/src/plugins/axivion/axivionplugin.cpp b/src/plugins/axivion/axivionplugin.cpp index 747eaf50c22..63ffd5d2e6f 100644 --- a/src/plugins/axivion/axivionplugin.cpp +++ b/src/plugins/axivion/axivionplugin.cpp @@ -586,7 +586,7 @@ static Group dtoRecipe(const Storage> &dtoStorage) QString errorString; if (contentType == s_jsonContentType) { - const Utils::expected_str error + const Result error = Dto::ErrorDto::deserializeExpected(reply->readAll()); if (error) { @@ -622,18 +622,18 @@ static Group dtoRecipe(const Storage> &dtoStorage) return DoneResult::Error; }; - const auto onDeserializeSetup = [storage](Async> &task) { + const auto onDeserializeSetup = [storage](Async> &task) { if (!*storage) return SetupResult::StopWithSuccess; - const auto deserialize = [](QPromise> &promise, const QByteArray &input) { + const auto deserialize = [](QPromise> &promise, const QByteArray &input) { promise.addResult(DtoType::deserializeExpected(input)); }; task.setConcurrentCallData(deserialize, **storage); return SetupResult::Continue; }; - const auto onDeserializeDone = [dtoStorage](const Async> &task, + const auto onDeserializeDone = [dtoStorage](const Async> &task, DoneWith doneWith) { if (doneWith == DoneWith::Success && task.isResultAvailable()) { const auto result = task.result(); @@ -652,7 +652,7 @@ static Group dtoRecipe(const Storage> &dtoStorage) return { storage, NetworkQueryTask(onNetworkQuerySetup, onNetworkQueryDone), - AsyncTask>(onDeserializeSetup, onDeserializeDone) + AsyncTask>(onDeserializeSetup, onDeserializeDone) }; } diff --git a/src/plugins/axivion/axivionplugin.h b/src/plugins/axivion/axivionplugin.h index 65d00dc6e4e..cf675d24d6c 100644 --- a/src/plugins/axivion/axivionplugin.h +++ b/src/plugins/axivion/axivionplugin.h @@ -5,8 +5,8 @@ #include "dashboard/dto.h" -#include #include +#include #include #include @@ -85,20 +85,20 @@ QUrl resolveDashboardInfoUrl(const QUrl &url); Tasking::Group downloadDataRecipe(const Tasking::Storage &storage); -using DashboardInfoHandler = std::function &)>; +using DashboardInfoHandler = std::function &)>; Tasking::Group dashboardInfoRecipe(const DashboardInfoHandler &handler = {}); Tasking::Group projectInfoRecipe(const QString &projectName); -// TODO: Wrap into expected_str<>? +// TODO: Wrap into Result<>? using TableInfoHandler = std::function; Tasking::Group tableInfoRecipe(const QString &prefix, const TableInfoHandler &handler); -// TODO: Wrap into expected_str<>? +// TODO: Wrap into Result<>? using IssueTableHandler = std::function; Tasking::Group issueTableRecipe(const IssueListSearch &search, const IssueTableHandler &handler); -// TODO: Wrap into expected_str<>? +// TODO: Wrap into Result<>? using LineMarkerHandler = std::function; Tasking::Group lineMarkerRecipe(const Utils::FilePath &filePath, const LineMarkerHandler &handler); diff --git a/src/plugins/axivion/axivionsettings.cpp b/src/plugins/axivion/axivionsettings.cpp index a103582d2bb..e7c743c5a95 100644 --- a/src/plugins/axivion/axivionsettings.cpp +++ b/src/plugins/axivion/axivionsettings.cpp @@ -134,7 +134,7 @@ static QList readAxivionJson(const FilePath &filePath) { if (!filePath.exists()) return {}; - expected_str contents = filePath.fileContents(); + Result contents = filePath.fileContents(); if (!contents) return {}; const QJsonDocument doc = QJsonDocument::fromJson(*contents);