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
ad0429bf
Commit
ad0429bf
authored
Nov 15, 2019
by
EXT Arnaud Clère
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor fixes and changes
parent
8e837650
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
tests/QBind/data.h
tests/QBind/data.h
+0
-1
tests/QBind/main.cpp
tests/QBind/main.cpp
+13
-12
No files found.
tests/QBind/data.h
View file @
ad0429bf
...
@@ -16,7 +16,6 @@ public:
...
@@ -16,7 +16,6 @@ public:
Phone
(
Type
t
=
Unknown
,
QString
n
=
QString
())
:
_t
(
t
),
_n
(
n
)
{}
Phone
(
Type
t
=
Unknown
,
QString
n
=
QString
())
:
_t
(
t
),
_n
(
n
)
{}
static
bool
isOffice
(
const
Phone
&
phone
)
{
return
phone
.
_t
==
Phone
::
Office
;
}
// for custom bind example
//private:
//private:
Type
_t
;
QString
_n
;
Type
_t
;
QString
_n
;
};
};
...
...
tests/QBind/main.cpp
View file @
ad0429bf
...
@@ -85,17 +85,18 @@ struct Person
...
@@ -85,17 +85,18 @@ struct Person
int
id
;
QString
firstName
,
lastName
;
double
height
;
int
age
;
QVector
<
Phone
>
phones
;
QString
comments
;
QList
<
Person
>
children
;
int
id
;
QString
firstName
,
lastName
;
double
height
;
int
age
;
QVector
<
Phone
>
phones
;
QString
comments
;
QList
<
Person
>
children
;
QValueStatus
zap
(
QValue
&&
value
)
{
// works with value->mode()==Read as well as Write
QValueStatus
zap
(
QValue
&&
value
)
{
// works with value->mode()==Read as well as Write
auto
r
=
value
.
record
(
"Person"
);
return
value
auto
s
=
r
.
sequence
(
"names"
);
.
record
(
"Person"
)
s
=
s
.
bind
(
firstName
);
.
sequence
(
"names"
)
s
=
s
.
bind
(
lastName
);
.
bind
(
firstName
)
r
=
s
.
out
();
.
bind
(
lastName
)
r
=
r
.
bind
(
"height"
,
height
);
.
out
()
r
=
r
.
bind
(
"age"
,
age
,
-
1
);
// reads null() as -1
.
bind
(
"height"
,
height
)
r
=
r
.
bind
(
"phones"
,
phones
);
// recursive calls to QTransmogrifier will take care of that part
.
bind
(
"age"
,
age
,
-
1
)
// reads null() as -1
r
=
r
.
bind
(
"comments"
,
comments
);
.
bind
(
"phones"
,
phones
)
// recursive calls to QTransmogrifier will take care of that part
r
=
r
.
bind
(
"children"
,
children
);
.
bind
(
"comments"
,
comments
)
return
r
;
// automagically closes opened record()
.
bind
(
"children"
,
children
)
;
// automagically closes opened record()
}
}
};
};
...
@@ -684,7 +685,7 @@ int main(int argc, char *argv[])
...
@@ -684,7 +685,7 @@ int main(int argc, char *argv[])
s
.
append
(
"type"
);
s
.
append
(
person
.
phones
[
i
].
_t
);
s
.
append
(
"type"
);
s
.
append
(
person
.
phones
[
i
].
_t
);
s
.
append
(
"number"
);
s
.
append
(
person
.
phones
[
i
].
_n
);
s
.
append
(
"number"
);
s
.
append
(
person
.
phones
[
i
].
_n
);
s
.
endMap
();
s
.
endMap
();
}
;
}
s
.
endArray
();
s
.
endArray
();
s
.
append
(
"comments"
);
s
.
append
(
person
.
comments
);
s
.
append
(
"comments"
);
s
.
append
(
person
.
comments
);
s
.
append
(
"children"
);
s
.
startArray
(
quint64
(
person
.
children
.
size
()));
s
.
append
(
"children"
);
s
.
startArray
(
quint64
(
person
.
children
.
size
()));
...
...
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