Commit cebbddff authored by EXT Arnaud Clère's avatar EXT Arnaud Clère

Renamed errorHandler > errorFilter (it does not handle errors but select

those that ought to be handled)
parent 0cf044d6
......@@ -200,7 +200,7 @@ protected:
bool tryBind ( bool&& b) { set(QCborValue( b )); return true; }
bool tryBind ( float&& d) { set(QCborValue(double(d))); return true; }
bool tryBind ( double&& d) { set(QCborValue( d )); return true; }
bool tryBind ( quint64&& n) { if (quint64(std::numeric_limits<qint64>::max())<n) { handleError(qBindExpectedSmallerNumber); return false; }
bool tryBind ( quint64&& n) { if (quint64(std::numeric_limits<qint64>::max())<n) { isErrorFiltered(qBindExpectedSmallerNumber); return false; }
set(QCborValue(qint64(n))); return true; }
bool tryBind ( qint64&& n) { set(QCborValue( n )); return true; }
bool tryBind ( QByteArray&& s) { set(QCborValue( s )); return true; }
......@@ -255,11 +255,11 @@ protected:
bool tryBind ( QUtf8Data& u) { QString s; if (tryBind(s) ) { u = s .toUtf8 (); return true; } return false; }
bool tryBind ( QString& v) { if (current().isString ()) { v = current().toString (); return true; } return false; }
bool tryBind ( bool& v) { if (current().isBool ()) { v = current().toBool (); return true; } return false; }
bool tryBind ( qint64& t) { if (current().isInteger ()) { t = current().toInteger (); return true; } handleError(qBindExpectedInteger ); return false; }
bool tryBind ( qint64& t) { if (current().isInteger ()) { t = current().toInteger (); return true; } isErrorFiltered(qBindExpectedInteger ); return false; }
bool tryBind ( quint64& t) { qint64 i; if (tryBind(i) ) { t = quint64(i) ; return true; } return false; }
bool tryBind ( float& v) { double d; if (tryBind(d) ) { v = float(d) ; return true; } return false; }
bool tryBind ( double& v) { if (current().isDouble ()) { v = current().toDouble (); return true; } handleError(qBindExpectedDecimal ); return false; }
bool tryBind ( QByteArray& v) { QString s; if (current().isByteArray()) { v = current().toByteArray(); return true; } handleError(qBindExpectedBytes ); return false; }
bool tryBind ( double& v) { if (current().isDouble ()) { v = current().toDouble (); return true; } isErrorFiltered(qBindExpectedDecimal ); return false; }
bool tryBind ( QByteArray& v) { QString s; if (current().isByteArray()) { v = current().toByteArray(); return true; } isErrorFiltered(qBindExpectedBytes ); return false; }
bool tryItem(QIdentifierLiteral u) { steps.last().key=u; return !(steps.last().item = current(1).toMap().value(steps.last().key.latin1())).isUndefined(); }
bool tryItem(QIdentifier& k) { steps.last().key=k; return !(steps.last().item = current(1).toMap().value(steps.last().key.latin1())).isUndefined(); }
......@@ -268,7 +268,7 @@ protected:
bool tryAny() { return true; }
bool isValid() const noexcept { return cbor; }
bool handleError(QIdentifierLiteral e, QString context = QString()) const { return errorHandler ? errorHandler(e, QString(currentPath().latin1()).append(context)) : false; }
bool isErrorFiltered(QIdentifierLiteral e, QString context = QString()) const { return errorFilter ? errorFilter(e, QString(currentPath().latin1()).append(context)) : false; }
private:
const QCborValue& current(int outer=0) const { Q_ASSERT(0<=outer); return steps.size()-outer <= 0 ? *cbor : steps[steps.size()-outer-1].item; }
......@@ -314,7 +314,7 @@ protected:
if (!s.isEmpty()) {
s.resize(0);
}
return handleError(qBindIgnoredBytes);
return isErrorFiltered(qBindIgnoredBytes);
}
return true;
} else { return false; } }
......@@ -330,10 +330,10 @@ protected:
if (!s.isEmpty()) {
s.resize(0);
}
return handleError(qBindIgnoredBytes);
return isErrorFiltered(qBindIgnoredBytes);
}
return true;
} else { handleError(qBindExpectedBytes); return false; } }
} else { isErrorFiltered(qBindExpectedBytes); return false; } }
bool tryBind ( bool& b) { if (caching) { return caching->tryBind(b) && cacheOut(); }
skipTag(); if (isBool()) {
b=toBool();
......@@ -344,7 +344,7 @@ protected:
bool tryBind ( float& n) { double d;
if (!tryBind(d)) { return false; }
if (d<double(std::numeric_limits<float>::min()) ||
double(std::numeric_limits<float>::max()) <d) { handleError(qBindExpectedSmallerNumber); return false; }
double(std::numeric_limits<float>::max()) <d) { isErrorFiltered(qBindExpectedSmallerNumber); return false; }
n=float(d); return true; }
bool tryBind ( quint64& t) { if (caching) { return caching->tryBind(t) && cacheOut(); }
......@@ -354,8 +354,8 @@ protected:
bool tryBind ( qint64& t) { if (caching) { return caching->tryBind(t) && cacheOut(); }
quint64 i; bool neg;
if (!getInteger(i,neg)) { return false; }
if ( neg ) { if (-quint64(std::numeric_limits<qint64>::max())-1<i) { handleError(qBindExpectedSmallerNumber); return false; } t=-qint64(i); return true; }
else { if ( quint64(std::numeric_limits<qint64>::max()) <i) { handleError(qBindExpectedSmallerNumber); return false; } t= qint64(i); return true; }
if ( neg ) { if (-quint64(std::numeric_limits<qint64>::max())-1<i) { isErrorFiltered(qBindExpectedSmallerNumber); return false; } t=-qint64(i); return true; }
else { if ( quint64(std::numeric_limits<qint64>::max()) <i) { isErrorFiltered(qBindExpectedSmallerNumber); return false; } t= qint64(i); return true; }
}
bool tryItem( QIdentifierLiteral u) { if (caching) { return caching->tryItem(u); }
......@@ -419,19 +419,19 @@ protected:
return leaveContainer(); }
bool isValid() const noexcept { return const_cast<QCborReader*>(this)->lastError()==QCborError::NoError; }
bool handleError(QIdentifierLiteral e, QString context = QString()) const { return errorHandler && errorHandler(e, QString("at %1 ").arg(currentOffset()).append(context)); }
bool isErrorFiltered(QIdentifierLiteral e, QString context = QString()) const { return errorFilter && errorFilter(e, QString("at %1 ").arg(currentOffset()).append(context)); }
private:
void skipTag() { if (isTag()) next(); }
bool getNumber(double& d) { skipTag();
if (isFloat16()) { d = double(toFloat16()); return next(); }
if (isFloat ()) { d = double(toFloat ()); return next(); }
if (isDouble ()) { d = toDouble () ; return next(); }
handleError(qBindExpectedDecimal); return false;
isErrorFiltered(qBindExpectedDecimal); return false;
}
bool getInteger(quint64&i, bool& isNegative) { skipTag();
if (isNegativeInteger()) { i = quint64(toNegativeInteger()); isNegative = true ; return next(); }
if (isUnsignedInteger()) { i = toUnsignedInteger() ; isNegative = false; return next(); }
handleError(qBindExpectedInteger); return false;
isErrorFiltered(qBindExpectedInteger); return false;
}
bool cacheOut() { if (!cacheLevel) {
......
......@@ -128,7 +128,7 @@ protected:
bool tryBind ( qint64& t) { double d; if (tryBind(d) ) { t = qint64(d) ; return true; } return false; }
bool tryBind ( quint64& t) { double d; if (tryBind(d) ) { t = quint64(d) ; return true; } return false; }
bool tryBind ( float& v) { double d; if (tryBind(d) ) { v = float(d) ; return true; } return false; }
bool tryBind ( double& v) { if (current().isDouble()) { v = current().toDouble(); return true; } handleError(qBindExpectedDecimal ); return false; }
bool tryBind ( double& v) { if (current().isDouble()) { v = current().toDouble(); return true; } isErrorFiltered(qBindExpectedDecimal ); return false; }
bool tryItem(QIdentifierLiteral u) { steps.last().key=u; return !(steps.last().item = current(1).toObject().value(steps.last().key.latin1())).isUndefined(); }
bool tryItem(QIdentifier& k) { steps.last().key=k; return !(steps.last().item = current(1).toObject().value(steps.last().key.latin1())).isUndefined(); }
......@@ -137,7 +137,7 @@ protected:
bool tryAny() { return true; }
bool isValid() const noexcept { return true; }
bool handleError(QIdentifierLiteral e, QString context = QString()) const { return errorHandler ? errorHandler(e, QString(currentPath().latin1()).append(context)) : false; }
bool isErrorFiltered(QIdentifierLiteral e, QString context = QString()) const { return errorFilter ? errorFilter(e, QString(currentPath().latin1()).append(context)) : false; }
private:
const QJsonValue& current(int outer=0) const { Q_ASSERT(0<=outer && json); return steps.size()-outer <= 0 ? *json : steps[steps.size()-outer-1].item; }
......@@ -171,7 +171,7 @@ protected:
bool trySequence(quint32* s=nullptr) { Q_UNUSED(s); levels.push(Step{"","]"}); return putChar('['); }
bool tryRecord (quint32* s=nullptr) { Q_UNUSED(s); levels.push(Step{"","}"}); return putChar('{'); }
bool tryAny ( ) { return write("undefined"); } // TODO || (isStrictJson && handleError(qBindUnexpectedValue) && write("null");
bool tryAny ( ) { return write("undefined"); } // TODO || (isStrictJson && isErrorFiltered(qBindUnexpectedValue) && write("null");
bool tryNull ( ) { return write("null"); }
bool tryBind ( QUtf8DataView u) { return putString(u.data(), u.size()); }
// JSON literals
......@@ -291,7 +291,7 @@ protected:
bool tryBind ( float& n) { if (caching) { return caching->tryBind(n) && cacheOut(); }
if (getNumber()==None) return false; // already reported qBindExpectedDecimal
if (d<double( std::numeric_limits<float >::min())||
double( std::numeric_limits<float >::max())<d) { handleError(qBindExpectedSmallerNumber); return false; }
double( std::numeric_limits<float >::max())<d) { isErrorFiltered(qBindExpectedSmallerNumber); return false; }
n = float(d); cachedNumber=None; return true; }
bool tryBind ( double& n) { if (caching) { return caching->tryBind(n) && cacheOut(); }
if (getNumber()==None) return false; // already reported qBindExpectedDecimal
......@@ -299,7 +299,7 @@ protected:
bool tryBind ( quint64& 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) { isErrorFiltered(qBindExpectedInteger); return false; }
if (neg) { return false; }
t = i ; cachedNumber=None; return true; }
bool tryBind ( qint64& t) { if (caching) { return caching->tryBind(t) && cacheOut(); }
......@@ -308,7 +308,7 @@ protected:
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; }
isErrorFiltered(qBindExpectedSmallerNumber); return false; }
bool tryBind ( QVariant& dst) { if (caching) { return caching->tryBind(dst) && cacheOut(); }
{
QSuspendedValueErrorHandler(this);
......@@ -330,7 +330,7 @@ protected:
}
if (tryNull()) { dst = QVariant::fromValue(nullptr); return true; }
}
return handleError(qBindUnexpectedValue) && tryAny();
return isErrorFiltered(qBindUnexpectedValue) && tryAny();
}
bool tryOut ( ) { if (caching) { bool out = caching->tryOut(); if (out) { cacheLevel--; cacheOut(); } return out; }
......@@ -345,7 +345,7 @@ protected:
if (levels.last().cachedItems. contains(QIdentifier(u))) { // must be checked before we consume tryItem(s)
cachedValue = levels.last().cachedItems.take(QIdentifier(u));
cacheReader.reset(&cachedValue);
cacheReader.setErrorHandler(errorHandler);
cacheReader.setErrorFilter(errorFilter);
Q_ASSERT(!cacheLevel);
caching = &cacheReader; // let outer QCur drive QJsonReader depending on bound T
return true;
......@@ -359,7 +359,7 @@ protected:
else { // read cachedValue using a dedicated QCur and QTransmogrifier<QValue> accepting value of any 'shape' (outer QTransmogrifier is specialized on outer T which is not usually generic enough)
cachedValue = QJsonValue();
cacheWriter.reset(&cachedValue);
cacheWriter.setErrorHandler(errorHandler);
cacheWriter.setErrorFilter(errorFilter);
if (!QCur(this).value().bind(QCur(&cacheWriter).value())) {
return false;
}
......@@ -388,7 +388,7 @@ protected:
return true; }
bool isValid() const noexcept { return io; }
bool handleError(QIdentifierLiteral e, QString context = QString()) const { return errorHandler ? errorHandler(e, QString("at %1:%2 ").arg(line).arg(column).append(context)) : false; }
bool isErrorFiltered(QIdentifierLiteral e, QString context = QString()) const { return errorFilter ? errorFilter(e, QString("at %1:%2 ").arg(line).arg(column).append(context)) : false; }
private:
CachedNumber getNumber() {
if (cachedNumber!=None) return cachedNumber;
......@@ -396,7 +396,7 @@ private:
neg = get('-', "[{\"ntf-0123456789.");
qint8 digit;
if ((digit = getDigit()) < 0) {
handleError(qBindExpectedDecimal);
isErrorFiltered(qBindExpectedDecimal);
return None; // do not accept no digit otherwise we may accept an empty mantissa or string!
}
cachedNumber=Integer;
......@@ -491,7 +491,7 @@ private:
while (!(nextChar() == expected || strchr(validChars, nextChar()) || nextChar() == '\0')) {
char ignored = getChar();
if (!isspace(ignored)) {
if (!handleError(qBindIgnoredCharacter)) {
if (!isErrorFiltered(qBindIgnoredCharacter)) {
return false;
}
}
......
......@@ -305,7 +305,7 @@ protected:
row++; col=0;
return true;
}
handleError(qBindIgnoredItem);
isErrorFiltered(qBindIgnoredItem);
return false;
}
return true;
......@@ -320,7 +320,7 @@ protected:
row=0; col++;
return true;
}
handleError(qBindIgnoredItem);
isErrorFiltered(qBindIgnoredItem);
return false;
}
return true;
......@@ -350,7 +350,7 @@ protected:
else {
col=columnNames.indexOf(n.utf8());
// TODO if (max(dimension())<=col) col=-1;
if (col<0 && !handleError(qBindIgnoredItem)) {
if (col<0 && !isErrorFiltered(qBindIgnoredItem)) {
return false;
}
}
......@@ -368,7 +368,7 @@ protected:
}
else {
// TODO if (rowNames...
return handleError(qBindIgnoredItemName);
return isErrorFiltered(qBindIgnoredItemName);
}
}
else { Q_ASSERT(I<=d);
......@@ -500,7 +500,7 @@ protected:
if (col < m->columnCount()) {
return true;
}
handleError(qBindIgnoredItem);
isErrorFiltered(qBindIgnoredItem);
return false;
}
return true;
......@@ -518,7 +518,7 @@ protected:
row=0; col++;
return true;
}
handleError(qBindIgnoredItem);
isErrorFiltered(qBindIgnoredItem);
return false;
}
return true;
......@@ -550,7 +550,7 @@ protected:
col=columnNames.indexOf(n.utf8());
}
// TODO if (max(dimension())<=col) col=-1;
if (col<0 && !handleError(qBindIgnoredItem)) {
if (col<0 && !isErrorFiltered(qBindIgnoredItem)) {
return false;
}
return true;
......@@ -564,7 +564,7 @@ protected:
}
else if (n!=childrenName) {
// TODO if (rowNames...
return handleError(qBindIgnoredItemName);
return isErrorFiltered(qBindIgnoredItemName);
}
else { return true; }
}
......@@ -596,12 +596,12 @@ protected:
// TODO QDate*, QTime
// TODO QPixmap if metadata suggests a QMimeData image ?
virtual bool tryBind( qint8& n) { qint64 l; if (!tryBind(l)) return false; if (l<std::numeric_limits< qint8>::min() || std::numeric_limits< qint8>::max()<l) { handleError(qBindExpectedSmallerNumber); return false; } n= qint8(l); return true; }
virtual bool tryBind( quint8& n) { quint64 l; if (!tryBind(l)) return false; if ( std::numeric_limits< quint8>::max()<l) { handleError(qBindExpectedSmallerNumber); return false; } n= quint8(l); return true; }
virtual bool tryBind( qint16& n) { qint64 l; if (!tryBind(l)) return false; if (l<std::numeric_limits< qint16>::min() || std::numeric_limits< qint16>::max()<l) { handleError(qBindExpectedSmallerNumber); return false; } n= qint16(l); return true; }
virtual bool tryBind( quint16& n) { quint64 l; if (!tryBind(l)) return false; if ( std::numeric_limits<quint16>::max()<l) { handleError(qBindExpectedSmallerNumber); return false; } n=quint16(l); return true; }
virtual bool tryBind( qint32& n) { qint64 l; if (!tryBind(l)) return false; if (l<std::numeric_limits< qint32>::min() || std::numeric_limits< qint32>::max()<l) { handleError(qBindExpectedSmallerNumber); return false; } n= qint32(l); return true; }
virtual bool tryBind( quint32& n) { quint64 l; if (!tryBind(l)) return false; if ( std::numeric_limits<quint32>::max()<l) { handleError(qBindExpectedSmallerNumber); return false; } n=quint32(l); return true; }
virtual bool tryBind( qint8& n) { qint64 l; if (!tryBind(l)) return false; if (l<std::numeric_limits< qint8>::min() || std::numeric_limits< qint8>::max()<l) { isErrorFiltered(qBindExpectedSmallerNumber); return false; } n= qint8(l); return true; }
virtual bool tryBind( quint8& n) { quint64 l; if (!tryBind(l)) return false; if ( std::numeric_limits< quint8>::max()<l) { isErrorFiltered(qBindExpectedSmallerNumber); return false; } n= quint8(l); return true; }
virtual bool tryBind( qint16& n) { qint64 l; if (!tryBind(l)) return false; if (l<std::numeric_limits< qint16>::min() || std::numeric_limits< qint16>::max()<l) { isErrorFiltered(qBindExpectedSmallerNumber); return false; } n= qint16(l); return true; }
virtual bool tryBind( quint16& n) { quint64 l; if (!tryBind(l)) return false; if ( std::numeric_limits<quint16>::max()<l) { isErrorFiltered(qBindExpectedSmallerNumber); return false; } n=quint16(l); return true; }
virtual bool tryBind( qint32& n) { qint64 l; if (!tryBind(l)) return false; if (l<std::numeric_limits< qint32>::min() || std::numeric_limits< qint32>::max()<l) { isErrorFiltered(qBindExpectedSmallerNumber); return false; } n= qint32(l); return true; }
virtual bool tryBind( quint32& n) { quint64 l; if (!tryBind(l)) return false; if ( std::numeric_limits<quint32>::max()<l) { isErrorFiltered(qBindExpectedSmallerNumber); return false; } n=quint32(l); return true; }
virtual bool tryBind( QUtf8Data& r) { if (hidden()) return true; if (I<=d) return itemBind()->tryBind(r); QVariant v=read(); if (v.type()!=QVariant ::String ) return false; r=QUtf8Data(v.toString().toUtf8()); return true; }
virtual bool tryBind( QString& r) { if (hidden()) return true; if (I<=d) return itemBind()->tryBind(r); QVariant v=read(); if (v.type()!=QVariant ::String ) return false; r= v.toString () ; return true; }
......@@ -619,7 +619,7 @@ protected:
QString path(QModelIndex current) const {
return current.isValid() ? path(current.parent())+QString("/%1,%2").arg(current.row()).arg(current.column()) : "";
}
bool handleError(QIdentifierLiteral e, QString context = QString()) const { return errorHandler ? errorHandler(e, QString("at %1 %2").arg(path(parent)).arg(context)) : false; }
bool isErrorFiltered(QIdentifierLiteral e, QString context = QString()) const { return errorFilter ? errorFilter(e, QString("at %1 %2").arg(path(parent)).arg(context)) : false; }
QBuffer io;
TItemReader r;
......
......@@ -148,7 +148,7 @@ 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)); }
bool isErrorFiltered(QIdentifierLiteral e, QString context = QString()) const { return errorFilter && errorFilter(e, QString("at %1 %2").arg(currentPath(), context)); }
private:
template<typename T>
bool set(T& t) { QVariant v = settings->value(key()); if (v.convert(qMetaTypeId<T>())) { t = v.value<T>(); return true; } return false; }
......
This diff is collapsed.
......@@ -134,7 +134,7 @@ protected:
// TODO Support _meta to be able to cache and restitute all metadata as well as data+datatype
template<typename T>
bool tryBind(T& t) { if (current()->type()==qMetaTypeId<T>()) { t = current()->value<T>(); return true; } handleError(QIdentifierLiteral("ExpectedDeclaredMetatypeT")); return false; }
bool tryBind(T& t) { if (current()->type()==qMetaTypeId<T>()) { t = current()->value<T>(); return true; } isErrorFiltered(QIdentifierLiteral("ExpectedDeclaredMetatypeT")); return false; }
bool tryBind( QUtf8Data& t) { if (current()->userType() // TODO ->type() if QUtf8Data lands into Qt
==qMetaTypeId< QUtf8Data>()) { t = current()->value< QUtf8Data>(); return true; } return false; }
......@@ -177,7 +177,7 @@ protected:
bool tryAny () { return true; }
bool isValid() const noexcept { return value; }
bool handleError(QIdentifierLiteral e, QString context = QString()) const { return errorHandler ? errorHandler(e, QString(currentPath().latin1()).append(context)) : false; }
bool isErrorFiltered(QIdentifierLiteral e, QString context = QString()) const { return errorFilter ? errorFilter(e, QString(currentPath().latin1()).append(context)) : false; }
private:
const QVariant* current(unsigned outer=0) const { return unsigned(levels.size())-outer <= 0 ? value : &(levels[unsigned(levels.size())-outer-1].item); }
......
......@@ -86,7 +86,7 @@ protected:
bool tryBind ( double&& n) { static QString s; s.setNum( n ,'g',std::numeric_limits<double>::max_digits10); writeText("decimal" , s); return true; } // with specific precision
bool tryBind ( QByteArray&& s) { QString h; h.reserve(s.size()*2+2+1); h.append("0x").append(s.toHex().toUpper()) ; writeText("hexBinary", h); return true; }
bool isValid() const noexcept { return !io->hasError() || handleError(qBindUnexpectedEnd, io->device()->errorString()); }
bool isValid() const noexcept { return !io->hasError() || isErrorFiltered(qBindUnexpectedEnd, io->device()->errorString()); }
bool tryOut () { io->writeEndElement(); return true; }
bool tryItem() { return true; }
......
......@@ -267,7 +267,7 @@ struct QTransmogrifier<QColor> {
do {
v=v.meta(n, m);
if (n==qmDataStreamVersion) {
if (m.utf8().toInt()<7) { v->handleError("UnsupportedQDataStreamVersion");
if (m.utf8().toInt()<7) { v->isErrorFiltered("UnsupportedQDataStreamVersion");
return v.null();
}
QRgba64 c64 = c.rgba64();
......@@ -445,7 +445,7 @@ int main(int argc, char *argv[])
ba.resize(0);
QXmlStreamWriter w(&ba);
QXmlWriter x(&w);
// TODO x.setErrorHandler([](QIdentifierLiteral error, QString context){ return error == qBindUnexpectedEnd ? true : false; }); // to trigger a Q_ASSERT if .out() is forgotten
// TODO x.setErrorFilter([](QIdentifierLiteral error, QString context){ return error == qBindUnexpectedEnd ? true : false; }); // to trigger a Q_ASSERT if .out() is forgotten
x.sequence()
.bind(1.333333333333f)
.bind(PI)
......@@ -878,7 +878,7 @@ int main(int argc, char *argv[])
START {
json.seek(0); p = {}; errors.clear();
QJsonReader r(&json);
r.setErrorHandler(handler);
r.setErrorFilter(handler);
r.bind(p);
}
STOP("Json>P",Text(p).utf8()+" | "+errors.join(", "))
......@@ -890,7 +890,7 @@ int main(int argc, char *argv[])
START {
roundtrip.seek(0); p = {}; errors.clear();
QJsonReader r(&roundtrip);
r.setErrorHandler(handler);
r.setErrorFilter(handler);
r.bind(p);
}
STOP("Json>P",Text(p).utf8()+" | "+errors.join(", "))
......@@ -903,7 +903,7 @@ int main(int argc, char *argv[])
START {
p = {}; errors.clear();
QJsonVisitor r(&jv);
r.setErrorHandler(handler);
r.setErrorFilter(handler);
r.bind(p);
}
STOP("JsonValue>P",Text(p).utf8()+" | "+errors.join(", "))
......@@ -911,7 +911,7 @@ int main(int argc, char *argv[])
START {
roundtrip.seek(0); jv = QJsonValue(); errors.clear();
QJsonReader r(&roundtrip);
r.setErrorHandler(handler);
r.setErrorFilter(handler);
r.bind(jv);
}
STOP("Json>JsonValue",QJsonDocument(jv.toObject()).toJson(QJsonDocument::Compact)+" | "+errors.join(", "));
......@@ -923,7 +923,7 @@ int main(int argc, char *argv[])
START {
roundtrip.seek(0); ba.resize(0);
QJsonReader r(&roundtrip);
r.setErrorHandler(handler);
r.setErrorFilter(handler);
r.bind(QCborWriter(&ba).value());
}
STOP("Json>Cbor",ba.toHex())
......@@ -943,7 +943,7 @@ int main(int argc, char *argv[])
START {
cbor.seek(0); p = {}; errors.clear();
QCborReader r(&cbor);
r.setErrorHandler(handler);
r.setErrorFilter(handler);
r.bind(p);
}
STOP("Cbor>P",Text(p).utf8()+" | "+errors.join(", "))
......@@ -955,7 +955,7 @@ int main(int argc, char *argv[])
START {
roundtrip.seek(0); p = {}; errors.clear();
QCborReader r(&roundtrip);
r.setErrorHandler(handler);
r.setErrorFilter(handler);
r.bind(p);
}
STOP("Cbor>P",Text(p).utf8()+" | "+errors.join(", "))
......@@ -1058,7 +1058,7 @@ int main(int argc, char *argv[])
START {
p = {}; errors.clear();
QCborVisitor r(&cv);
r.setErrorHandler(handler);
r.setErrorFilter(handler);
r.bind(p);
}
STOP("CborValue>P",Text(p).utf8()+" | "+errors.join(", "))
......@@ -1066,7 +1066,7 @@ int main(int argc, char *argv[])
START {
roundtrip.seek(0); cv = QCborValue(); errors.clear();
QCborReader r(&roundtrip);
r.setErrorHandler(handler);
r.setErrorFilter(handler);
r.bind(cv);
}
STOP("Cbor>CborValue",cv.toDiagnosticNotation()+" | "+errors.join(", "));
......@@ -1079,7 +1079,7 @@ int main(int argc, char *argv[])
START {
roundtrip.seek(0); b.seek(0); b.buffer().resize(0); errors.clear();
QCborReader r(&roundtrip);
r.setErrorHandler(handler);
r.setErrorFilter(handler);
r.bind(QJsonWriter(&b).value());
}
STOP("Cbor>Json",b.buffer()+" | "+errors.join(", "))
......@@ -1098,7 +1098,7 @@ int main(int argc, char *argv[])
STOP("P>Settings",Text(person).utf8())
START {
QSettingsReader r(&nat); errors.clear();
r.setErrorHandler(handler);
r.setErrorFilter(handler);
r.bind(person);
}
STOP("Settings>P",Text(person).utf8()+" | "+errors.join(", "))
......@@ -1250,7 +1250,7 @@ void doGuiExample() {
QByteArray text;
if (0<=currentPersonsTab) {
QModelReader<> reader(personsTabs[currentPersonsTab].model);
reader.setErrorHandler(handler);
reader.setErrorFilter(handler);
personsTabs[currentPersonsTab].bind(reader.value());
TextWriter(&text).bind(errors.join("\n"));
text.append('\n');
......
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