diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 90825e2392b2d70e43c7a25b8a3752299a933894 (patch) | |
tree | e33aa27f02b74604afbfd0ea4f1cfca8833d882a /dcoppython/test/dcopserver/gen.py | |
download | tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'dcoppython/test/dcopserver/gen.py')
-rw-r--r-- | dcoppython/test/dcopserver/gen.py | 46 |
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() |