From a486c7b0cdf727de6aeb521d7ae571d1c443c9c4 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Date: Tue, 9 Jun 2015 14:02:23 +0200
Subject: [PATCH] dumpcpp: Add Qt version and command line to header comment
 block.

produces:

/****************************************************************************
**
** Namespace TestLib generated by dumpcpp v5.5.0 using
** dumpcpp -o test Test.tlb
** from the type library Test.tlb
**
****************************************************************************/

Task-number: QTBUG-27792
Change-Id: I22ef45c424f07ae89e2cbae1d8c05686b0646c5c
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
---
 tools/dumpcpp/main.cpp | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/tools/dumpcpp/main.cpp b/tools/dumpcpp/main.cpp
index 691e723f..1fbcaa80 100644
--- a/tools/dumpcpp/main.cpp
+++ b/tools/dumpcpp/main.cpp
@@ -893,6 +893,15 @@ void generateClassImpl(QTextStream &out, const QMetaObject *mo, const QByteArray
     out << '}' << endl;
 }
 
+static void formatCommentBlockFooter(const QString &typeLibFile, QTextStream &str)
+{
+    str << " generated by dumpcpp v" << QT_VERSION_STR << " using\n**";
+    foreach (const QString &arg, QCoreApplication::arguments())
+        str << ' ' << arg;
+    str << "\n** from the type library " << typeLibFile << "\n**\n"
+        << "****************************************************************************/\n\n";
+}
+
 bool generateTypeLibrary(QString typeLibFile, QString outname,
                          const QString &nameSpace, ObjectCategory category)
 {
@@ -947,13 +956,9 @@ bool generateTypeLibrary(QString typeLibFile, QString outname,
             return false;
         }
 
-        implOut << "/****************************************************************************" << endl;
-        implOut << "**" << endl;
-        implOut << "** Metadata for " << libName << " generated by dumpcpp from type library" << endl;
-        implOut << "** " << typeLibFile << endl;
-        implOut << "**" << endl;
-        implOut << "****************************************************************************/" << endl;
-        implOut << endl;
+        implOut << "/****************************************************************************\n"
+                   "**\n** Metadata for " << libName;
+        formatCommentBlockFooter(typeLibFile, implOut);
 
         implOut << "#define QAX_DUMPCPP_" << libName.toUpper() << "_NOINLINES" << endl;
 
@@ -978,13 +983,9 @@ bool generateTypeLibrary(QString typeLibFile, QString outname,
             return false;
         }
 
-        declOut << "/****************************************************************************" << endl;
-        declOut << "**" << endl;
-        declOut << "** Namespace " << libName << " generated by dumpcpp from type library" << endl;
-        declOut << "** " << typeLibFile << endl;
-        declOut << "**" << endl;
-        declOut << "****************************************************************************/" << endl;
-        declOut << endl;
+        declOut << "/****************************************************************************\n"
+                   "**\n** Namespace " << libName;
+        formatCommentBlockFooter(typeLibFile, declOut);
 
         QFileInfo cppFileInfo(outname);
         writeHeader(declOut, libName, cppFileInfo.fileName());
-- 
GitLab