Commit 7da8ef13 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

add a few typemaps + fix annoying clang warning

parent f93d8756
......@@ -134,6 +134,10 @@ namespace Namespace {
$1 = PyInt_AsLong($input);
}
%typemap(in) const qlonglong& {
$1 = PyInt_AsLong($input);
}
%typemap(directorout) qlonglong {
PyObject *o = static_cast<PyObject *>($1);
if (PyInt_Check(o)) {
......@@ -148,6 +152,10 @@ namespace Namespace {
%typemap(typecheck) const qlonglong& = long long;
%typemap(typecheck) QString = char *;
%typemap(typecheck) const QString& = char *;
%typemap(typecheck) QString = const char *;
%typemap(typecheck) const QString& = const char *;
%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER, noblock=1) QStringList {
$1 = PyList_Check($input) ? 1 : 0;
}
......@@ -195,9 +203,8 @@ namespace Namespace {
%typemap(in) QStringList {
if (PyList_Check($input)) {
int i = 0;
int end = PyList_Size($input);
for(i;i!=end; ++i) {
for(int i = 0; i!=end; ++i) {
$1 << QString(PyString_AsString(PyList_GET_ITEM($input, i)));
}
} else {
......@@ -207,10 +214,9 @@ namespace Namespace {
%typemap(in) const QStringList& {
if (PyList_Check($input)) {
int i = 0;
int end = PyList_Size($input);
$1 = new QStringList;
for(i;i!=end; ++i) {
for(int i = 0 ;i!=end; ++i) {
char *t = PyString_AsString(PyList_GET_ITEM($input, i));
(*$1) << QString(t);
}
......@@ -228,9 +234,8 @@ namespace Namespace {
%typemap(directorout) QStringList {
PyObject *list = static_cast<PyObject *>($1);
if (PyList_Check(list)) {
int i = 0;
int end = PyList_Size(list);
for(i;i<end; ++i) {
for(int i = 0; i<end; ++i) {
char *t = PyString_AsString(PyList_GET_ITEM(list, i));
$result << QString(t);
}
......@@ -243,9 +248,8 @@ namespace Namespace {
%typemap(in) QList<long> {
if (PyList_Check($input)) {
int i = 0;
int end = PyList_Size($input);
for(i;i!=end; ++i) {
for(int i = 0; i!=end; ++i) {
$1 << PyInt_AsLong(PyList_GET_ITEM($input, i));
}
} else {
......@@ -255,10 +259,9 @@ namespace Namespace {
%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) {
for(int i = 0; i!=end; ++i) {
($1)->append(PyInt_AsLong(PyList_GET_ITEM($input, i)));
}
} else {
......@@ -275,9 +278,8 @@ namespace Namespace {
%typemap(directorout) QList<long> {
PyObject *list = static_cast<PyObject *>($1);
if (PyList_Check(list)) {
int i = 0;
int end = PyList_Size(list);
for(i;i<end; ++i) {
for(int i = 0; i<end; ++i) {
PyObject *o = PyList_GET_ITEM(list, i);
$result << PyInt_AsLong(o);
}
......@@ -290,9 +292,8 @@ namespace Namespace {
%typemap(in) QList<double> {
if (PyList_Check($input)) {
int i = 0;
int end = PyList_Size($input);
for(i;i!=end; ++i) {
for(int i = 0; i!=end; ++i) {
$1 << PyFloat_AsDouble(PyList_GET_ITEM($input, i));
}
} else {
......@@ -302,10 +303,9 @@ namespace Namespace {
%typemap(in) const QList<double>& {
if (PyList_Check($input)) {
int i = 0;
int end = PyList_Size($input);
$1 = new QList<double>;
for(i;i!=end; ++i) {
for(int i = 0; i!=end; ++i) {
($1)->append(PyFloat_AsDouble(PyList_GET_ITEM($input, i)));
}
} else {
......@@ -322,9 +322,8 @@ namespace Namespace {
%typemap(directorout) QList<double> {
PyObject *list = static_cast<PyObject *>($1);
if (PyList_Check(list)) {
int i = 0;
int end = PyList_Size(list);
for(i;i<end; ++i) {
for(int i = 0; i<end; ++i) {
PyObject *o = PyList_GET_ITEM(list, i);
$result << PyFloat_AsDouble(o);
}
......
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