diff options
author | Martin Pejcoch <martin.pejcoch@nokia.com> | 2010-11-01 17:00:23 (GMT) |
---|---|---|
committer | Eckhart Koppen <eckhart.koppen@nokia.com> | 2011-01-20 13:59:12 (GMT) |
commit | b7f2290fb746b8769ae2de2bc4278d2234a50a2d (patch) | |
tree | 776ce677ecbc84f37e140cdd910388e0c3351dbe | |
parent | fe2f9c5df0352044c1e9fc5ab36240917d5735b2 (diff) | |
download | Qt-b7f2290fb746b8769ae2de2bc4278d2234a50a2d.zip Qt-b7f2290fb746b8769ae2de2bc4278d2234a50a2d.tar.gz Qt-b7f2290fb746b8769ae2de2bc4278d2234a50a2d.tar.bz2 |
Use file names in header include guards instead of namespace names
dumpcpp used "-n" option value for guard macros in headers which was wrong,
because that implies that every QtAx COM wrapper must have a unique namespace.
Task-number: QTBUG-14383
Reviewed-by: Prasanth
-rw-r--r-- | tools/activeqt/dumpcpp/main.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/activeqt/dumpcpp/main.cpp b/tools/activeqt/dumpcpp/main.cpp index bb65806..f95d31d 100644 --- a/tools/activeqt/dumpcpp/main.cpp +++ b/tools/activeqt/dumpcpp/main.cpp @@ -48,6 +48,7 @@ #include <QStringList> #include <QUuid> #include <QWidget> +#include <QFileInfo> #include <qt_windows.h> #include <ocidl.h> @@ -129,10 +130,10 @@ void writeEnums(QTextStream &out, const QMetaObject *mo) } } -void writeHeader(QTextStream &out, const QByteArray &nameSpace) +void writeHeader(QTextStream &out, const QByteArray &nameSpace, const QString &outFileName) { - out << "#ifndef QAX_DUMPCPP_" << nameSpace.toUpper() << "_H" << endl; - out << "#define QAX_DUMPCPP_" << nameSpace.toUpper() << "_H" << endl; + out << "#ifndef QAX_DUMPCPP_" << outFileName.toUpper() << "_H" << endl; + out << "#define QAX_DUMPCPP_" << outFileName.toUpper() << "_H" << endl; out << endl; out << "// Define this symbol to __declspec(dllexport) or __declspec(dllimport)" << endl; out << "#ifndef " << nameSpace.toUpper() << "_EXPORT" << endl; @@ -880,7 +881,7 @@ bool generateClass(QAxObject *object, const QByteArray &className, const QByteAr out << "****************************************************************************/" << endl; out << endl; - writeHeader(out, nameSpace); + writeHeader(out, nameSpace, outfile.fileName()); generateNameSpace(out, mo, nameSpace); // close namespace file @@ -1040,7 +1041,8 @@ bool generateTypeLibrary(const QByteArray &typeLib, const QByteArray &outname, O declOut << "****************************************************************************/" << endl; declOut << endl; - writeHeader(declOut, libName.toLatin1()); + QFileInfo cppFileInfo(cppFile); + writeHeader(declOut, libName.toLatin1(), cppFileInfo.fileName()); UINT typeCount = typelib->GetTypeInfoCount(); if (declFile.isOpen()) { |