Remove ensure JSON helpers
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user