Mercurial > projects > qtd
comparison generator/dgenerator.cpp @ 354:18bd68f586c6
removed superfluous destructors
author | Max Samukha <maxter@spambox.com> |
---|---|
date | Mon, 24 May 2010 23:43:30 +0300 |
parents | 31520b2c0b3c |
children | 08c1ca7975ab |
comparison
equal
deleted
inserted
replaced
353:0a671b1382d7 | 354:18bd68f586c6 |
---|---|
1700 void DGenerator::writeDestructor(QTextStream &s, const AbstractMetaClass *d_class) | 1700 void DGenerator::writeDestructor(QTextStream &s, const AbstractMetaClass *d_class) |
1701 { | 1701 { |
1702 if (!d_class->hasConstructors()) | 1702 if (!d_class->hasConstructors()) |
1703 return; | 1703 return; |
1704 | 1704 |
1705 bool isTheQObject = d_class->name() == "QObject"; | 1705 if (d_class->isDestructorBase()) |
1706 if (isTheQObject || !d_class->isQObject()) | |
1707 { | 1706 { |
1708 s << INDENT << "protected override void __deleteNative() {" << endl; | 1707 s << INDENT << "protected override void __deleteNative() {" << endl; |
1709 { | 1708 { |
1710 if (isTheQObject) | 1709 s << INDENT << "qtd_" << d_class->name() << "_delete(__nativeId);" << endl; |
1711 s << INDENT << "qtd_delete_qobject(__nativeId);" << endl; | |
1712 else if (!d_class->isQObject()) | |
1713 s << INDENT << "qtd_" << d_class->name() << "_destructor(__nativeId);" << endl; | |
1714 } | 1710 } |
1715 s << INDENT << "}" << endl << endl; | 1711 s << INDENT << "}" << endl << endl; |
1716 } | 1712 |
1717 | 1713 s << INDENT << "static void __deleteNativeObject(void* ptr) {" << endl |
1718 if (d_class->typeEntry()->isValue()) | 1714 << INDENT << " qtd_" << d_class->name() << "_delete(ptr);" << endl |
1719 { | |
1720 s << INDENT << "public static void __deleteNativeObject(void* ptr) {" << endl | |
1721 << INDENT << " qtd_" << d_class->name() << "_destructor(ptr);" << endl | |
1722 << INDENT << "}" << endl << endl; | 1715 << INDENT << "}" << endl << endl; |
1723 } | 1716 |
1724 | 1717 s << INDENT << "static void __callNativeDestructor(void* nativeId) {" << endl |
1725 if (d_class->typeEntry()->isValue()) | 1718 << INDENT << " qtd_" << d_class->name() << "_destroy(nativeId);" << endl |
1726 { | |
1727 s << INDENT << "public static void __callNativeDestructor(void* ptr) {" << endl | |
1728 << INDENT << " qtd_" << d_class->name() << "_call_destructor(ptr);" << endl | |
1729 << INDENT << "}" << endl << endl; | 1719 << INDENT << "}" << endl << endl; |
1730 } | 1720 } |
1731 } | 1721 } |
1732 | 1722 |
1733 void DGenerator::writeFlagsSetter(QTextStream &s, const AbstractMetaClass *d_class) | 1723 void DGenerator::writeFlagsSetter(QTextStream &s, const AbstractMetaClass *d_class) |
2480 } | 2470 } |
2481 | 2471 |
2482 // if (d_class->needsConversionFunc) | 2472 // if (d_class->needsConversionFunc) |
2483 writeConversionFunction(s, d_class); | 2473 writeConversionFunction(s, d_class); |
2484 | 2474 |
2485 if (d_class->hasConstructors() && !d_class->isQObject()) | 2475 if (d_class->hasConstructors() && d_class->isDestructorBase()) |
2486 s << "extern (C) void qtd_" << d_class->name() << "_destructor(void *ptr);" << endl | 2476 s << "extern (C) void qtd_" << d_class->name() << "_delete(void *ptr);" << endl |
2487 << "extern (C) void qtd_" << d_class->name() << "_call_destructor(void *ptr);" << endl << endl; | 2477 << "extern (C) void qtd_" << d_class->name() << "_destroy(void *ptr);" << endl << endl; |
2488 | 2478 |
2489 // qtd | 2479 // qtd |
2490 | 2480 |
2491 s << endl << "// C wrappers for signal emitters" << endl; | 2481 s << endl << "// C wrappers for signal emitters" << endl; |
2492 | 2482 |