mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Remove ensure JSON helpers
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
7e8cf628e8
commit
e42c9d2a1d
38 changed files with 228 additions and 239 deletions
|
|
@ -153,7 +153,7 @@ QJsonValue toJson<QVariant>(const QVariant& variant)
|
|||
template <>
|
||||
QByteArray requireIsType<QByteArray>(const QJsonValue& value, const QString& what)
|
||||
{
|
||||
const QString string = ensureIsType<QString>(value, what);
|
||||
const QString string = value.toString(what);
|
||||
// ensure that the string can be safely cast to Latin1
|
||||
if (string != QString::fromLatin1(string.toLatin1())) {
|
||||
throw JsonException(what + " is not encodable as Latin1");
|
||||
|
|
@ -221,7 +221,7 @@ QDateTime requireIsType<QDateTime>(const QJsonValue& value, const QString& what)
|
|||
template <>
|
||||
QUrl requireIsType<QUrl>(const QJsonValue& value, const QString& what)
|
||||
{
|
||||
const QString string = ensureIsType<QString>(value, what);
|
||||
const QString string = value.toString(what);
|
||||
if (string.isEmpty()) {
|
||||
return QUrl();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue