comparison generator/dgenerator.cpp @ 297:bc783e20da2b signals

share strange dmd
author eldar
date Sun, 22 Nov 2009 22:18:06 +0000
parents 463563fc9e17
children adae77fdc1ea
comparison
equal deleted inserted replaced
296:5173835bb372 297:bc783e20da2b
68 << "signed char" << "unsigned short" << "QBool" << "unsigned int" 68 << "signed char" << "unsigned short" << "QBool" << "unsigned int"
69 << "Qt::HANDLE" << "QChar" << "java.lang.JObjectWrapper" << "void" 69 << "Qt::HANDLE" << "QChar" << "java.lang.JObjectWrapper" << "void"
70 << "QLatin1String" << "unsigned long long" << "signed int" 70 << "QLatin1String" << "unsigned long long" << "signed int"
71 << "signed short" << "Array" << "GLuint" << "GLenum" << "GLint" 71 << "signed short" << "Array" << "GLuint" << "GLenum" << "GLint"
72 << "unsigned long" << "ulong" << "long" << "QByteRef" 72 << "unsigned long" << "ulong" << "long" << "QByteRef"
73 << "QStringList" << "QList" << "QVector" << "QPair" 73 << "QStringList" << "QVector" << "QPair"
74 << "QSet" << "QStringRef" << "quintptr"; 74 << "QSet" << "QStringRef" << "quintptr";
75 } 75 }
76 76
77 QString DGenerator::fileNameForClass(const AbstractMetaClass *d_class) const 77 QString DGenerator::fileNameForClass(const AbstractMetaClass *d_class) const
78 { 78 {
175 Q_ASSERT(c_entry); 175 Q_ASSERT(c_entry);
176 176
177 if ((option & SkipTemplateParameters) == 0) { 177 if ((option & SkipTemplateParameters) == 0) {
178 QList<AbstractMetaType *> args = d_type->instantiations(); 178 QList<AbstractMetaType *> args = d_type->instantiations();
179 179
180 if (args.size() == 1) // QVector or QList 180 if (args.size() == 1) { // QVector or QList
181 s = translateType(args.at(0), context, BoxedPrimitive) + "[]"; 181 if(d_type->typeEntry()->name() == "QList")
182 s = "QList!(" + translateType(args.at(0), context, BoxedPrimitive) + ")";
183 else
184 s = translateType(args.at(0), context, BoxedPrimitive) + "[]";
185 }
182 else if(args.size() == 2) { // all sorts of maps 186 else if(args.size() == 2) { // all sorts of maps
183 s = translateType(args.at(1), context, BoxedPrimitive); // value 187 s = translateType(args.at(1), context, BoxedPrimitive); // value
184 bool isMultiMap = static_cast<const ContainerTypeEntry *>(d_type->typeEntry())->type() == ContainerTypeEntry::MultiMapContainer; 188 bool isMultiMap = static_cast<const ContainerTypeEntry *>(d_type->typeEntry())->type() == ContainerTypeEntry::MultiMapContainer;
185 if (isMultiMap) 189 if (isMultiMap)
186 s += "[]"; 190 s += "[]";
677 s << INDENT << "QModelIndex res;" << endl; 681 s << INDENT << "QModelIndex res;" << endl;
678 else if (return_type->typeEntry()->isStructInD()) 682 else if (return_type->typeEntry()->isStructInD())
679 s << INDENT << return_type->name() << " res;" << endl; 683 s << INDENT << return_type->name() << " res;" << endl;
680 684
681 if(return_type->isContainer()) 685 if(return_type->isContainer())
682 s << INDENT << this->translateType(d_function->type(), d_function->ownerClass(), NoOption) << " res;" << endl; 686 {
687 if(d_function->type()->typeEntry()->name() == "QList")
688 s << INDENT << "auto res = " << this->translateType(d_function->type(), d_function->ownerClass(), NoOption) << ".opCall();" << endl;
689 else
690 s << INDENT << this->translateType(d_function->type(), d_function->ownerClass(), NoOption) << " res;" << endl;
691 }
683 } 692 }
684 693
685 // returning string or a struct 694 // returning string or a struct
686 bool return_in_arg = return_type && (return_type->isTargetLangString() || 695 bool return_in_arg = return_type && (return_type->isTargetLangString() ||
687 return_type->name() == "QModelIndex" || 696 return_type->name() == "QModelIndex" ||