[Telepathy-commits] [telepathy-qt4/master] Replace the types/parentinclude params in {client, types}-gen with a comma-separated extraincludes list to be able to include eg. the parent main interface header and parent types header in extensions

Olli Salli olli.salli at collabora.co.uk
Mon Sep 29 13:05:11 PDT 2008


---
 TelepathyQt4/Makefile.am |    2 +-
 tools/qt4-client-gen.py  |   21 ++++++++++++++-------
 tools/qt4-types-gen.py   |   14 +++++++-------
 3 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/TelepathyQt4/Makefile.am b/TelepathyQt4/Makefile.am
index 4d8deb7..9e98fa1 100644
--- a/TelepathyQt4/Makefile.am
+++ b/TelepathyQt4/Makefile.am
@@ -205,7 +205,7 @@ _gen/cli-%.h _gen/cli-%-body.hpp: _gen/spec-%.xml \
 		--prettyinclude='TelepathyQt4/Client/'$$prettyinclude \
 		--specxml=_gen/stable-spec.xml \
 		--ifacexml=$< \
-		--typesinclude='TelepathyQt4/Types' \
+		--extraincludes='<TelepathyQt4/Types>' \
 		$$mainiface
 
 %.moc.hpp: %.h _gen/constants.h _gen/types.h
diff --git a/tools/qt4-client-gen.py b/tools/qt4-client-gen.py
index 1a15c62..3f928d2 100644
--- a/tools/qt4-client-gen.py
+++ b/tools/qt4-client-gen.py
@@ -35,7 +35,7 @@ class Generator(object):
             self.typesnamespace = opts['--typesnamespace']
             self.realinclude = opts['--realinclude']
             self.prettyinclude = opts['--prettyinclude']
-            self.typesinclude = opts['--typesinclude']
+            self.extraincludes = opts.get('--extraincludes', None)
             self.mainiface = opts.get('--mainiface', None)
             ifacedom = xml.dom.minidom.parse(opts['--ifacexml'])
             specdom = xml.dom.minidom.parse(opts['--specxml'])
@@ -58,17 +58,24 @@ class Generator(object):
  * This file can be distributed under the same terms as the specification from
  * which it was generated.
  */
+""")
+
+        if self.extraincludes:
+            self.h('\n')
+            for include in self.extraincludes.split(','):
+                self.h('#include %s\n' % include)
+
+        self.h("""
+#include <QtGlobal>
 
 #include <QString>
 #include <QObject>
 #include <QVariant>
 
-#include <QtGlobal>
-#include <QtDBus>
-
-#include <%s>
+#include <QDBusAbstractInterface>
+#include <QDBusPendingReply>
 
-""" % self.typesinclude)
+""")
 
         self.b("""\
 #include <%s>
@@ -407,7 +414,7 @@ if __name__ == '__main__':
              'specxml=',
              'realinclude=',
              'prettyinclude=',
-             'typesinclude=',
+             'extraincludes=',
              'mainiface='])
 
     Generator(dict(options))()
diff --git a/tools/qt4-types-gen.py b/tools/qt4-types-gen.py
index 508d661..727e802 100644
--- a/tools/qt4-types-gen.py
+++ b/tools/qt4-types-gen.py
@@ -56,8 +56,8 @@ class Generator(object):
             self.declfile = opts['--declfile']
             self.implfile = opts['--implfile']
             self.realinclude = opts['--realinclude']
-            self.prettyinclude = opts.get('--prettyinclude' or self.realinclude)
-            self.parentinclude = opts.get('--parentinclude' or None)
+            self.prettyinclude = opts.get('--prettyinclude', self.realinclude)
+            self.extraincludes = opts.get('--extraincludes', None)
             dom = xml.dom.minidom.parse(opts['--specxml'])
         except KeyError, k:
             assert False, 'Missing required parameter %s' % k.args[0]
@@ -88,10 +88,10 @@ class Generator(object):
 
         self.gather_required()
 
-        if self.parentinclude:
-            self.decl("""
-#include <%s>
-""" % self.parentinclude)
+        if self.extraincludes:
+            self.decl('\n')
+            for include in self.extraincludes.split(','):
+                self.decl('#include %s' % include)
 
         self.decl("""
 #include <QtGlobal>
@@ -399,7 +399,7 @@ if __name__ == '__main__':
              'implfile=',
              'realinclude=',
              'prettyinclude=',
-             'parentinclude=',
+             'extraincludes=',
              'namespace=',
              'specxml='])
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list