diff generator/dgenerator.cpp @ 297:bc783e20da2b signals

share strange dmd
author eldar
date Sun, 22 Nov 2009 22:18:06 +0000
parents 463563fc9e17
children adae77fdc1ea
line wrap: on
line diff
--- a/generator/dgenerator.cpp	Sun Nov 22 20:43:10 2009 +0000
+++ b/generator/dgenerator.cpp	Sun Nov 22 22:18:06 2009 +0000
@@ -70,7 +70,7 @@
                   << "QLatin1String" << "unsigned long long" << "signed int"
                   << "signed short" << "Array" << "GLuint" << "GLenum" << "GLint"
                   << "unsigned long" << "ulong" << "long" << "QByteRef"
-                  << "QStringList" << "QList" << "QVector" << "QPair"
+                  << "QStringList" << "QVector" << "QPair"
                   << "QSet" << "QStringRef" << "quintptr";
 }
 
@@ -177,8 +177,12 @@
             if ((option & SkipTemplateParameters) == 0) {
                 QList<AbstractMetaType *> args = d_type->instantiations();
 
-                if (args.size() == 1) // QVector or QList
-                    s = translateType(args.at(0), context, BoxedPrimitive) + "[]";
+                if (args.size() == 1) { // QVector or QList
+                    if(d_type->typeEntry()->name() == "QList")
+                        s = "QList!(" + translateType(args.at(0), context, BoxedPrimitive) + ")";
+                    else
+                        s = translateType(args.at(0), context, BoxedPrimitive) + "[]";
+                }
                 else if(args.size() == 2) { // all sorts of maps
                     s = translateType(args.at(1), context, BoxedPrimitive); // value
                     bool isMultiMap = static_cast<const ContainerTypeEntry *>(d_type->typeEntry())->type() == ContainerTypeEntry::MultiMapContainer;
@@ -679,7 +683,12 @@
             s << INDENT << return_type->name() << " res;" << endl;
 
         if(return_type->isContainer())
-            s << INDENT << this->translateType(d_function->type(), d_function->ownerClass(), NoOption) << " res;" << endl;
+        {
+            if(d_function->type()->typeEntry()->name() == "QList")
+                s << INDENT << "auto res = " << this->translateType(d_function->type(), d_function->ownerClass(), NoOption) << ".opCall();" << endl;
+            else
+                s << INDENT << this->translateType(d_function->type(), d_function->ownerClass(), NoOption) << " res;" << endl;
+        }
     }
 
     // returning string or a struct