Commit 9611e755 authored by EXT Arnaud Clère's avatar EXT Arnaud Clère

Fixed MSVC compile due to noexcept mismatch

Made unexpected value handling explicit (removed operator QValueEnd)
parent 7e9060b1
......@@ -534,7 +534,7 @@ struct QTransmogrifier<QJsonValue> {
if (j.isDouble ()) return v.bind(j.toDouble());
if (j.isString ()) return v.bind(j.toString());
if (j.isNull ()) return v.null();
return v;
return v.unexpected();
}
else { Q_ASSERT_X(false, Q_FUNC_INFO, "Unsupported v->mode()"); return v.any(); }
}
......@@ -553,7 +553,7 @@ struct QTransmogrifier<QJsonValue> {
quint64 u; if ((r = v.bind(u))) { j = QJsonValue(double(u)); return r; }
double d; if ((r = v.bind(d))) { j = QJsonValue( d ); return r; }
/**/ if ((r = v.null( ))) { j = QJsonValue( ); return r; }
return v;
return v.unexpected();
}
else { Q_ASSERT_X(!v, Q_FUNC_INFO, "Unsupported v->mode()"); return v.any(); }
}
......
......@@ -400,7 +400,9 @@ template<class T_> class QVal
{
Q_DISABLE_COPY(QVal)
public:
Q_ENABLE_MOVE_DEFAULT(QVal)
QVal ( ) = default;
QVal (QVal&&) = default;
QVal& operator=(QVal&&) = default;
~QVal() {
if (isValid() &&
resumeErrorHandler() &&
......@@ -417,8 +419,7 @@ public:
void setIsVariant() { suspendErrorHandler(); }
operator QValueEnd() { return outer->isErrorFiltered(qBindUnexpectedValue) ? any() : T_(); /* calls T_::operator QValueEnd() if T_ != QValueEnd */ }
QValueEnd end() { return any(); /* calls T_::operator QValueEnd() if T_ != QValueEnd */ }
/**/ T_ unexpected() { return outer->isErrorFiltered(qBindUnexpectedValue) ? any() : T_(); }
/**/ T_ any() { return outer->tryAny() && resumeErrorHandler() ? std::move(outer) : T_(); }
QVal<T_> meta (QIdentifierLiteral& n, QAsciiData& m) { outer->_meta(n,m); return std::move(*this); }
......@@ -498,7 +499,6 @@ public:
bool isValid() const noexcept { return outer.isValid(); } //!< Drives QTransmogrifier<T>::bind() traversal
QCur* operator->() noexcept { return outer.operator->(); }
QValueEnd end() { return out(); /* calls T_::operator QValueEnd() if T_ != QValueEnd */ }
T_ out() { return outer->tryOut() ? std::move(outer) : T_(); }
QVal<QSeq<T_>> item() { return outer->tryItem() ? QVal<QSeq<T_>>(std::move(*this)) : QVal<QSeq<T_>>(); }
......@@ -554,7 +554,6 @@ public:
bool isValid() const noexcept { return outer.isValid(); } //!< Drives QTransmogrifier<T>::bind() traversal
QCur* operator->() noexcept { return outer.operator->(); }
QValueEnd end() { return out(); /* calls T_::operator QValueEnd() if T_ != QValueEnd */ }
T_ out() { return outer->tryOut() ? std::move(outer) : T_(); }
QVal<QRec<T_>> item(QIdentifier& n) { return outer->tryItem( n ) ? QVal<QRec<T_>>(std::move(*this)) : QVal<QRec<T_>>(); }
......@@ -1323,7 +1322,7 @@ struct QTransmogrifier<QValue> {
// TODO Other BindNative types we do not want to treat as text: QDateTime, QUuid
/**/ if ((srcEnd = src.null( ))) { dst.null( ); return srcEnd; }
if (src->isErrorFiltered(qBindUnexpectedValue) && (srcEnd = src.any())) { dst.any(); return srcEnd; }
return src;
return src.unexpected();
}
else if (src->mode()==Write && dst->mode()==Read) { return zap(std::move(dst),std::move(src)); } // To return reader's QCur instead of writer's QCur since it should contain more information (mismatches, etc.)
else { Q_ASSERT_X(!src || !dst, Q_FUNC_INFO, "Unsupported src->mode() and dst->mode()"); return src.null(); }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment