...
 
Commits (2)
......@@ -48,6 +48,12 @@
// //////////////////////////////////////////////////////////////////////////
// QSettings* support for the fixed set of QSettingsWriter's BindNative types
// Compatibility notes:
// TODO Add QSize, QRect, QPoint for QSettings::IniFormat special string representations. See https://code.woboq.org/qt5/qtbase/src/corelib/io/qsettings.cpp.html#430
// QPolygon special mac handling should be ok by default since it is a list of points. See https://code.woboq.org/qt5/qtbase/src/corelib/io/qsettings_mac.cpp.html#121
// QMap multiple entries should be ok by default on Mac when QMap is actually handled as a sequence of {key,value}. See https://code.woboq.org/qt5/qtbase/src/corelib/io/qsettings_mac.cpp.html#126
// Windows MULTI_SZ support is easy to read but trickier to optimize at write time since generic a sequence() can only use MULTI_SZ iff all values do not contain '\0'. See https://code.woboq.org/qt5/qtbase/src/corelib/io/qsettings_win.cpp.html#673
class QSettingsWriter : public QAbstractValueWriter
{
Q_DISABLE_COPY(QSettingsWriter)
......
......@@ -422,14 +422,13 @@ int main(int argc, char *argv[])
STOP("QDebug",s)
START {
ba.resize(0);
auto s = TextWriter(&ba)
TextWriter(&ba)
<< 1.333333333333f
<< PI
<< ascii
<< false
<< color
;
s.out(); // to prevent the Q_ASSERT triggered by the implicit sequence() started by the first <<
}
STOP("Text",b.buffer())
START {
......@@ -446,7 +445,9 @@ int main(int argc, char *argv[])
START {
ba.resize(0);
QXmlStreamWriter w(&ba);
QXmlWriter(&w).sequence()
QXmlWriter x(&w);
// TODO x.setErrorHandler([](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)
.bind(ascii)
......