Commit 51dab6dc authored by EXT Arnaud Clère's avatar EXT Arnaud Clère

minor changes

parent 9a5fc2a4
......@@ -539,7 +539,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; }
v->setErrorHandler(suspended);
if (!(r = v.null())) r.handleError("ExpectedBoolDoubleQStringQJsonArrayQJsonOnjectNull");
if (!(r = v.null())) r.handleError(qBindExpectedValue);
/**/ j = QJsonValue( ); return r;
}
else { Q_ASSERT_X(!v, Q_FUNC_INFO, "Unsupported v->mode()"); return v.null(); }
......
#include "QValue.h"
QIdentifierLiteral qBindExpectedValue ("ExpectedValue" );
QIdentifierLiteral qBindExpectedItem ("ExpectedItem" );
QIdentifierLiteral qBindExpectedNull ("ExpectedNull" );
QIdentifierLiteral qBindExpectedSequence ("ExpectedSequence" );
......
......@@ -52,23 +52,24 @@
// //////////////////////////////////////////////////////////////////////////
// Standard error names
extern QIdentifierLiteral qBindExpectedItem ;
extern QIdentifierLiteral qBindExpectedNull ;
extern QIdentifierLiteral qBindExpectedSequence ;
extern QIdentifierLiteral qBindExpectedRecord ;
extern QIdentifierLiteral qBindExpectedText ;
extern QIdentifierLiteral qBindExpectedBytes ;
extern QIdentifierLiteral qBindExpectedInteger ;
extern QIdentifierLiteral qBindExpectedDecimal ;
extern QIdentifierLiteral qBindExpectedSmallerNumber ;
extern QIdentifierLiteral qBindExpectedValue;
extern QIdentifierLiteral qBindExpectedItem;
extern QIdentifierLiteral qBindExpectedNull;
extern QIdentifierLiteral qBindExpectedSequence;
extern QIdentifierLiteral qBindExpectedRecord;
extern QIdentifierLiteral qBindExpectedText;
extern QIdentifierLiteral qBindExpectedBytes;
extern QIdentifierLiteral qBindExpectedInteger;
extern QIdentifierLiteral qBindExpectedDecimal;
extern QIdentifierLiteral qBindExpectedSmallerNumber;
extern QIdentifierLiteral qBindExpectedPositiveInteger;
extern QIdentifierLiteral qBindExpectedBoolean ;
extern QIdentifierLiteral qBindExpectedConstant ;
extern QIdentifierLiteral qBindExpectedBoolean;
extern QIdentifierLiteral qBindExpectedConstant;
extern QIdentifierLiteral qBindIgnoredItem ;
extern QIdentifierLiteral qBindIgnoredItemName ;
extern QIdentifierLiteral qBindIgnoredCharacter ;
extern QIdentifierLiteral qBindIgnoredBytes ;
extern QIdentifierLiteral qBindIgnoredItem;
extern QIdentifierLiteral qBindIgnoredItemName;
extern QIdentifierLiteral qBindIgnoredCharacter;
extern QIdentifierLiteral qBindIgnoredBytes;
// //////////////////////////////////////////////////////////////////////////
// Standard meta data names
......@@ -557,7 +558,7 @@ struct QAbstractValueWriter : public QAbstractValue
}
return tryOut();
}
if (src.canConvert<QVariantMap >() ) { // TODO _meta({{qmColumns,"key,value"}}) trySequence() ...
if (src.canConvert<QVariantMap >()) { // TODO _meta(qmColumns,"key,value") trySequence() ...
QAssociativeIterable ts = src.value<QAssociativeIterable>();
quint32 size=quint32(ts.size());
if (!tryRecord(&size)) {
......@@ -737,9 +738,9 @@ struct QAbstractValueReader : public QAbstractValue
QVariant v;
QByteArray bytes;
QString s; // matches any type with usually less encoding work than QUtf8Data (which only captures efficiently utf-8 whereas QChar easily captures Latin1 in addition to ASCII)
tryBind(b) || tryBind(d) || tryBind(i) || tryBind(u) || tryBind(v) || tryBind(bytes) || tryNull();
bool bound = tryBind(b) || tryBind(d) || tryBind(i) || tryBind(u) || tryBind(v) || tryBind(bytes) || tryNull();
setErrorHandler(suspended);
return true;
return bound || handleError(qBindExpectedValue);
}
QValueErrorHandler setErrorHandler(QValueErrorHandler newHandler = nullptr) { auto previousHandler = errorHandler; errorHandler = newHandler; return previousHandler; }
......@@ -1186,7 +1187,7 @@ struct QTransmogrifier<QValue> {
double d; if ((srcRes = src.bind( d))) { dst.bind( d); return srcRes; } //! \remark Double-precision floating point numeric types can only be handled if QAbstractValue refuses to lose leading digits or precision
// TODO Other BindNative types we do not want to treat as text: QDateTime, QUuid
src->setErrorHandler(suspended);
srcRes.handleError("ExpectedSequenceRecordNullTextBytesBooleanIntegerDecimal");
srcRes.handleError(qBindExpectedValue);
return srcRes;
}
else if (src->mode()==Write && dst->mode()==Read) { return zap(std::move(dst),std::move(src)); } // To return reader's QValueStatus instead of writer's QValueStatus since it should contain more information (mismatches, etc.)
......
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