Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KItinerary
Commits
9a8ea1c6
Commit
9a8ea1c6
authored
Oct 12, 2022
by
Volker Krause
Browse files
Make dumpGadget recursive
Needed for the complex ERA FCB objects.
parent
93d52bdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/tools/ticket-barcode-dump.cpp
View file @
9a8ea1c6
...
...
@@ -38,16 +38,35 @@ using namespace KItinerary;
template
<
typename
T
>
static
void
dumpGadget
(
const
T
*
gadget
,
const
char
*
indent
=
""
)
{
if
(
!
gadget
)
{
dumpGadget
(
gadget
,
&
T
::
staticMetaObject
,
indent
);
}
static
void
dumpGadget
(
const
void
*
gadget
,
const
QMetaObject
*
mo
,
const
char
*
indent
)
{
if
(
!
gadget
||
!
mo
)
{
return
;
}
for
(
auto
i
=
0
;
i
<
T
::
staticMetaObject
.
propertyCount
();
++
i
)
{
const
auto
prop
=
T
::
staticMetaObject
.
property
(
i
);
for
(
auto
i
=
0
;
i
<
mo
->
propertyCount
();
++
i
)
{
const
auto
prop
=
mo
->
property
(
i
);
if
(
!
prop
.
isStored
())
{
continue
;
}
const
auto
value
=
prop
.
readOnGadget
(
gadget
);
std
::
cout
<<
indent
<<
prop
.
name
()
<<
": "
<<
qPrintable
(
value
.
toString
())
<<
std
::
endl
;
if
(
const
auto
childMo
=
QMetaType
::
metaObjectForType
(
value
.
userType
()))
{
QByteArray
childIndent
(
indent
);
childIndent
.
push_back
(
' '
);
dumpGadget
(
value
.
constData
(),
childMo
,
childIndent
.
constData
());
}
else
if
(
value
.
canConvert
<
QVariantList
>
()
&&
value
.
type
()
!=
QVariant
::
String
&&
value
.
type
()
!=
QVariant
::
ByteArray
)
{
auto
iterable
=
value
.
value
<
QSequentialIterable
>
();
int
idx
=
0
;
QByteArray
childIndent
(
indent
);
childIndent
.
append
(
" "
);
for
(
const
QVariant
&
v
:
iterable
)
{
std
::
cout
<<
indent
<<
" ["
<<
idx
++
<<
"]:"
<<
std
::
endl
;
dumpGadget
(
v
.
constData
(),
QMetaType
::
metaObjectForType
(
v
.
userType
()),
childIndent
.
constData
());
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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