@@ -1035,3 +1035,88 @@ template<double, TYPE2>
1035
1035
return sipGetState(sipTransferObj);
1036
1036
%End
1037
1037
};
1038
+
1039
+ %MappedType QList < QPair< QString, QList<QString> > >
1040
+ {
1041
+ %TypeHeaderCode
1042
+ #include <QPair>
1043
+ #include <QList>
1044
+ #if (SIP_VERSION >= 0x040900)
1045
+ #define sipClass_QString ((sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString))
1046
+ #endif
1047
+ %End
1048
+
1049
+ %ConvertFromTypeCode
1050
+ //convert map to a python dictionary
1051
+ PyObject *d;
1052
+
1053
+ if ((d = PyList_New( sipCpp->size() )) == NULL)
1054
+ return NULL;
1055
+
1056
+ for ( int i = 0; i<sipCpp->size(); i++ )
1057
+ {
1058
+ PyObject *p;
1059
+ if ((p = PyList_New(2) ) == NULL)
1060
+ {
1061
+ Py_DECREF(d);
1062
+ return NULL;
1063
+ }
1064
+
1065
+ PyObject *l;
1066
+ if ((l = PyList_New( sipCpp->at(i).second.size() )) == NULL)
1067
+ {
1068
+ Py_DECREF(d);
1069
+ Py_DECREF(p);
1070
+ return NULL;
1071
+ }
1072
+
1073
+ for( int j = 0; j<sipCpp->at(i).second.size(); j++ )
1074
+ {
1075
+ PyObject *t1obj = sipConvertFromNewInstance(new QString(sipCpp->at(i).second.at(j)), sipClass_QString, sipTransferObj);
1076
+ PyList_SetItem( l, j, t1obj);
1077
+ }
1078
+
1079
+ PyObject *t1obj = sipConvertFromNewInstance(new QString(sipCpp->at(i).first), sipClass_QString, sipTransferObj);
1080
+ PyList_SetItem( p, 0, t1obj );
1081
+ PyList_SetItem( p, 1, l);
1082
+
1083
+ PyList_SetItem( d, i, p );
1084
+ }
1085
+
1086
+ return d;
1087
+ %End
1088
+ %ConvertToTypeCode
1089
+ #if PY_VERSION_HEX >= 0x02050000
1090
+ Py_ssize_t i = 0;
1091
+ #else
1092
+ int i = 0;
1093
+ #endif
1094
+ QList < QPair< QString, QList<QString> > > *qm = new QList < QPair< QString, QList<QString> > >;
1095
+
1096
+ for ( i = 0; i < PyList_GET_SIZE(sipPy); i++ )
1097
+ {
1098
+ PyObject *sipPair = PyList_GetItem( sipPy, i );
1099
+ PyObject *sipKey = PyList_GetItem( sipPair, 0 );
1100
+ PyObject *sipList = PyList_GetItem( sipPair, 1 );
1101
+
1102
+ QList< QString > l;
1103
+ int state;
1104
+ int j;
1105
+ for ( j = 0; j < PyList_GET_SIZE( sipList ); j++ )
1106
+ {
1107
+ PyObject *sipString = PyList_GetItem( sipList, j );
1108
+ QString *t1 = reinterpret_cast<QString *>(sipConvertToInstance(sipString, sipClass_QString, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
1109
+ l << *t1;
1110
+ sipReleaseInstance(t1, sipClass_QString, state);
1111
+ }
1112
+
1113
+ QString *t1 = reinterpret_cast<QString *>(sipConvertToInstance(sipKey, sipClass_QString, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
1114
+ qm->append( qMakePair( *t1, l ) );
1115
+ sipReleaseInstance(t1, sipClass_QString, state);
1116
+ }
1117
+
1118
+ *sipCppPtr = qm;
1119
+
1120
+ return sipGetState(sipTransferObj);
1121
+ %End
1122
+ };
0 commit comments