summaryrefslogtreecommitdiff
path: root/tools/activeqt
diff options
context:
space:
mode:
authorMartin Pejcoch <martin.pejcoch@nokia.com>2010-11-01 18:00:23 +0100
committerMartin Pejcoch <martin.pejcoch@nokia.com>2011-01-18 11:32:00 +0100
commitf3f4e93f482c1ff579cb78cc1765a6930de3d766 (patch)
tree402c53eec44858293c0a68f010069d11505c52b0 /tools/activeqt
parentc6e447fefb99c569d22e7c34181d30ce62ffe2bf (diff)
downloadqt4-tools-f3f4e93f482c1ff579cb78cc1765a6930de3d766.tar.gz
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
Diffstat (limited to 'tools/activeqt')
-rw-r--r--tools/activeqt/dumpcpp/main.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/activeqt/dumpcpp/main.cpp b/tools/activeqt/dumpcpp/main.cpp
index bb65806dee..f95d31df83 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()) {