comparison generator/cppimplgenerator.cpp @ 21:e747af2e6b46

temporary(?) fix for dropsite example
author eldar
date Fri, 15 May 2009 02:09:27 +0000
parents deb0cc1d053d
children cf8a415f3f32
comparison
equal deleted inserted replaced
20:deb0cc1d053d 21:e747af2e6b46
468 return !java_class->isQObject() && !java_class->typeEntry()->isValue(); 468 return !java_class->isQObject() && !java_class->typeEntry()->isValue();
469 } 469 }
470 470
471 void writeQtdEntityFunction(QTextStream &s, const AbstractMetaClass *java_class) 471 void writeQtdEntityFunction(QTextStream &s, const AbstractMetaClass *java_class)
472 { 472 {
473 /* if(java_class->baseClass()) 473 // if (!(java_class->typeEntry()->isObject() || java_class->typeEntry()->isQObject()))
474 return; */ 474 // return;
475 if (!(java_class->typeEntry()->isObject() || java_class->typeEntry()->isQObject()))
476 return;
477 if (!java_class->hasVirtualFunctions()) 475 if (!java_class->hasVirtualFunctions())
478 return; 476 return;
479 /* if (java_class->name() == "QPainterPath_Element") {
480 foreach (AbstractMetaFunction *function, java_class->virtualOverrideFunctions()) {
481 s << function->name() << endl;
482 }
483 }*/
484 477
485 s << "extern \"C\" DLL_PUBLIC void *__" << java_class->name() << "_entity(void *q_ptr)" << endl; 478 s << "extern \"C\" DLL_PUBLIC void *__" << java_class->name() << "_entity(void *q_ptr)" << endl;
486 s << "{" << endl; 479 s << "{" << endl;
487 { 480 {
488 Indentation indent(INDENT); 481 Indentation indent(INDENT);
1760 Option options = Option(EnumAsInts | UnderscoreSpaces); 1753 Option options = Option(EnumAsInts | UnderscoreSpaces);
1761 1754
1762 // The write a public override version of this function to be used by native functions 1755 // The write a public override version of this function to be used by native functions
1763 writeFunctionSignature(s, java_function, implementor, "__override_", 1756 writeFunctionSignature(s, java_function, implementor, "__override_",
1764 options, 1757 options,
1765 QString()); 1758 QString(), // the class prefix
1759 QStringList() << "bool static_call");
1766 s << endl 1760 s << endl
1767 << "{" << endl; 1761 << "{" << endl;
1768 Indentation indent(INDENT); 1762 Indentation indent(INDENT);
1769 /* qtd s << INDENT << "if (static_call) {" << endl; 1763 s << INDENT << "if (static_call) {" << endl;
1770 { 1764 {
1771 Indentation indent(INDENT); */ 1765 Indentation indent(INDENT);
1772 writeBaseClassFunctionCall(s, java_function, implementor); 1766 writeBaseClassFunctionCall(s, java_function, implementor);
1773 /* qtd } 1767 }
1774 s << INDENT << "} else {" << endl; 1768 s << INDENT << "} else {" << endl;
1775 { 1769 {
1776 Indentation indent(INDENT); 1770 Indentation indent(INDENT);
1777 writeBaseClassFunctionCall(s, java_function, implementor, VirtualCall); 1771 writeBaseClassFunctionCall(s, java_function, implementor, VirtualCall);
1778 } 1772 }
1779 1773
1780 s << INDENT << "}" << endl */ 1774 s << INDENT << "}" << endl;
1781 s << "}" << endl << endl; 1775 s << "}" << endl << endl;
1782 } 1776 }
1783 1777
1784 1778
1785 void CppImplGenerator::writeBaseClassFunctionCall(QTextStream &s, 1779 void CppImplGenerator::writeBaseClassFunctionCall(QTextStream &s,
2074 // no prefix 2068 // no prefix
2075 } else if (java_function->isFinalInCpp() && !java_function->wasPublic() && hasShell) { 2069 } else if (java_function->isFinalInCpp() && !java_function->wasPublic() && hasShell) {
2076 function_prefix = "__public_"; 2070 function_prefix = "__public_";
2077 } else if (!java_function->isFinalInCpp() && !java_function->isStatic() && hasShell) { 2071 } else if (!java_function->isFinalInCpp() && !java_function->isStatic() && hasShell) {
2078 function_prefix = "__override_"; 2072 function_prefix = "__override_";
2079 /* qtd extra_param.append("__do_static_call"); 2073 extra_param.append("__do_static_call");
2080 s << INDENT 2074 s << INDENT
2081 << "bool __do_static_call = __this_nativeId ? ((QtJambiLink *) " 2075 << "bool __do_static_call = __this_nativeId ? "
2082 << "__this_nativeId)->createdByJava() : false;" << endl; 2076 << "__" << java_class->name() << "_entity(__this_nativeId) : false;" << endl;
2083 */ } else { 2077 } else {
2084 option = OriginalName; 2078 option = OriginalName;
2085 } 2079 }
2086 2080
2087 // Call the Qt function on the java object 2081 // Call the Qt function on the java object
2088 s << " "; 2082 s << " ";