Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dtk
dtk
Commits
fdb0efd0
Commit
fdb0efd0
authored
Nov 06, 2017
by
KLOCZKO Thibaud
Browse files
Add typemap for qlist.
parent
9d172798
Changes
1
Show whitespace changes
Inline
Side-by-side
wrp/dtkBase/dtk_base.i
View file @
fdb0efd0
...
...
@@ -176,6 +176,37 @@ namespace Namespace {
}
}
%
typemap
(
in
)
QList
<
long
>
{
if
(
PyList_Check
(
$
input
))
{
int
i
=
0
;
int
end
=
PyList_Size
(
$
input
)
;
for
(
i
;
i
!=
end
;
++
i
)
{
$
1
<<
PyInt_AsLong
(
PyList_GET_ITEM
(
$
input
,
i
))
;
}
}
else
{
qDebug
(
"QList<long> expected"
)
;
}
}
%
typemap
(
in
)
const
QList
<
long
>
&
{
if
(
PyList_Check
(
$
input
))
{
int
i
=
0
;
int
end
=
PyList_Size
(
$
input
)
;
$
1
=
new
QList
<
long
>
;
for
(
i
;
i
!=
end
;
++
i
)
{
(
$
1
)
->
append
(
PyInt_AsLong
(
PyList_GET_ITEM
(
$
input
,
i
)))
;
}
}
else
{
qDebug
(
"QList<long> expected"
)
;
}
}
%
typemap
(
freearg
)
const
QList
<
long
>
&
{
if
(
$
1
)
{
delete
$
1
;
}
}
// C++ -> Python
%
typemap
(
out
)
qlonglong
{
...
...
@@ -249,6 +280,17 @@ namespace Namespace {
}
}
%
typemap
(
out
)
QList
<
long
>
{
$
result
=
PyList_New
(
$
1.
size
())
;
int
i
=
0
;
QList
<
long
>::
iterator
it
=
$
1.
begin
()
;
QList
<
long
>::
iterator
end
=
$
1.
end
()
;
for
(
;
it
!=
end
;
++
it
,
++
i
)
{
PyObject
*
l
=
PyInt_FromLong
(
*
it
)
;
PyList_SET_ITEM
(
$
result
,
i
,
l
)
;
}
}
template
<
class
T1
,
class
T2
>
class
QPair
{
public
:
...
...
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