<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
I have a MappedType for std::string, and I wrote a test sip file that does conversion to and from a QList<std::string> and QList<std::string*> and I get compile errors with the auto-generated code based on the following stubs:<br>// SipStlTester.h<br>
class SipStlTester<br>
{<br>
...<br>
QList<std::string> listToListSP(const QList<std::string>
 & input);<br>
QList<std::string *> listToListSP(const QList<std::string *>
 & input);<br>
...<br>
}<br>
<br>
// SipStlTester.sip<br>
%Module TestSTLTypes 0<br>
<br>
%Import util.sip<br>
%Import QtCore/QtCoremod.sip<br>
class SipSTLTester<br>
{<br>
%TypeHeaderCode<br>
#include "SipSTLTester.h"<br>
%End<br>
public:<br>
    SipSTLTester();<br>
...<br>
    QList<std::string> listToListS   (const 
QList<std::string>   & input);<br>
    QList<std::string *> listToListSP(const QList<std::string 
*> & input);<br>
...<br>
};<br>
<br><br>Here is the autogenerated method for the function that fails: listToListSP<br>static PyObject *meth_SipSTLTester_listToListSP(PyObject *sipSelf, PyObject *sipArgs)<br>{<br>    PyObject *sipParseErr = NULL;<br><br>    {<br>        const QList<std::string> * a0;<br>        int a0State = 0;<br>        SipSTLTester *sipCpp;<br><br>        if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_SipSTLTester, &sipCpp, sipType_QList_0100std_string,&a0, &a0State))<br>        {<br>            QList<std::string> *sipRes;<br><br>            Py_BEGIN_ALLOW_THREADS<br>            sipRes = new QList<std::string>(sipCpp->listToListSP(*a0));<br>            Py_END_ALLOW_THREADS<br>            sipReleaseType(const_cast<QList<std::string> *>(a0),sipType_QList_0100std_string,a0State);<br><br>            return sipConvertFromNewType(sipRes,sipType_QList_0100std_string,NULL);<br>        }<br>    }<br><br>    /* Raise an exception if the arguments couldn't be parsed. */<br>    sipNoMethod(sipParseErr, sipName_SipSTLTester, sipName_listToListSP, NULL);<br><br>    return NULL;<br>}<br><br>As you can see, it creates sipRes as a QList<std::string> rather than as the appropriate type of QList<std::string*><br>std::string is a mapped type which the following definition:<br><br>%MappedType std::string<br>{<br>%TypeHeaderCode<br>#include <string><br>%End<br><br>%ConvertFromTypeCode<br>    if (!sipCpp) {<br>        Py_INCREF(Py_None);<br>        return Py_None;<br>    }<br>    // convert an std::string to a Python string<br>    return PyString_FromString(sipCpp->c_str());<br>%End // ConvertFromTypeCode<br><br>%ConvertToTypeCode<br>    if (sipIsErr == NULL) {<br>        return PyString_Check(sipPy);<br>    }<br>    if (sipPy == Py_None) {<br>        *sipCppPtr = new std::string;<br>        return 1;<br>    }<br>    if (PyString_Check(sipPy)) {<br>        *sipCppPtr = new std::string(PyString_AS_STRING(sipPy));<br>        return 1;<br>    }<br>    return 0;<br>%End // ConvertToTypeCode<br><br>};<br><br><br>I am unable to make a mapped type for std::string* since that type of MappedType doesn't seem to be supported by SIP.  So, in the MappedType for QList, there is one that _should_ support pointers to TYPE, e.g.<br>// QtCore/qlist.sip<br>// QList<TYPE *> is implemented as a Python list.<br>template<TYPE><br>%MappedType QList<TYPE *> /DocType="list-of-TYPE"/<br>{<br>%TypeHeaderCode<br>#include <qlist.h><br>%End<br>...<br><br>So, I would hope that it would autogenerate code for QList<std::string*> but SIP doesn't appear to be doing this.<br><br>I've verified this with Sip v. 4.10 and Sip 4.11.2<br><br>Thanks!<br>-Nate<br><br><br><br>                                         </body>
</html>