Mercurial > projects > qtd
comparison generator/cppimplgenerator.cpp @ 259:515d6e1c7b10 lifetime
another iteration
author | maxter |
---|---|
date | Thu, 17 Sep 2009 16:28:41 +0000 |
parents | 17b5e13364b7 |
children | b5773ccab07d |
comparison
equal
deleted
inserted
replaced
258:1da8870e9a62 | 259:515d6e1c7b10 |
---|---|
599 foreach (AbstractMetaFunction *function, java_class->functions()) { | 599 foreach (AbstractMetaFunction *function, java_class->functions()) { |
600 if (function->isConstructor()) | 600 if (function->isConstructor()) |
601 writeShellConstructor(s, function); | 601 writeShellConstructor(s, function); |
602 } | 602 } |
603 | 603 |
604 if (java_class->typeEntry()->isObject()) | 604 if (java_class->hasVirtualDestructor()) |
605 writeShellDestructor(s, java_class); | 605 writeShellDestructor(s, java_class); |
606 | 606 |
607 if (java_class->isQObject()) | 607 if (java_class->isQObject()) |
608 writeQObjectFunctions(s, java_class); | 608 writeQObjectFunctions(s, java_class); |
609 else if (java_class->typeEntry()->isObject()) | 609 else if (java_class->typeEntry()->isObject()) |
1389 } | 1389 } |
1390 s << ")"; | 1390 s << ")"; |
1391 | 1391 |
1392 if (cls->isQObject()) | 1392 if (cls->isQObject()) |
1393 s << "," << endl << " QtD_QObjectEntity(this, d_ptr)"; | 1393 s << "," << endl << " QtD_QObjectEntity(this, d_ptr)"; |
1394 else if (cls->typeEntry()->isObject() && cls->hasVirtualFunctions()) | 1394 else if (cls->hasVirtualDestructor()) |
1395 s << "," << endl << " QtD_Entity(d_ptr)"; | 1395 s << "," << endl << " QtD_Entity(d_ptr)"; |
1396 /* qtd s << " m_meta_object(0)," << endl; | 1396 /* qtd s << " m_meta_object(0)," << endl; |
1397 s << " m_vtable(0)," << endl | 1397 s << " m_vtable(0)," << endl |
1398 << " m_link(0)" << endl; | 1398 << " m_link(0)" << endl; |
1399 */ | 1399 */ |
1734 s << "}" << endl << endl; | 1734 s << "}" << endl << endl; |
1735 } | 1735 } |
1736 | 1736 |
1737 void CppImplGenerator::writeObjectFunctions(QTextStream &s, const AbstractMetaClass *java_class) | 1737 void CppImplGenerator::writeObjectFunctions(QTextStream &s, const AbstractMetaClass *java_class) |
1738 { | 1738 { |
1739 s << "extern \"C\" DLL_PUBLIC const void* qtd_" << java_class->name() << "_staticTypeId()" << endl; | 1739 if (java_class->hasVirtualDestructor()) |
1740 s << "{" << endl; | |
1741 { | 1740 { |
1742 Indentation indent(INDENT); | 1741 s << "extern \"C\" DLL_PUBLIC const void* qtd_" << java_class->name() << "_staticTypeId()" << endl; |
1743 s << INDENT << "return &typeid(" << java_class->qualifiedCppName() << ");" << endl; | 1742 s << "{" << endl; |
1744 } | 1743 { |
1745 s << "}" << endl << endl; | 1744 Indentation indent(INDENT); |
1745 s << INDENT << "return &typeid(" << java_class->qualifiedCppName() << ");" << endl; | |
1746 } | |
1747 s << "}" << endl << endl; | |
1746 | 1748 |
1747 if (java_class->hasVirtualFunctions()) | |
1748 { | |
1749 if (!java_class->baseClass()) | 1749 if (!java_class->baseClass()) |
1750 { | 1750 { |
1751 s << "extern \"C\" DLL_PUBLIC void* qtd_" << java_class->name() << "_dId(void *q_ptr)" << endl; | 1751 s << "extern \"C\" DLL_PUBLIC void* qtd_" << java_class->name() << "_dId(void *q_ptr)" << endl; |
1752 s << "{" << endl; | 1752 s << "{" << endl; |
1753 { | 1753 { |
1765 { | 1765 { |
1766 Indentation indent(INDENT); | 1766 Indentation indent(INDENT); |
1767 s << INDENT << "return &typeid((" << java_class->qualifiedCppName() << "*)nativeId);" << endl; | 1767 s << INDENT << "return &typeid((" << java_class->qualifiedCppName() << "*)nativeId);" << endl; |
1768 } | 1768 } |
1769 s << "}" << endl << endl; | 1769 s << "}" << endl << endl; |
1770 } | 1770 } |
1771 else | |
1772 s << "extern \"C\" DLL_PUBLIC void* qtd_" << java_class->rootClass()->name() << "_dId(void *q_ptr);" << endl; | |
1773 } | 1771 } |
1774 } | 1772 } |
1775 | 1773 |
1776 void CppImplGenerator::writeVirtualFunctionOverride(QTextStream &s, | 1774 void CppImplGenerator::writeVirtualFunctionOverride(QTextStream &s, |
1777 const AbstractMetaFunction *java_function, | 1775 const AbstractMetaFunction *java_function, |