Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
modmedLog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MODMED
modmedLog
Commits
02645b25
Commit
02645b25
authored
Aug 17, 2019
by
EXT Arnaud Clère
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed QJsonReader when !_item()
parent
205594e6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
12 deletions
+17
-12
tests/QBind/QBind_impl.h
tests/QBind/QBind_impl.h
+1
-1
tests/QBind/QJson_impl.h
tests/QBind/QJson_impl.h
+2
-2
tests/QBind/main.cpp
tests/QBind/main.cpp
+10
-5
tests/QBind/samples.txt
tests/QBind/samples.txt
+4
-4
No files found.
tests/QBind/QBind_impl.h
View file @
02645b25
...
@@ -859,7 +859,7 @@ TResult qbind(Val<TResult>&& v, T* t) {
...
@@ -859,7 +859,7 @@ TResult qbind(Val<TResult>&& v, T* t) {
auto
rw
=
v
->
mode
();
auto
rw
=
v
->
mode
();
auto
mo
=
T
::
staticMetaObject
;
auto
mo
=
T
::
staticMetaObject
;
auto
r
=
v
.
meta
(
qmName
,
QAsciiData
(
mo
.
className
())).
record
();
auto
r
=
v
.
meta
(
qmName
,
QAsciiData
(
mo
.
className
())).
record
();
for
(
int
i
=
0
;
i
<
mo
.
propertyCount
();
i
++
)
{
for
(
int
i
=
0
;
r
&&
i
<
mo
.
propertyCount
();
i
++
)
{
auto
p
=
mo
.
property
(
i
);
auto
p
=
mo
.
property
(
i
);
if
(
p
.
isStored
())
{
if
(
p
.
isStored
())
{
if
(
rw
==
Read
)
{
if
(
rw
==
Read
)
{
...
...
tests/QBind/QJson_impl.h
View file @
02645b25
...
@@ -345,7 +345,7 @@ protected:
...
@@ -345,7 +345,7 @@ protected:
}}
}}
bool
_item
(
QIdentifier
&
k
)
{
if
(
caching
)
{
return
caching
->
_item
(
k
);
}
bool
_item
(
QIdentifier
&
k
)
{
if
(
caching
)
{
return
caching
->
_item
(
k
);
}
Step
&
level
=
levels
.
last
();
Step
&
level
=
levels
.
last
();
if
(
-
1
<
level
.
index
&&
!
get
(
','
,
level
.
end
)
)
{
if
(
(
-
1
<
level
.
index
&&
!
get
(
','
,
level
.
end
))
||
next
(
"[{
\"
ntf-0123456789."
,
'}'
)
==
'}'
)
{
return
false
;
return
false
;
}
}
level
.
index
++
;
level
.
index
++
;
...
@@ -357,7 +357,7 @@ protected:
...
@@ -357,7 +357,7 @@ protected:
return
get
(
':'
,
level
.
end
);
}
return
get
(
':'
,
level
.
end
);
}
bool
_item
(
)
{
if
(
caching
)
{
return
caching
->
_item
();
}
bool
_item
(
)
{
if
(
caching
)
{
return
caching
->
_item
();
}
Step
&
level
=
levels
.
last
();
Step
&
level
=
levels
.
last
();
if
(
-
1
<
level
.
index
&&
!
get
(
','
,
level
.
end
)
)
{
if
(
(
-
1
<
level
.
index
&&
!
get
(
','
,
level
.
end
))
||
next
(
"[{
\"
ntf-0123456789."
,
']'
)
==
']'
)
{
return
false
;
return
false
;
}
}
level
.
index
++
;
level
.
index
++
;
...
...
tests/QBind/main.cpp
View file @
02645b25
...
@@ -733,8 +733,8 @@ int main(int argc, char *argv[])
...
@@ -733,8 +733,8 @@ int main(int argc, char *argv[])
GROUP
(
"Person<>Json"
)
//====================================================
GROUP
(
"Person<>Json"
)
//====================================================
{
{
QBuffer
json
;
json
.
open
(
QIODevice
::
ReadOnly
);
QBuffer
json
;
json
.
open
(
QIODevice
::
ReadOnly
);
json
.
buffer
()
=
"_{
\"
names
\"
: [ _
\"
John
\"
_,
\"
Doe
\"
] ,
\"
age
\"
_:_null,
\"
height
\"
:_1.75,
\"
phones
\"
: [],
\"\"
:
\"
superfluous item
\"
_} "
;
json
.
buffer
()
=
"_{
\"
names
\"
: [ _
\"
John
\"
_,
\"
Doe
\"
] ,
\"
age
\"
_:_null,
\"
height
\"
:_1.75,
\"
phones
\"
: [],
\"
_
\"
:
\"
superfluous item
\"
_} "
;
// 1 15 23 4042 58
101
// 1 15 23 4042 58
102
Person
p
;
Person
p
;
QBuffer
roundtrip
;
roundtrip
.
open
(
QIODevice
::
ReadWrite
);
QBuffer
roundtrip
;
roundtrip
.
open
(
QIODevice
::
ReadWrite
);
QJsonValue
jv
;
QJsonValue
jv
;
...
@@ -776,15 +776,20 @@ int main(int argc, char *argv[])
...
@@ -776,15 +776,20 @@ int main(int argc, char *argv[])
//---------------------------------------------------------------------
//---------------------------------------------------------------------
START
{
START
{
roundtrip
.
seek
(
0
);
jv
=
QJsonValue
();
roundtrip
.
seek
(
0
);
jv
=
QJsonValue
();
QJsonReader
r
(
&
roundtrip
);
// FIXME
QJsonReader
r
(
&
roundtrip
);
r
.
bind
(
jv
);
r
.
bind
(
jv
);
readerErrors
=
r
.
errors
;
readerErrors
=
r
.
errors
;
}
}
STOP
(
"Json>JsonValue"
,
QJsonDocument
(
jv
.
toObject
()).
toJson
(
QJsonDocument
::
Compact
)
+
" | "
+
Text
(
readerErrors
));
STOP
(
"Json>JsonValue"
,
QJsonDocument
(
jv
.
toObject
()).
toJson
(
QJsonDocument
::
Compact
)
+
" | "
+
Text
(
readerErrors
));
// TODO JsonValue>Json
// TODO
// START {
// ba.resize(0);
// QJsonWriter(&ba).bind(jv);
// }
// STOP("JsonValue>Json",ba);
START
{
START
{
roundtrip
.
seek
(
0
);
ba
.
resize
(
0
);
roundtrip
.
seek
(
0
);
ba
.
resize
(
0
);
QJsonReader
r
(
&
roundtrip
);
// FIXME
QJsonReader
r
(
&
roundtrip
);
r
.
bind
(
QCborWriter
(
&
ba
).
value
());
r
.
bind
(
QCborWriter
(
&
ba
).
value
());
readerErrors
=
r
.
errors
;
readerErrors
=
r
.
errors
;
}
}
...
...
tests/QBind/samples.txt
View file @
02645b25
...
@@ -56,13 +56,13 @@ Bindable |
...
@@ -56,13 +56,13 @@ Bindable |
Bindable>Cbor |bf647479706502666e756d6265726b2b34342031323334353637ff
Bindable>Cbor |bf647479706502666e756d6265726b2b34342031323334353637ff
Bindable>Json |{"type":2,"number":"+44 1234567"}
Bindable>Json |{"type":2,"number":"+44 1234567"}
Person<>Json |================================================================================
Person<>Json |================================================================================
Json>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]] | [ IgnoredCharacter 0:1 IgnoredCharacter 0:15 IgnoredCharacter 0:23 IgnoredCharacter 0:40 IgnoredCharacter 0:42 IgnoredCharacter 0:58 IgnoredCharacter 0:
76 IgnoredCharacter 0:77
]
Json>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]] | [ IgnoredCharacter 0:1 IgnoredCharacter 0:15 IgnoredCharacter 0:23 IgnoredCharacter 0:40 IgnoredCharacter 0:42 IgnoredCharacter 0:58 IgnoredCharacter 0:
102
]
P>Json |{"names":["John","Doe"],"height":1.7500000000000002,"age":-1,"phones":[],"comments":"","children":[]}
P>Json |{"names":["John","Doe"],"height":1.7500000000000002,"age":-1,"phones":[],"comments":"","children":[]}
Json>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]] | [
IgnoredCharacter 0:72 IgnoredCharacter 0:73 ExpectedRecord 0:73
]
Json>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]] | []
P>JsonValue |{"age":-1,"children":[],"comments":"","height":1.7500000000000004,"names":["John","Doe"],"phones":[]}
P>JsonValue |{"age":-1,"children":[],"comments":"","height":1.7500000000000004,"names":["John","Doe"],"phones":[]}
JsonValue>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]] | []
JsonValue>P |(Person)[ names:[ John Doe] height:1.75 age:-1 phones:[] comments: children:[]] | []
Json>JsonValue|{"age":-1,"
height":1.7500000000000004,"names":["John","Doe"],"phones":["comments","children"]} | [ IgnoredCharacter 0:72 IgnoredCharacter 0:73 IgnoredCharacter 0:84 IgnoredCharacter 0:85 IgnoredCharacter 0:86 IgnoredCharacter 0:98 IgnoredCharacter 0:99
]
Json>JsonValue|{"age":-1,"
children":[],"comments":"","height":1.7500000000000004,"names":["John","Doe"],"phones":[]} | [
]
Json>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fa3fe0000063616765206670686f6e65739f
68636f6d6d656e7473686368696c6472656e
ffff
Json>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fa3fe0000063616765206670686f6e65739f
ff68636f6d6d656e747360686368696c6472656e9f
ffff
Person<>Cbor |================================================================================
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:[]] | []
P>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765206670686f6e65738068636f6d6d656e747360686368696c6472656e80ff
P>Cbor |bf656e616d65739f644a6f686e63446f65ff66686569676874fb3ffc00000000000063616765206670686f6e65738068636f6d6d656e747360686368696c6472656e80ff
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment