Commit 15204fb8 authored by EXT Arnaud Clère's avatar EXT Arnaud Clère

WIP: trigger qBindUnexpectedEnd when fluent interface is not used until

QValueEnd
parent fa1426e4
#include "QValue.h"
QIdentifierLiteral qBindUnexpectedValue ("UnexpectedValue" );
QIdentifierLiteral qBindUnexpectedEnd ("qBindUnexpectedEnd" );
QIdentifierLiteral qBindExpectedItem ("ExpectedItem" );
QIdentifierLiteral qBindExpectedNull ("ExpectedNull" );
......
This diff is collapsed.
......@@ -96,7 +96,7 @@ struct Person
.bind("phones" ,phones ) // recursive calls to QTransmogrifier will take care of that part
.bind("comments",comments)
.bind("children",children)
; // automagically closes opened record()
.out(); // not calling this would still automagically close opened record() but always trigger a qBindUnexpectedEnd to help write explicitly correct code
}
};
......@@ -416,13 +416,14 @@ int main(int argc, char *argv[])
STOP("QDebug",s)
START {
ba.resize(0);
TextWriter(&ba)
auto s = 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 {
......@@ -433,7 +434,7 @@ int main(int argc, char *argv[])
.bind(ascii)
.bind(false)
.bind(color)
;
.out();
}
STOP("Json",ba)
START {
......@@ -445,7 +446,7 @@ int main(int argc, char *argv[])
.bind(ascii)
.bind(false)
.bind(color)
;
.out();
}
STOP("Xml",ba)
START {
......@@ -456,7 +457,7 @@ int main(int argc, char *argv[])
.bind(ascii)
.bind(false)
.bind(color)
;
.out();
}
STOP("Variant",Text(v).utf8())
START {
......@@ -467,7 +468,7 @@ int main(int argc, char *argv[])
.bind(ascii)
.bind(false)
.bind(color)
;
.out();
}
STOP("Cbor",ba.toHex())
START {
......@@ -498,7 +499,7 @@ int main(int argc, char *argv[])
.bind(ascii)
.bind(false)
.bind(color)
;
.out();
}
STOP("Data",b.buffer().toHex())
START {
......
......@@ -30,7 +30,7 @@ Person> |=================================================================
QDebug |Person("John", "Doe", 1.75, 18, QVector(), "unicode is likely U+01 \u0001 + U+1F \u001F + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ", ())
Text |(Person) names:[ John Doe] height:1.75 age:18 phones:[] comments:unicode is likely U+01  + U+1F  + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ children:[]
Json |{"names":["John","Doe"],"height":1.75,"age":18,"phones":[],"comments":"unicode is likely U+01 \u0001 + U+1F \u001F + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ","children":[]}
Xml |<Person><names><string>John</string><string>Doe</string></names><height>1.75</height><age>18</age><phones/><comments>unicode is likely U+01 + U+1F + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ</comments><children/></Person>
Xml |<Person><names><string>John</string><string>Doe</string></names><height>1.75</height><age>18</age><phones/><comments>unicode is likely U+01 + U+1F + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ</comments></Person>
Variant | age:18 children:[] comments:unicode is likely U+01  + U+1F  + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ height:1.75 names:[ John Doe] phones:[]
Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765126670686f6e65738068636f6d6d656e74737843756e69636f6465206973206c696b656c7920552b30312001202b20552b3146201f202b20552b413420c2a420552b423020c2b020552b443820c39820552b464620c3bf686368696c6472656e80ff
QCborStream |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765126670686f6e65738068636f6d6d656e74737843756e69636f6465206973206c696b656c7920552b30312001202b20552b3146201f202b20552b413420c2a420552b423020c2b020552b443820c39820552b464620c3bf686368696c6472656e80ff
......@@ -64,7 +64,7 @@ JsonValue>P |(Person) names:[ John Doe] height:1.75 age:-1 phones:[] comments:
Json>JsonValue|{"age":-1,"children":[],"comments":"","height":1.7500000000000004,"names":["John","Doe"],"phones":[]} |
Json>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fa3fe0000063616765206670686f6e65739fff68636f6d6d656e747360686368696c6472656e9fffff
Person<>Cbor |================================================================================
Cbor>P |(Person) names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[] |
Cbor>P |(Person) names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[] | at index:41 commentsIgnoredItem
P>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765206670686f6e65738068636f6d6d656e747360686368696c6472656e80ff
Cbor>P |(Person) names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[] |
QCborStream>P |(Person) names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[] | true
......@@ -75,5 +75,5 @@ CborValue>Cbor|a6656e616d657382644a6f686e63446f6566686569676874fb3ffc00000000000
Cbor>Json |{"names":["John","Doe"],"height":1.75,"age":undefined} |
Person<>Settings|================================================================================
P>Settings |(Person) names:[ John Doe] height:1.75 age:18 phones:[] comments:unicode is likely U+01  + U+1F  + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ children:[]
Settings>P |(Person) names:[ John Doe] height:1.75 age:18 phones:[] comments:unicode is likely U+01  + U+1F  + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ children:[] |
Settings>P |(Person) names:[ John Doe] height:1.75 age:18 phones:[] comments:unicode is likely U+01  + U+1F  + U+A4 ¤ U+B0 ° U+D8 Ø U+FF ÿ children:[] | /-1/namesIgnoredItem
P>Settings |QBind
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