summaryrefslogtreecommitdiffstats
path: root/dcoppython/test/dcopserver/gen.py
diff options
context:
space:
mode:
Diffstat (limited to 'dcoppython/test/dcopserver/gen.py')
-rw-r--r--dcoppython/test/dcopserver/gen.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/dcoppython/test/dcopserver/gen.py b/dcoppython/test/dcopserver/gen.py
new file mode 100644
index 00000000..ae2947af
--- /dev/null
+++ b/dcoppython/test/dcopserver/gen.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+type_list = ['KURL', 'QDate', 'QTime', 'QDateTime', 'QRect', 'QString', 'int', 'QFont', 'QSize', 'QPoint', 'QPointArray' ]
+
+inc_exceptions = {'QDate': None, 'QTime': None, 'KURL' : 'kurl'}
+
+iface_inc_list = ['dcopobject']
+
+iface_inc_list += [ t.lower() for t in type_list if t[0]=='Q' and t not in inc_exceptions ]
+iface_inc_list += inc_exceptions.values()
+
+iface_inc_1 = ['class DCOPDemoIface : virtual public DCOPObject {',
+ ' K_DCOP',
+ ' k_dcop:']
+h_inc = []
+cpp_inc = []
+
+for t in type_list:
+ iface_inc_1.append("virtual void set%sVal(const %s &val) = 0; " % (t,t) )
+ iface_inc_1.append("virtual %s %sVal() const = 0;" % (t,t) )
+
+ h_inc.append("virtual void set%sVal(const %s &val); " % (t,t) )
+ h_inc.append("virtual %s %sVal() const;" % (t,t) )
+ h_inc.append("%s m_%sValue;" % (t,t) )
+
+ cpp_inc.append("void MainClass::set%sVal(const %s & val) {" % (t,t) )
+ cpp_inc.append(" m_%sValue = val; }" % t)
+ cpp_inc.append("%s MainClass::%sVal() const {" % (t,t) )
+ cpp_inc.append(" return m_%sValue; }" % t)
+
+iface_inc = []
+for inc in iface_inc_list:
+ if inc: iface_inc.append("#include <%s.h>" % inc)
+iface_inc += iface_inc_1
+iface_inc.append("};")
+
+files = {'kdedcoptest_iface.h': iface_inc,
+ 'h_inc.h': h_inc,
+ 'cpp_inc.h': cpp_inc
+ }
+
+for (fname,data) in files.items():
+ outf = file(fname,'w')
+ for d in data:
+ outf.write(d+'\n')
+ outf.close()