forked from qt-creator/qt-creator
dto.cpp C++20 compatibility
Change-Id: I556afac8718aa45d70dfb999e6e49620d638c5eb Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Andreas Loth <andreas.loth@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -57,11 +57,11 @@ namespace Axivion::Internal::Dto {
|
|||||||
// exceptions
|
// exceptions
|
||||||
|
|
||||||
invalid_dto_exception::invalid_dto_exception(const std::string_view type_name, const std::exception &ex) :
|
invalid_dto_exception::invalid_dto_exception(const std::string_view type_name, const std::exception &ex) :
|
||||||
std::runtime_error(concat({ type_name, u8": ", ex.what() }))
|
std::runtime_error(concat({ type_name, ": ", ex.what() }))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
invalid_dto_exception::invalid_dto_exception(const std::string_view type_name, const std::string_view message) :
|
invalid_dto_exception::invalid_dto_exception(const std::string_view type_name, const std::string_view message) :
|
||||||
std::runtime_error(concat({ type_name, u8": ", message }))
|
std::runtime_error(concat({ type_name, ": ", message }))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// throws Axivion::Internal::Dto::invalid_dto_exception
|
// throws Axivion::Internal::Dto::invalid_dto_exception
|
||||||
@@ -82,7 +82,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
[[noreturn]] static void throw_json_type_conversion(QJsonValue::Type type) {
|
[[noreturn]] static void throw_json_type_conversion(QJsonValue::Type type) {
|
||||||
throw_invalid_dto_exception<T>(concat({
|
throw_invalid_dto_exception<T>(concat({
|
||||||
u8"Error parsing JSON: Cannot convert type ",
|
"Error parsing JSON: Cannot convert type ",
|
||||||
to_std_string(type)
|
to_std_string(type)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
template<typename T, typename V>
|
template<typename T, typename V>
|
||||||
[[noreturn]] static void throw_json_value_conversion(const V &raw_value) {
|
[[noreturn]] static void throw_json_value_conversion(const V &raw_value) {
|
||||||
throw_invalid_dto_exception<T>(concat({
|
throw_invalid_dto_exception<T>(concat({
|
||||||
u8"Error parsing JSON: Cannot convert raw value ",
|
"Error parsing JSON: Cannot convert raw value ",
|
||||||
to_std_string(raw_value)
|
to_std_string(raw_value)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -143,17 +143,17 @@ namespace Axivion::Internal::Dto {
|
|||||||
if (error.error != QJsonParseError::ParseError::NoError)
|
if (error.error != QJsonParseError::ParseError::NoError)
|
||||||
{
|
{
|
||||||
throw_invalid_dto_exception<T>(concat({
|
throw_invalid_dto_exception<T>(concat({
|
||||||
u8"Error parsing JSON - ",
|
"Error parsing JSON - ",
|
||||||
to_std_string(error.error),
|
to_std_string(error.error),
|
||||||
u8" at ",
|
" at ",
|
||||||
to_std_string(error.offset),
|
to_std_string(error.offset),
|
||||||
u8": ",
|
": ",
|
||||||
to_std_string(error.errorString())
|
to_std_string(error.errorString())
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (!qjd.isObject())
|
if (!qjd.isObject())
|
||||||
{
|
{
|
||||||
throw_invalid_dto_exception<T>(u8"Error parsing JSON: parsed data is no JSON object");
|
throw_invalid_dto_exception<T>("Error parsing JSON: parsed data is no JSON object");
|
||||||
}
|
}
|
||||||
qjv = QJsonValue(qjd.object());
|
qjv = QJsonValue(qjd.object());
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw std::domain_error(concat({
|
throw std::domain_error(concat({
|
||||||
u8"Error serializing JSON - value is not an object or array:",
|
"Error serializing JSON - value is not an object or array:",
|
||||||
to_std_string(qjv.type())
|
to_std_string(qjv.type())
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -514,7 +514,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
if (it == jo.constEnd())
|
if (it == jo.constEnd())
|
||||||
{
|
{
|
||||||
throw_invalid_dto_exception<T>(concat({
|
throw_invalid_dto_exception<T>(concat({
|
||||||
u8"Error parsing JSON: key not found ",
|
"Error parsing JSON: key not found ",
|
||||||
to_std_string(key)
|
to_std_string(key)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -608,7 +608,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
return Any(deserialize_json<bool>(json));
|
return Any(deserialize_json<bool>(json));
|
||||||
}
|
}
|
||||||
throw std::domain_error(concat({
|
throw std::domain_error(concat({
|
||||||
u8"Unknown json value type: ",
|
"Unknown json value type: ",
|
||||||
to_std_string(json.type())
|
to_std_string(json.type())
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -638,7 +638,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
{
|
{
|
||||||
return serialize_json(value.getBool());
|
return serialize_json(value.getBool());
|
||||||
}
|
}
|
||||||
throw std::domain_error(u8"Unknown Axivion::Internal::Dto::any variant");
|
throw std::domain_error("Unknown Axivion::Internal::Dto::any variant");
|
||||||
}
|
}
|
||||||
|
|
||||||
de_serializer() = delete;
|
de_serializer() = delete;
|
||||||
@@ -839,7 +839,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
{
|
{
|
||||||
return ApiTokenType::continuousintegration;
|
return ApiTokenType::continuousintegration;
|
||||||
}
|
}
|
||||||
throw std::range_error(concat({ u8"Unknown ApiTokenType str: ", to_std_string(str) }));
|
throw std::range_error(concat({ "Unknown ApiTokenType str: ", to_std_string(str) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
QLatin1String ApiTokenTypeMeta::enumToStr(ApiTokenType e)
|
QLatin1String ApiTokenTypeMeta::enumToStr(ApiTokenType e)
|
||||||
@@ -858,7 +858,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
return ApiTokenTypeMeta::continuousintegration;;
|
return ApiTokenTypeMeta::continuousintegration;;
|
||||||
default:
|
default:
|
||||||
throw std::domain_error(concat({
|
throw std::domain_error(concat({
|
||||||
u8"Unknown ApiTokenType enum: ",
|
"Unknown ApiTokenType enum: ",
|
||||||
to_std_string(static_cast<int>(e))
|
to_std_string(static_cast<int>(e))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -1313,7 +1313,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
{
|
{
|
||||||
return IssueKind::sv;
|
return IssueKind::sv;
|
||||||
}
|
}
|
||||||
throw std::range_error(concat({ u8"Unknown IssueKind str: ", to_std_string(str) }));
|
throw std::range_error(concat({ "Unknown IssueKind str: ", to_std_string(str) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
QLatin1String IssueKindMeta::enumToStr(IssueKind e)
|
QLatin1String IssueKindMeta::enumToStr(IssueKind e)
|
||||||
@@ -1334,7 +1334,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
return IssueKindMeta::sv;;
|
return IssueKindMeta::sv;;
|
||||||
default:
|
default:
|
||||||
throw std::domain_error(concat({
|
throw std::domain_error(concat({
|
||||||
u8"Unknown IssueKind enum: ",
|
"Unknown IssueKind enum: ",
|
||||||
to_std_string(static_cast<int>(e))
|
to_std_string(static_cast<int>(e))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -1381,7 +1381,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
{
|
{
|
||||||
return IssueKindForNamedFilterCreation::universal;
|
return IssueKindForNamedFilterCreation::universal;
|
||||||
}
|
}
|
||||||
throw std::range_error(concat({ u8"Unknown IssueKindForNamedFilterCreation str: ", to_std_string(str) }));
|
throw std::range_error(concat({ "Unknown IssueKindForNamedFilterCreation str: ", to_std_string(str) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
QLatin1String IssueKindForNamedFilterCreationMeta::enumToStr(IssueKindForNamedFilterCreation e)
|
QLatin1String IssueKindForNamedFilterCreationMeta::enumToStr(IssueKindForNamedFilterCreation e)
|
||||||
@@ -1404,7 +1404,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
return IssueKindForNamedFilterCreationMeta::universal;;
|
return IssueKindForNamedFilterCreationMeta::universal;;
|
||||||
default:
|
default:
|
||||||
throw std::domain_error(concat({
|
throw std::domain_error(concat({
|
||||||
u8"Unknown IssueKindForNamedFilterCreation enum: ",
|
"Unknown IssueKindForNamedFilterCreation enum: ",
|
||||||
to_std_string(static_cast<int>(e))
|
to_std_string(static_cast<int>(e))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -1633,7 +1633,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
{
|
{
|
||||||
return MessageSeverity::fatal;
|
return MessageSeverity::fatal;
|
||||||
}
|
}
|
||||||
throw std::range_error(concat({ u8"Unknown MessageSeverity str: ", to_std_string(str) }));
|
throw std::range_error(concat({ "Unknown MessageSeverity str: ", to_std_string(str) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
QLatin1String MessageSeverityMeta::enumToStr(MessageSeverity e)
|
QLatin1String MessageSeverityMeta::enumToStr(MessageSeverity e)
|
||||||
@@ -1652,7 +1652,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
return MessageSeverityMeta::fatal;;
|
return MessageSeverityMeta::fatal;;
|
||||||
default:
|
default:
|
||||||
throw std::domain_error(concat({
|
throw std::domain_error(concat({
|
||||||
u8"Unknown MessageSeverity enum: ",
|
"Unknown MessageSeverity enum: ",
|
||||||
to_std_string(static_cast<int>(e))
|
to_std_string(static_cast<int>(e))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -1812,7 +1812,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
{
|
{
|
||||||
return NamedFilterType::custom;
|
return NamedFilterType::custom;
|
||||||
}
|
}
|
||||||
throw std::range_error(concat({ u8"Unknown NamedFilterType str: ", to_std_string(str) }));
|
throw std::range_error(concat({ "Unknown NamedFilterType str: ", to_std_string(str) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
QLatin1String NamedFilterTypeMeta::enumToStr(NamedFilterType e)
|
QLatin1String NamedFilterTypeMeta::enumToStr(NamedFilterType e)
|
||||||
@@ -1827,7 +1827,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
return NamedFilterTypeMeta::custom;;
|
return NamedFilterTypeMeta::custom;;
|
||||||
default:
|
default:
|
||||||
throw std::domain_error(concat({
|
throw std::domain_error(concat({
|
||||||
u8"Unknown NamedFilterType enum: ",
|
"Unknown NamedFilterType enum: ",
|
||||||
to_std_string(static_cast<int>(e))
|
to_std_string(static_cast<int>(e))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -1996,7 +1996,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
{
|
{
|
||||||
return SortDirection::desc;
|
return SortDirection::desc;
|
||||||
}
|
}
|
||||||
throw std::range_error(concat({ u8"Unknown SortDirection str: ", to_std_string(str) }));
|
throw std::range_error(concat({ "Unknown SortDirection str: ", to_std_string(str) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
QLatin1String SortDirectionMeta::enumToStr(SortDirection e)
|
QLatin1String SortDirectionMeta::enumToStr(SortDirection e)
|
||||||
@@ -2009,7 +2009,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
return SortDirectionMeta::desc;;
|
return SortDirectionMeta::desc;;
|
||||||
default:
|
default:
|
||||||
throw std::domain_error(concat({
|
throw std::domain_error(concat({
|
||||||
u8"Unknown SortDirection enum: ",
|
"Unknown SortDirection enum: ",
|
||||||
to_std_string(static_cast<int>(e))
|
to_std_string(static_cast<int>(e))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -2036,7 +2036,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
{
|
{
|
||||||
return TableCellAlignment::center;
|
return TableCellAlignment::center;
|
||||||
}
|
}
|
||||||
throw std::range_error(concat({ u8"Unknown TableCellAlignment str: ", to_std_string(str) }));
|
throw std::range_error(concat({ "Unknown TableCellAlignment str: ", to_std_string(str) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
QLatin1String TableCellAlignmentMeta::enumToStr(TableCellAlignment e)
|
QLatin1String TableCellAlignmentMeta::enumToStr(TableCellAlignment e)
|
||||||
@@ -2051,7 +2051,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
return TableCellAlignmentMeta::center;;
|
return TableCellAlignmentMeta::center;;
|
||||||
default:
|
default:
|
||||||
throw std::domain_error(concat({
|
throw std::domain_error(concat({
|
||||||
u8"Unknown TableCellAlignment enum: ",
|
"Unknown TableCellAlignment enum: ",
|
||||||
to_std_string(static_cast<int>(e))
|
to_std_string(static_cast<int>(e))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -2132,7 +2132,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
{
|
{
|
||||||
return UserRefType::unmapped_user;
|
return UserRefType::unmapped_user;
|
||||||
}
|
}
|
||||||
throw std::range_error(concat({ u8"Unknown UserRefType str: ", to_std_string(str) }));
|
throw std::range_error(concat({ "Unknown UserRefType str: ", to_std_string(str) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
QLatin1String UserRefTypeMeta::enumToStr(UserRefType e)
|
QLatin1String UserRefTypeMeta::enumToStr(UserRefType e)
|
||||||
@@ -2147,7 +2147,7 @@ namespace Axivion::Internal::Dto {
|
|||||||
return UserRefTypeMeta::unmapped_user;;
|
return UserRefTypeMeta::unmapped_user;;
|
||||||
default:
|
default:
|
||||||
throw std::domain_error(concat({
|
throw std::domain_error(concat({
|
||||||
u8"Unknown UserRefType enum: ",
|
"Unknown UserRefType enum: ",
|
||||||
to_std_string(static_cast<int>(e))
|
to_std_string(static_cast<int>(e))
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user