Mercurial > projects > qtd
comparison generator/cppimplgenerator.cpp @ 104:64b874c86f9b
fixed bug with QSpinBox
author | eldar |
---|---|
date | Sat, 30 May 2009 13:07:26 +0000 |
parents | 1750a803af74 |
children | 3aa118a9ae71 |
comparison
equal
deleted
inserted
replaced
103:236401001115 | 104:64b874c86f9b |
---|---|
778 //bool static_call = !(options & VirtualCall); | 778 //bool static_call = !(options & VirtualCall); |
779 //s << "std::cout << \"entering " << function->marshalledName() << " \\n\"; " << endl; | 779 //s << "std::cout << \"entering " << function->marshalledName() << " \\n\"; " << endl; |
780 | 780 |
781 if (f_type) { | 781 if (f_type) { |
782 if (f_type->isTargetLangString()) | 782 if (f_type->isTargetLangString()) |
783 s << INDENT << "char* ret_str = NULL;" << endl | 783 s << INDENT << "DArray ret_str;" << endl; |
784 << INDENT << "size_t ret_str_size = 0;" << endl; | |
785 | 784 |
786 if (f_type->name() == "QModelIndex") | 785 if (f_type->name() == "QModelIndex") |
787 s << INDENT << "QModelIndexAccessor __d_return_value;" << endl; | 786 s << INDENT << "QModelIndexAccessor __d_return_value;" << endl; |
788 else if (f_type->typeEntry()->isStructInD()) | 787 else if (f_type->typeEntry()->isStructInD()) |
789 s << INDENT << f_type->typeEntry()->qualifiedCppName() << " __d_return_value;" << endl; | 788 s << INDENT << f_type->typeEntry()->qualifiedCppName() << " __d_return_value;" << endl; |
841 s << function->marshalledName() << "_dispatch(" | 840 s << function->marshalledName() << "_dispatch(" |
842 << "this->d_entity()"; | 841 << "this->d_entity()"; |
843 | 842 |
844 if (f_type) { | 843 if (f_type) { |
845 if (f_type->isTargetLangString()) | 844 if (f_type->isTargetLangString()) |
846 s << ", ret_str, ret_str_size"; | 845 s << ", &ret_str"; |
847 if (f_type->name() == "QModelIndex" || f_type->typeEntry()->isStructInD()) | 846 if (f_type->name() == "QModelIndex" || f_type->typeEntry()->isStructInD()) |
848 s << ", &__d_return_value"; | 847 s << ", &__d_return_value"; |
849 if (f_type->isContainer()) | 848 if (f_type->isContainer()) |
850 s << ", &__d_return_value, &__d_return_value_size"; | 849 s << ", &__d_return_value, &__d_return_value_size"; |
851 } | 850 } |
873 function, 0, GlobalRefJObject); | 872 function, 0, GlobalRefJObject); |
874 s << INDENT << "return __qt_return_value;" << endl; | 873 s << INDENT << "return __qt_return_value;" << endl; |
875 } | 874 } |
876 | 875 |
877 if (f_type->isTargetLangString()) | 876 if (f_type->isTargetLangString()) |
878 s << INDENT << "return " << "QString::fromUtf8(ret_str, ret_str_size);" << endl; | 877 s << INDENT << "return " << "QString::fromUtf8((const char*) ret_str.ptr, ret_str.length);" << endl; |
879 | 878 |
880 if ( ( f_type->isValue() && !f_type->typeEntry()->isStructInD() ) || f_type->isVariant() ) | 879 if ( ( f_type->isValue() && !f_type->typeEntry()->isStructInD() ) || f_type->isVariant() ) |
881 s << INDENT << "return " << f_type->name() << "(*__qt_return_value);" << endl; //" __qt_return_value = "; | 880 s << INDENT << "return " << f_type->name() << "(*__qt_return_value);" << endl; //" __qt_return_value = "; |
882 } | 881 } |
883 } | 882 } |
892 AbstractMetaType *ret_type = d_function->type(); | 891 AbstractMetaType *ret_type = d_function->type(); |
893 | 892 |
894 s << "(void *d_entity"; | 893 s << "(void *d_entity"; |
895 | 894 |
896 if (ret_type) { | 895 if (ret_type) { |
897 if (ret_type->isTargetLangString()) | 896 if (ret_type->isTargetLangString()) { |
898 s << ", char* ret_str, size_t ret_str_size"; | 897 if (d_export) |
899 | 898 s << ", string* ret_str"; |
899 else | |
900 s << ", DArray* ret_str"; | |
901 } | |
900 if (ret_type->name() == "QModelIndex") | 902 if (ret_type->name() == "QModelIndex") |
901 s << ", QModelIndexAccessor *__d_return_value"; | 903 s << ", QModelIndexAccessor *__d_return_value"; |
902 else if(ret_type->typeEntry()->isStructInD()) | 904 else if(ret_type->typeEntry()->isStructInD()) |
903 s << ", " << ret_type->typeEntry()->qualifiedCppName() << " *__d_return_value"; | 905 s << ", " << ret_type->typeEntry()->qualifiedCppName() << " *__d_return_value"; |
904 | 906 |
2111 | 2113 |
2112 writeFunctionCall(s, qt_object_name, java_function, function_prefix, option, | 2114 writeFunctionCall(s, qt_object_name, java_function, function_prefix, option, |
2113 extra_param); | 2115 extra_param); |
2114 s << endl; | 2116 s << endl; |
2115 | 2117 |
2118 writeRefArguments(s, java_function); | |
2119 | |
2116 writeQtToJava(s, function_type, qt_return_value, java_return_value, | 2120 writeQtToJava(s, function_type, qt_return_value, java_return_value, |
2117 java_function, 0, EnumAsInts); | 2121 java_function, 0, EnumAsInts); |
2118 | 2122 |
2119 // qtd s << INDENT << "QTJAMBI_DEBUG_TRACE(\"(native) -> leaving: " | 2123 // qtd s << INDENT << "QTJAMBI_DEBUG_TRACE(\"(native) -> leaving: " |
2120 // << java_function_signature << "\");"; | 2124 // << java_function_signature << "\");"; |
2127 } | 2131 } |
2128 | 2132 |
2129 } else { | 2133 } else { |
2130 writeFunctionCall(s, qt_object_name, java_function, function_prefix, option, | 2134 writeFunctionCall(s, qt_object_name, java_function, function_prefix, option, |
2131 extra_param); | 2135 extra_param); |
2132 } | 2136 writeRefArguments(s, java_function); |
2133 writeRefArguments(s, java_function); | 2137 } |
2134 } | 2138 } |
2135 } | 2139 } |
2136 if(!java_function->argumentReplaced(0).isEmpty()) { | 2140 if(!java_function->argumentReplaced(0).isEmpty()) { |
2137 s << INDENT << "return 0;" << endl; | 2141 s << INDENT << "return 0;" << endl; |
2138 } | 2142 } |