Mercurial > projects > qtd
comparison generator/dgenerator.cpp @ 112:e416c5215366
unneeded
author | eldar |
---|---|
date | Mon, 01 Jun 2009 23:47:30 +0000 |
parents | 2a85b786fa3a |
children | 7ae9bc9d6935 |
comparison
equal
deleted
inserted
replaced
111:2a85b786fa3a | 112:e416c5215366 |
---|---|
863 | 863 |
864 if (return_type->isObject()) { | 864 if (return_type->isObject()) { |
865 if(d_function->storeResult()) | 865 if(d_function->storeResult()) |
866 s << INDENT << QString("__m_%1.nativeId = __qt_return_value;").arg(d_function->name()) << endl | 866 s << INDENT << QString("__m_%1.nativeId = __qt_return_value;").arg(d_function->name()) << endl |
867 << INDENT << QString("return __m_%1;").arg(d_function->name()) << endl; | 867 << INDENT << QString("return __m_%1;").arg(d_function->name()) << endl; |
868 else { | 868 else |
869 s << INDENT << "return qtd_" << return_type->name() << "_from_ptr(__qt_return_value);" << endl; | 869 s << INDENT << "return qtd_" << return_type->name() << "_from_ptr(__qt_return_value);" << endl; |
870 /* QString type_name = return_type->name(); | |
871 const ComplexTypeEntry *ctype = static_cast<const ComplexTypeEntry *>(return_type->typeEntry()); | |
872 if(ctype->isAbstract()) | |
873 type_name = type_name + "_ConcreteWrapper"; | |
874 | |
875 QString return_type_name = return_type->name(); | |
876 if(return_type->typeEntry()->designatedInterface()) | |
877 return_type_name = return_type->typeEntry()->designatedInterface()->name(); | |
878 | |
879 AbstractMetaClass *classForTypeEntry = NULL; | |
880 classForTypeEntry = ClassFromEntry::get(return_type->typeEntry()); | |
881 | |
882 // if class has virtual functions then it has classname_entity function so | |
883 // we can look for D Object pointer. otherwise create new wrapper | |
884 if (classForTypeEntry != NULL && classForTypeEntry->hasVirtualFunctions()) { | |
885 s << INDENT << "void* d_obj = __" << d_function->type()->name() << "_entity(__qt_return_value);" << endl | |
886 << INDENT << "if (d_obj !is null) {" << endl | |
887 << INDENT << " auto d_obj_ref = cast (Object) d_obj;" << endl | |
888 << INDENT << " return cast(" << return_type_name << ") d_obj_ref;" << endl | |
889 << INDENT << "} else {" << endl | |
890 << INDENT << " auto return_value = new " << type_name << "(__qt_return_value, true);" << endl | |
891 << INDENT << " return_value.__no_real_delete = true;" << endl | |
892 << INDENT << " return return_value;" << endl | |
893 << INDENT << "}"; | |
894 } else { | |
895 s << INDENT << "auto return_value = new " << type_name << "(__qt_return_value, true);" << endl | |
896 << INDENT << "return_value.__no_real_delete = true;" << endl | |
897 << INDENT << "return return_value;" << endl; | |
898 }*/ | |
899 } | |
900 s << endl; | 870 s << endl; |
901 } | 871 } |
872 | |
902 if (return_type->isArray()) { | 873 if (return_type->isArray()) { |
903 s << INDENT << "return __qt_return_value[0 .. " << return_type->arrayElementCount() << "];" << endl; | 874 s << INDENT << "return __qt_return_value[0 .. " << return_type->arrayElementCount() << "];" << endl; |
904 } | 875 } |
905 } | 876 } |
906 writeInjectedCode(s, d_function, CodeSnip::End); | 877 writeInjectedCode(s, d_function, CodeSnip::End); |