blob: 3da594431e1906c5c85cf835a14fbe762d75cfb9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "result.h"
#include "utilstr.h"
namespace Utils {
const Result<> ResultOk;
ResultError::ResultError(const QString &errorMessage)
: m_error(errorMessage)
{}
ResultError::ResultError(ResultUnimplementedType)
: m_error(Tr::tr("Not implemented"))
{}
ResultError::ResultError(ResultAssertType, const QString &errorMessage)
: m_error(Tr::tr("Internal error: %1").arg(errorMessage))
{}
Result<> makeResult(bool ok, const QString &errorMessage)
{
if (ok)
return ResultOk;
return tl::make_unexpected(errorMessage);
}
} // Utils
|