comparison generator/dgenerator.cpp @ 302:55ee4603365d signals

string arguments for signals
author eldar_ins@eldar-laptop
date Sat, 12 Dec 2009 03:22:54 +0500
parents 4d8481385c71
children 98b211f3ee34
comparison
equal deleted inserted replaced
301:4d8481385c71 302:55ee4603365d
1781 if (type->isContainer()) { 1781 if (type->isContainer()) {
1782 s << INDENT << translateType(type, signal->implementingClass(), BoxedPrimitive) << " " << arg_name << ";" << endl 1782 s << INDENT << translateType(type, signal->implementingClass(), BoxedPrimitive) << " " << arg_name << ";" << endl
1783 << INDENT << cppContainerConversionName(d_class, type, FromCpp) << "(" << arg_ptr << ", &" << arg_name << ");" << endl; 1783 << INDENT << cppContainerConversionName(d_class, type, FromCpp) << "(" << arg_ptr << ", &" << arg_name << ");" << endl;
1784 } else if (type->isTargetLangString()) { 1784 } else if (type->isTargetLangString()) {
1785 s << INDENT << "auto " << arg_name << "_ptr = " << arg_ptr << ";" << endl 1785 s << INDENT << "auto " << arg_name << "_ptr = " << arg_ptr << ";" << endl
1786 << INDENT << "string " << arg_name << " = QString.toNativeString(" << arg_name << "_ptr);"; 1786 << INDENT << "string " << arg_name << " = QStringUtil.toNativeString(" << arg_name << "_ptr);";
1787 } else if(type->isPrimitive() || type->isEnum() || type->isFlags() || type->typeEntry()->isStructInD()) { 1787 } else if(type->isPrimitive() || type->isEnum() || type->isFlags() || type->typeEntry()->isStructInD()) {
1788 QString type_name = argument->type()->typeEntry()->qualifiedTargetLangName(); 1788 QString type_name = argument->type()->typeEntry()->qualifiedTargetLangName();
1789 if (type->isFlags()) 1789 if (type->isFlags())
1790 type_name = "int"; 1790 type_name = "int";
1791 s << INDENT << "auto " << arg_name << " = *(cast(" << type_name << "*)" << arg_ptr << ");"; 1791 s << INDENT << "auto " << arg_name << " = *(cast(" << type_name << "*)" << arg_ptr << ");";
2985 << ") " << arg_name << ";"; 2985 << ") " << arg_name << ";";
2986 else if (type->isTargetLangString()) 2986 else if (type->isTargetLangString())
2987 s << INDENT << "string " << arg_name << "_d_ref = toUTF8(" 2987 s << INDENT << "string " << arg_name << "_d_ref = toUTF8("
2988 << arg_name << "[0.." << arg_name << "_size]);"; 2988 << arg_name << "[0.." << arg_name << "_size]);";
2989 else if (type->typeEntry()->isValue() && type->isNativePointer() && type->typeEntry()->name() == "QString") { 2989 else if (type->typeEntry()->isValue() && type->isNativePointer() && type->typeEntry()->name() == "QString") {
2990 s << INDENT << "auto " << arg_name << "_d_qstr = QString(" << arg_name << ", true);" << endl 2990 s << INDENT << "auto " << arg_name << "_d_qstr = QStringUtil(" << arg_name << ", true);" << endl
2991 << INDENT << "string " << arg_name << "_d_ref = " << arg_name << "_d_qstr.toNativeString();"; 2991 << INDENT << "string " << arg_name << "_d_ref = " << arg_name << "_d_qstr.toNativeString();";
2992 } else if(type->isVariant()) 2992 } else if(type->isVariant())
2993 s << INDENT << "scope " << arg_name << "_d_ref = new QVariant(" << arg_name << ", QtdObjectFlags.nativeOwnership);"; 2993 s << INDENT << "scope " << arg_name << "_d_ref = new QVariant(" << arg_name << ", QtdObjectFlags.nativeOwnership);";
2994 else if (type->typeEntry()->isStructInD()) 2994 else if (type->typeEntry()->isStructInD())
2995 continue; 2995 continue;