Commit 6d7655c0 authored by EXT Arnaud Clère's avatar EXT Arnaud Clère

WIP: prepared QModelBind::mode()==Read

parent 12050ac7
......@@ -241,39 +241,39 @@ protected:
virtual bool _item(QIdentifierLiteral n) { QIdentifier id(n); return _item(id); }
virtual bool _bind( QUtf8DataView u) { return _bind(QString::fromUtf8(u.data(), u.size())); }
virtual bool _bind( const char* u) { return _bind(QString::fromUtf8(u)); } // required to match better than QString overloads
virtual bool _bind( const char* u) { return _bind(QString::fromUtf8 (u )); } // required to match better than QString overloads
virtual bool _bind( QUtf8DataView u) { return _bind(QString::fromUtf8 (u.data(), u.size())); }
virtual bool _bind( QAsciiDataView a) { return _bind(QString::fromLatin1(a.data(), a.size())); }
virtual bool _bind( QLatin1String l) { return _bind(QString(l)); }
virtual bool _bind( QStringView s) { return _bind(s.toString()); }
virtual bool _bind( QLatin1String l) { return _bind(QString(l) ); }
virtual bool _bind( QStringView s) { return _bind(s.toString() ); }
virtual bool _bind( QUtf8Data&& s) { return _bind(QString::fromUtf8(s.utf8())); }
virtual bool _bind( qint8&& n) { return _bind( qint64(n)); }
virtual bool _bind( quint8&& n) { return _bind(quint64(n)); }
virtual bool _bind( qint16&& n) { return _bind( qint64(n)); }
virtual bool _bind( quint16&& n) { return _bind(quint64(n)); }
virtual bool _bind( qint32&& n) { return _bind( qint64(n)); }
virtual bool _bind( quint32&& n) { return _bind(quint64(n)); }
virtual bool _bind( QByteArray&& s) { QString h; h.reserve(s.size()*2+2+1); h.append("0x").append(s.toHex()); return _bind(h); }
virtual bool _bind( qint8& n) { qint64 l; if (mode()==Write) { return _bind(std::move(l=n)); } else { if (!_bind(l)) return false; if (l<std::numeric_limits< qint8>::min() || std::numeric_limits< qint8>::max()<l) { _reportError(qBindExpectedSmallerNumber); return false; } n= qint8(l); return true; } }
virtual bool _bind( quint8& n) { quint64 l; if (mode()==Write) { return _bind(std::move(l=n)); } else { if (!_bind(l)) return false; if ( std::numeric_limits< quint8>::max()<l) { _reportError(qBindExpectedSmallerNumber); return false; } n= quint8(l); return true; } }
virtual bool _bind( qint16& n) { qint64 l; if (mode()==Write) { return _bind(std::move(l=n)); } else { if (!_bind(l)) return false; if (l<std::numeric_limits< qint16>::min() || std::numeric_limits< qint16>::max()<l) { _reportError(qBindExpectedSmallerNumber); return false; } n= qint16(l); return true; } }
virtual bool _bind( quint16& n) { quint64 l; if (mode()==Write) { return _bind(std::move(l=n)); } else { if (!_bind(l)) return false; if ( std::numeric_limits<quint16>::max()<l) { _reportError(qBindExpectedSmallerNumber); return false; } n=quint16(l); return true; } }
virtual bool _bind( qint32& n) { qint64 l; if (mode()==Write) { return _bind(std::move(l=n)); } else { if (!_bind(l)) return false; if (l<std::numeric_limits< qint32>::min() || std::numeric_limits< qint32>::max()<l) { _reportError(qBindExpectedSmallerNumber); return false; } n= qint32(l); return true; } }
virtual bool _bind( quint32& n) { quint64 l; if (mode()==Write) { return _bind(std::move(l=n)); } else { if (!_bind(l)) return false; if ( std::numeric_limits<quint32>::max()<l) { _reportError(qBindExpectedSmallerNumber); return false; } n=quint32(l); return true; } }
virtual bool _bind( QUtf8Data& r) { QUtf8Data copy; if (mode()==Write) { return _bind(std::move(copy=r)); } else { copy=QUtf8Data(read().toString().toUtf8()); return true; } }
virtual bool _bind( QString& r) { QString copy; if (mode()==Write) { return _bind(std::move(copy=r)); } else { copy= read().toString () ; return true; } }
virtual bool _bind( bool& r) { bool copy; if (mode()==Write) { return _bind(std::move(copy=r)); } else { copy= read().toBool () ; return true; } }
virtual bool _bind( qint64& r) { qint64 copy; if (mode()==Write) { return _bind(std::move(copy=r)); } else { copy= read().toLongLong () ; return true; } }
virtual bool _bind( quint64& r) { quint64 copy; if (mode()==Write) { return _bind(std::move(copy=r)); } else { copy= read().toULongLong () ; return true; } }
virtual bool _bind( float& r) { float copy; if (mode()==Write) { return _bind(std::move(copy=r)); } else { copy= read().toFloat () ; return true; } }
virtual bool _bind( double& r) { double copy; if (mode()==Write) { return _bind(std::move(copy=r)); } else { copy= read().toDouble () ; return true; } }
virtual bool _bind( QByteArray& r) { QByteArray copy; if (mode()==Write) { return _bind(std::move(copy=r)); } else { copy= read().toByteArray () ; return true; } }
virtual bool _bind( QVariant& r) { QVariant copy; if (mode()==Write) { return _bind(std::move(copy=r)); } else { copy= read() ; return true; } }
virtual bool _bind( QByteArray&& s) { return _bind(QString(s.size()*2+2+1, Qt::Uninitialized).append("0x").append(s.toHex())); }
virtual bool _bind( qint8&& n) { return _bind( qint64(n)); }
virtual bool _bind( quint8&& n) { return _bind( quint64(n)); }
virtual bool _bind( qint16&& n) { return _bind( qint64(n)); }
virtual bool _bind( quint16&& n) { return _bind( quint64(n)); }
virtual bool _bind( qint32&& n) { return _bind( qint64(n)); }
virtual bool _bind( quint32&& n) { return _bind( quint64(n)); }
virtual bool _bind( qint8& n) { if (mode()==Write) { return _bind( qint64(n)); } else { qint64 l; if (!_bind(l)) return false; if (l<std::numeric_limits< qint8>::min() || std::numeric_limits< qint8>::max()<l) { _reportError(qBindExpectedSmallerNumber); return false; } n= qint8(l); return true; } }
virtual bool _bind( quint8& n) { if (mode()==Write) { return _bind( quint64(n)); } else { quint64 l; if (!_bind(l)) return false; if ( std::numeric_limits< quint8>::max()<l) { _reportError(qBindExpectedSmallerNumber); return false; } n= quint8(l); return true; } }
virtual bool _bind( qint16& n) { if (mode()==Write) { return _bind( qint64(n)); } else { qint64 l; if (!_bind(l)) return false; if (l<std::numeric_limits< qint16>::min() || std::numeric_limits< qint16>::max()<l) { _reportError(qBindExpectedSmallerNumber); return false; } n= qint16(l); return true; } }
virtual bool _bind( quint16& n) { if (mode()==Write) { return _bind( quint64(n)); } else { quint64 l; if (!_bind(l)) return false; if ( std::numeric_limits<quint16>::max()<l) { _reportError(qBindExpectedSmallerNumber); return false; } n=quint16(l); return true; } }
virtual bool _bind( qint32& n) { if (mode()==Write) { return _bind( qint64(n)); } else { qint64 l; if (!_bind(l)) return false; if (l<std::numeric_limits< qint32>::min() || std::numeric_limits< qint32>::max()<l) { _reportError(qBindExpectedSmallerNumber); return false; } n= qint32(l); return true; } }
virtual bool _bind( quint32& n) { if (mode()==Write) { return _bind( quint64(n)); } else { quint64 l; if (!_bind(l)) return false; if ( std::numeric_limits<quint32>::max()<l) { _reportError(qBindExpectedSmallerNumber); return false; } n=quint32(l); return true; } }
virtual bool _bind( QUtf8Data& r) { if (mode()==Write) { return _bind( QUtf8Data(r)); } else { QVariant v=read(); if (v.type()!=QVariant ::String ) return false; r=QUtf8Data(read().toString().toUtf8()); return true; } }
virtual bool _bind( QString& r) { if (mode()==Write) { return _bind( QString(r)); } else { QVariant v=read(); if (v.type()!=QVariant ::String ) return false; r= read().toString () ; return true; } }
virtual bool _bind( bool& r) { if (mode()==Write) { return _bind( bool(r)); } else { QVariant v=read(); if (v.type()!=QVariant ::Bool ) return false; r= read().toBool () ; return true; } }
virtual bool _bind( qint64& r) { if (mode()==Write) { return _bind( qint64(r)); } else { QVariant v=read(); if (v.type()!=QVariant ::LongLong ) return false; r= read().toLongLong () ; return true; } }
virtual bool _bind( quint64& r) { if (mode()==Write) { return _bind( quint64(r)); } else { QVariant v=read(); if (v.type()!=QVariant ::ULongLong) return false; r= read().toULongLong () ; return true; } }
virtual bool _bind( float& r) { if (mode()==Write) { return _bind( float(r)); } else { QVariant v=read(); if (v.type()!=QMetaType::Float ) return false; r= read().toFloat () ; return true; } }
virtual bool _bind( double& r) { if (mode()==Write) { return _bind( double(r)); } else { QVariant v=read(); if (v.type()!=QVariant ::Double ) return false; r= read().toDouble () ; return true; } }
virtual bool _bind(QByteArray& r) { if (mode()==Write) { return _bind(QByteArray(r)); } else { QVariant v=read(); if (v.type()!=QVariant ::ByteArray) return false; r= read().toByteArray () ; return true; } }
virtual bool _bind( QVariant& r) { if (mode()==Write) { return _bind( QVariant(r)); } else { QVariant v=read(); r= read() ; return true; } }
virtual bool _bind(const QUtf8Data& r) { QUtf8Data copy(r); return _bind(std::move(copy)); }
virtual bool _bind(const QString& r) { QString copy(r); return _bind(std::move(copy)); }
......
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