Commit 0cf044d6 authored by EXT Arnaud Clère's avatar EXT Arnaud Clère
Browse files

WIP refactor error handling to the fluent interface

Simplify design by provising QCur with all QValue overloads instead of
relying on a trait (this allows to simplifying calls stacks for debug
and provide type sensitive error handling context too)
parent c4293e8e
......@@ -349,7 +349,7 @@ protected:
bool tryBind ( quint64& t) { if (caching) { return caching->tryBind(t) && cacheOut(); }
skipTag();
if (!isUnsignedInteger()) { handleError(qBindExpectedPositiveInteger); return false; }
if (!isUnsignedInteger()) { return false; }
t=toUnsignedInteger(); return true; }
bool tryBind ( qint64& t) { if (caching) { return caching->tryBind(t) && cacheOut(); }
quint64 i; bool neg;
......
......@@ -300,12 +300,12 @@ protected:
auto r=getNumber();
if (r==None) return false; // already reported qBindExpectedDecimal
if (r==FloatingPoint) { handleError(qBindExpectedInteger); return false; }
if (neg) { handleError(qBindExpectedPositiveInteger); return false; }
if (neg) { return false; }
t = i ; cachedNumber=None; return true; }
bool tryBind ( qint64& t) { if (caching) { return caching->tryBind(t) && cacheOut(); }
auto r=getNumber();
if (r==None) return false; // already reported qBindExpectedDecimal
if (r==FloatingPoint) { handleError(qBindExpectedInteger); return false; }
if (r==FloatingPoint) { return false; }
if (!neg && i<quint64( std::numeric_limits<qint64>::max()) ) { t = qint64(i); cachedNumber=None; return true; }
if ( neg && i<quint64(-std::numeric_limits<qint64>::max())-1) { t = -qint64(i); cachedNumber=None; return true; }
handleError(qBindExpectedSmallerNumber); return false; }
......
......@@ -121,21 +121,21 @@ protected:
template<typename T>
bool tryBind(T& t) { return set(t, "Expected declared metatype T"); }
bool tryBind( QUtf8Data& t) { return set(t, qBindExpectedText ); }
bool tryBind( QString& t) { return set(t, qBindExpectedText ); }
bool tryBind( bool& t) { return set(t, qBindExpectedBoolean); }
bool tryBind( QByteArray& t) { return set(t, qBindExpectedBytes ); }
bool tryBind( QUtf8Data& t) { return set(t); }
bool tryBind( QString& t) { return set(t); }
bool tryBind( bool& t) { return set(t); }
bool tryBind( QByteArray& t) { return set(t); }
// Convert numerical types to strictly larger ones // TODO convert all compatible values
bool tryBind( qint8& t) { return set(t, qBindExpectedInteger ); }
bool tryBind( qint16& t) { return set(t, qBindExpectedInteger ); }
bool tryBind( qint32& t) { return set(t, qBindExpectedInteger ); }
bool tryBind( qint64& t) { return set(t, qBindExpectedInteger ); }
bool tryBind( quint8& t) { return set(t, qBindExpectedPositiveInteger); }
bool tryBind( quint16& t) { return set(t, qBindExpectedPositiveInteger); }
bool tryBind( quint32& t) { return set(t, qBindExpectedPositiveInteger); }
bool tryBind( quint64& t) { return set(t, qBindExpectedPositiveInteger); }
bool tryBind( float& t) { return set(t, qBindExpectedDecimal ); }
bool tryBind( double& t) { return set(t, qBindExpectedDecimal ); }
bool tryBind( qint8& t) { return set(t); }
bool tryBind( qint16& t) { return set(t); }
bool tryBind( qint32& t) { return set(t); }
bool tryBind( qint64& t) { return set(t); }
bool tryBind( quint8& t) { return set(t); }
bool tryBind( quint16& t) { return set(t); }
bool tryBind( quint32& t) { return set(t); }
bool tryBind( quint64& t) { return set(t); }
bool tryBind( float& t) { return set(t); }
bool tryBind( double& t) { return set(t); }
bool trySequence(quint32* =nullptr) { if (levels.last().isGroup) { levels.push(Level( )); return true; } return false; }
bool tryRecord (quint32* =nullptr) { if (levels.last().isGroup) { levels.push(Level(qBindExpectedItem)); return true; } return false; }
......@@ -148,10 +148,10 @@ protected:
bool tryAny() { return true; }
bool isValid() const noexcept { return settings; }
bool handleError(QIdentifierLiteral e, QString context = QString()) const { return errorHandler ? errorHandler(e, QString("at %1 %2").arg(currentPath(), context)) : false; }
bool handleError(QIdentifierLiteral e, QString context = QString()) const { return errorHandler && errorHandler(e, QString("at %1 %2").arg(currentPath(), context)); }
private:
template<typename T>
bool set(T& t, QIdentifierLiteral error) { QVariant v = settings->value(key()); if (v.convert(qMetaTypeId<T>())) { t = v.value<T>(); return true; } handleError(error); return false; }
bool set(T& t) { QVariant v = settings->value(key()); if (v.convert(qMetaTypeId<T>())) { t = v.value<T>(); return true; } return false; }
QString key() {
Q_ASSERT(!levels.isEmpty());
return !levels.last().key.isNull()
......
......@@ -115,34 +115,6 @@ enum QValueMode { Invalid=0, Read=1, Write=2 }; //!< Specifies QTransmogrifier::
using QValueErrorHandler = std::function<bool(QIdentifierLiteral,QString)>;
struct BindGeneric {};
struct BindNative {};
//!< Specifies whether QVal calls QAbstractValue::tryBind or QTransmogrifier<T>::bind
//!< \remark It would be possible to remove BindSupport by defining all QAbstractValue overloads in QVal
template<typename T, typename TEnabledIf=void> struct BindSupport : BindGeneric {};
template<> struct BindSupport< QUtf8Data> : BindNative {};
template<> struct BindSupport< QString> : BindNative {};
//template<> struct BindSupport< QChar> : BindNative {};
template<> struct BindSupport< bool> : BindNative {};
template<> struct BindSupport< qint8> : BindNative {};
template<> struct BindSupport< quint8> : BindNative {};
template<> struct BindSupport< qint16> : BindNative {};
template<> struct BindSupport< quint16> : BindNative {};
template<> struct BindSupport< qint32> : BindNative {};
template<> struct BindSupport< quint32> : BindNative {};
template<> struct BindSupport< qint64> : BindNative {};
template<> struct BindSupport< quint64> : BindNative {};
//template<> struct BindSupport< qfloat16> : BindNative {};
template<> struct BindSupport< float> : BindNative {};
template<> struct BindSupport< double> : BindNative {};
//template<> struct BindSupport< QDate> : BindNative {};
//template<> struct BindSupport< QDateTime> : BindNative {};
//template<> struct BindSupport< QTime> : BindNative {};
//template<> struct BindSupport< QUuid> : BindNative {};
template<> struct BindSupport< QByteArray> : BindNative {};
template<> struct BindSupport< QVariant> : BindNative {};
#include <QtCore/qvariant.h>
//#include <QtCore/qfloat16.h>
//#include <QtCore/qdatetime.h>
......@@ -308,31 +280,74 @@ protected:
bool trySequence( quint32* s=nullptr) { return Q_LIKELY(impl) && (impl->trySequence(s) || (handleError(qBindExpectedSequence) && impl->tryAny())); }
bool tryRecord ( quint32* s=nullptr) { return Q_LIKELY(impl) && (impl->tryRecord (s) || (handleError(qBindExpectedRecord ) && impl->tryAny())); }
bool tryNull ( ) { return Q_LIKELY(impl) && (impl->tryNull ( ) || (handleError(qBindExpectedNull ) && impl->tryAny())); }
bool tryBind ( QUtf8DataView u) { return Q_LIKELY(impl) && (impl->tryBind (u) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind ( QAsciiDataView a) { return Q_LIKELY(impl) && (impl->tryBind (a) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind ( QLatin1String l) { return Q_LIKELY(impl) && (impl->tryBind (l) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind ( QStringView u) { return Q_LIKELY(impl) && (impl->tryBind (u) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind ( QString& b) { return Q_LIKELY(impl) && (impl->tryBind (b) || (handleError(qBindExpectedBoolean) && impl->tryAny())); }
bool tryBind ( const QString& b) { return Q_LIKELY(impl) && (impl->tryBind (b) || (handleError(qBindExpectedBoolean) && impl->tryAny())); }
bool tryBind ( QString&& b) { return Q_LIKELY(impl) && (impl->tryBind (b) || (handleError(qBindExpectedBoolean) && impl->tryAny())); }
bool tryBind ( QUtf8Data& b) { return Q_LIKELY(impl) && (impl->tryBind (b) || (handleError(qBindExpectedBoolean) && impl->tryAny())); }
bool tryBind ( const QUtf8Data& b) { return Q_LIKELY(impl) && (impl->tryBind (b) || (handleError(qBindExpectedBoolean) && impl->tryAny())); }
bool tryBind ( QUtf8Data&& b) { return Q_LIKELY(impl) && (impl->tryBind (b) || (handleError(qBindExpectedBoolean) && impl->tryAny())); }
bool tryBind ( bool& b) { return Q_LIKELY(impl) && (impl->tryBind (b) || (handleError(qBindExpectedBoolean) && impl->tryAny())); }
bool tryBind ( const bool& b) { return Q_LIKELY(impl) && (impl->tryBind (b) || (handleError(qBindExpectedBoolean) && impl->tryAny())); }
bool tryBind ( bool&& b) { return Q_LIKELY(impl) && (impl->tryBind (b) || (handleError(qBindExpectedBoolean) && impl->tryAny())); }
template<typename T> bool tryBind( T&& t) { return tryBind(BindSupport<RemoveCvRef<T>>(), std::forward<T>(t)); }
private:
template<typename T> bool tryBind(BindNative , T&& t) { return Q_LIKELY(impl) && impl->tryBind(std::forward<T>(t)); }
template<typename T> bool tryBind(BindGeneric, T&& t) ;
bool tryItem(QIdentifierLiteral n) { return Q_LIKELY(impl) && impl->tryItem(n); }
bool tryItem(QIdentifier& n) { return Q_LIKELY(impl) && impl->tryItem(n); }
bool tryItem( ) { return Q_LIKELY(impl) && impl->tryItem( ); }
bool tryOut ( ) { return Q_LIKELY(impl) && impl->tryOut ( ); }
bool tryBind( QUtf8Data& t) { return Q_LIKELY(impl) && (impl->tryBind(t) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind( QString& t) { return Q_LIKELY(impl) && (impl->tryBind(t) || (handleError(qBindExpectedText ) && impl->tryAny())); }
// TODO qBindExpectedConstant after successful tryBind without attempting (but testing several constants requires memoizing the bound value anyway...)
bool tryBind(const QUtf8Data& t) { return Q_LIKELY(impl) && (impl->tryBind(t) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind(const QString& t) { return Q_LIKELY(impl) && (impl->tryBind(t) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind( QUtf8Data&& t) { return Q_LIKELY(impl) && (impl->tryBind(t) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind( QString&& t) { return Q_LIKELY(impl) && (impl->tryBind(t) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind( const char* t) { return Q_LIKELY(impl) && (impl->tryBind(t) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind( QUtf8DataView t) { return Q_LIKELY(impl) && (impl->tryBind(t) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind( QAsciiDataView t) { return Q_LIKELY(impl) && (impl->tryBind(t) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind( QLatin1String t) { return Q_LIKELY(impl) && (impl->tryBind(t) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind( QStringView t) { return Q_LIKELY(impl) && (impl->tryBind(t) || (handleError(qBindExpectedText ) && impl->tryAny())); }
bool tryBind( bool& b) { return Q_LIKELY(impl) && (impl->tryBind(b) || (handleError(qBindExpectedBoolean ) && impl->tryAny())); }
bool tryBind(const bool& b) { return Q_LIKELY(impl) && (impl->tryBind(b) || (handleError(qBindExpectedBoolean ) && impl->tryAny())); }
bool tryBind( bool&& b) { return Q_LIKELY(impl) && (impl->tryBind(b) || (handleError(qBindExpectedBoolean ) && impl->tryAny())); }
bool tryBind( quint8& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedPositiveInteger) && impl->tryAny())); }
bool tryBind( quint16& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedPositiveInteger) && impl->tryAny())); }
bool tryBind( quint32& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedPositiveInteger) && impl->tryAny())); }
bool tryBind( quint64& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedPositiveInteger) && impl->tryAny())); }
bool tryBind(const quint8& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedPositiveInteger) && impl->tryAny())); }
bool tryBind(const quint16& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedPositiveInteger) && impl->tryAny())); }
bool tryBind(const quint32& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedPositiveInteger) && impl->tryAny())); }
bool tryBind(const quint64& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedPositiveInteger) && impl->tryAny())); }
bool tryBind( quint8&& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedPositiveInteger) && impl->tryAny())); }
bool tryBind( quint16&& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedPositiveInteger) && impl->tryAny())); }
bool tryBind( quint32&& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedPositiveInteger) && impl->tryAny())); }
bool tryBind( quint64&& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedPositiveInteger) && impl->tryAny())); }
bool tryBind( qint8& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedInteger ) && impl->tryAny())); }
bool tryBind( qint16& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedInteger ) && impl->tryAny())); }
bool tryBind( qint32& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedInteger ) && impl->tryAny())); }
bool tryBind( qint64& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedInteger ) && impl->tryAny())); }
bool tryBind(const qint8& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedInteger ) && impl->tryAny())); }
bool tryBind(const qint16& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedInteger ) && impl->tryAny())); }
bool tryBind(const qint32& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedInteger ) && impl->tryAny())); }
bool tryBind(const qint64& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedInteger ) && impl->tryAny())); }
bool tryBind( qint8&& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedInteger ) && impl->tryAny())); }
bool tryBind( qint16&& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedInteger ) && impl->tryAny())); }
bool tryBind( qint32&& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedInteger ) && impl->tryAny())); }
bool tryBind( qint64&& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedInteger ) && impl->tryAny())); }
bool tryBind( float& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedDecimal ) && impl->tryAny())); }
bool tryBind( double& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedDecimal ) && impl->tryAny())); }
bool tryBind(const float& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedDecimal ) && impl->tryAny())); }
bool tryBind(const double& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedDecimal ) && impl->tryAny())); }
bool tryBind( float&& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedDecimal ) && impl->tryAny())); }
bool tryBind( double&& n) { return Q_LIKELY(impl) && (impl->tryBind(n) || (handleError(qBindExpectedDecimal ) && impl->tryAny())); }
bool tryBind( QByteArray& v) { return Q_LIKELY(impl) && (impl->tryBind(v) || (handleError(qBindExpectedBytes ) && impl->tryAny())); }
bool tryBind(const QByteArray& v) { return Q_LIKELY(impl) && (impl->tryBind(v) || (handleError(qBindExpectedBytes ) && impl->tryAny())); }
bool tryBind( QByteArray&& v) { return Q_LIKELY(impl) && (impl->tryBind(v) || (handleError(qBindExpectedBytes ) && impl->tryAny())); }
bool tryBind( QVariant& v) { return Q_LIKELY(impl) && (impl->tryBind(v) || (handleError(qBindUnexpectedValue ) && impl->tryAny())); }
bool tryBind(const QVariant& v) { return Q_LIKELY(impl) && (impl->tryBind(v) || (handleError(qBindUnexpectedValue ) && impl->tryAny())); }
bool tryBind( QVariant&& v) { return Q_LIKELY(impl) && (impl->tryBind(v) || (handleError(qBindUnexpectedValue ) && impl->tryAny())); }
bool tryItem(QIdentifierLiteral n) { return Q_LIKELY(impl) && impl->tryItem(n); }
bool tryItem(QIdentifier& n) { return Q_LIKELY(impl) && impl->tryItem(n); }
bool tryItem( ) { return Q_LIKELY(impl) && impl->tryItem( ); }
bool tryOut ( ) { return Q_LIKELY(impl) && impl->tryOut ( ); }
template<typename T> bool tryBind(T&& t);
private:
template<class T> friend class QVal;
template<class T> friend class QSeq;
......@@ -599,7 +614,7 @@ struct QTransmogrifier {
};
template<class T>
bool QCur::tryBind(BindGeneric, T&& t) {
bool QCur::tryBind(T&& t) {
return QTransmogrifier<RemoveCvRef<T>>::zap(QValue(_unsafeCopy()),std::forward<T>(t)).isValid();
}
......@@ -817,7 +832,7 @@ struct QAbstractValueReader : public QAbstractValue
return handleError(qBindUnexpectedValue) && tryAny();
}
virtual bool tryBind(const QUtf8Data& k) { QUtf8Data r; if (tryBind(r) && k==r) return true; handleError(qBindExpectedConstant); return false; }
virtual bool tryBind(const QUtf8Data& k) { QUtf8Data r; if (tryBind(r) && k==r) return true; handleError(qBindExpectedConstant); return false; } // FIXME move to QCur or QVal since tryAny is unnecessary even if we return false to short-circuit further bind
virtual bool tryBind(const QString& k) { QString r; if (tryBind(r) && k==r) return true; handleError(qBindExpectedConstant); return false; }
virtual bool tryBind(const bool& k) { bool r; if (tryBind(r) && k==r) return true; handleError(qBindExpectedConstant); return false; }
virtual bool tryBind(const qint8& k) { qint8 r; if (tryBind(r) && k==r) return true; handleError(qBindExpectedConstant); return false; }
......
......@@ -140,31 +140,31 @@ protected:
==qMetaTypeId< QUtf8Data>()) { t = current()->value< QUtf8Data>(); return true; } return false; }
bool tryBind( QString& t) { if (current()->type()==qMetaTypeId< QString>()) { t = current()->value< QString>(); return true; } return false; }
bool tryBind( bool& t) { if (current()->type()==qMetaTypeId< bool>()) { t = current()->value< bool>(); return true; } return false; }
bool tryBind(QByteArray& t) { if (current()->type()==qMetaTypeId<QByteArray>()) { t = current()->value<QByteArray>(); return true; } handleError(qBindExpectedBytes ); return false; }
bool tryBind(QByteArray& t) { if (current()->type()==qMetaTypeId<QByteArray>()) { t = current()->value<QByteArray>(); return true; } return false; }
// Convert numerical types to strictly larger ones // TODO convert all compatible values
bool tryBind( qint8& t) { if (current()->type()==qMetaTypeId< qint8>()) { t = current()->value< qint8>(); return true; } handleError(qBindExpectedInteger ); return false; }
bool tryBind( qint8& t) { if (current()->type()==qMetaTypeId< qint8>()) { t = current()->value< qint8>(); return true; } return false; }
bool tryBind( qint16& t) { if (current()->type()==qMetaTypeId< qint8>()||
current()->type()==qMetaTypeId< qint16>()) { t = current()->value< qint16>(); return true; } handleError(qBindExpectedInteger ); return false; }
current()->type()==qMetaTypeId< qint16>()) { t = current()->value< qint16>(); return true; } return false; }
bool tryBind( qint32& t) { if (current()->type()==qMetaTypeId< qint8>()||
current()->type()==qMetaTypeId< qint16>()||
current()->type()==qMetaTypeId< qint32>()) { t = current()->value< qint32>(); return true; } handleError(qBindExpectedInteger ); return false; }
current()->type()==qMetaTypeId< qint32>()) { t = current()->value< qint32>(); return true; } return false; }
bool tryBind( qint64& t) { if (current()->type()==qMetaTypeId< qint8>()||
current()->type()==qMetaTypeId< qint16>()||
current()->type()==qMetaTypeId< qint32>()||
current()->type()==qMetaTypeId< qint64>()) { t = current()->value< qint64>(); return true; } handleError(qBindExpectedInteger ); return false; }
bool tryBind( quint8& t) { if (current()->type()==qMetaTypeId< quint8>()) { t = current()->value< quint8>(); return true; } handleError(qBindExpectedPositiveInteger); return false; }
current()->type()==qMetaTypeId< qint64>()) { t = current()->value< qint64>(); return true; } return false; }
bool tryBind( quint8& t) { if (current()->type()==qMetaTypeId< quint8>()) { t = current()->value< quint8>(); return true; } return false; }
bool tryBind( quint16& t) { if (current()->type()==qMetaTypeId< quint8>()||
current()->type()==qMetaTypeId< quint16>()) { t = current()->value< quint16>(); return true; } handleError(qBindExpectedPositiveInteger); return false; }
current()->type()==qMetaTypeId< quint16>()) { t = current()->value< quint16>(); return true; } return false; }
bool tryBind( quint32& t) { if (current()->type()==qMetaTypeId< quint8>()||
current()->type()==qMetaTypeId< quint16>()||
current()->type()==qMetaTypeId< quint32>()) { t = current()->value< quint32>(); return true; } handleError(qBindExpectedPositiveInteger); return false; }
current()->type()==qMetaTypeId< quint32>()) { t = current()->value< quint32>(); return true; } return false; }
bool tryBind( quint64& t) { if (current()->type()==qMetaTypeId< quint8>()||
current()->type()==qMetaTypeId< quint16>()||
current()->type()==qMetaTypeId< quint32>()||
current()->type()==qMetaTypeId< quint64>()) { t = current()->value< quint64>(); return true; } handleError(qBindExpectedPositiveInteger); return false; }
bool tryBind( float& t) { if (current()->type()==qMetaTypeId< float>()) { t = current()->value< float>(); return true; } handleError(qBindExpectedDecimal ); return false; }
current()->type()==qMetaTypeId< quint64>()) { t = current()->value< quint64>(); return true; } return false; }
bool tryBind( float& t) { if (current()->type()==qMetaTypeId< float>()) { t = current()->value< float>(); return true; } return false; }
bool tryBind( double& t) { if (current()->type()==qMetaTypeId< float>()||
current()->type()==qMetaTypeId< double>()) { t = current()->value< double>(); return true; } handleError(qBindExpectedDecimal ); return false; }
current()->type()==qMetaTypeId< double>()) { t = current()->value< double>(); return true; } return false; }
bool trySequence(quint32* =nullptr) { if (current()->type()==QVariant::List ) { levels.push(Level()); return true; } return false; }
bool tryRecord (quint32* =nullptr) { if (current()->type()==QVariant::Map ) { levels.push(Level()); return true; } return false; }
......
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