• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • arts
 

arts

  • arts
  • kde
  • mcop-dcop
kmcop.cpp
1/*
2 Copyright (c) 2001 Nikolas Zimmermann <wildfox@kde.org>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17*/
18
19#include <kdebug.h>
20#include <tdeuniqueapplication.h>
21#include <tdeaboutdata.h>
22#include <tdecmdlineargs.h>
23#include <tdelocale.h>
24#include <dcopclient.h>
25
26#include <tqvaluelist.h>
27#include <tqcstring.h>
28
29#include <kartsdispatcher.h>
30#include <soundserver.h>
31#include <dispatcher.h>
32#include <object.h>
33#include <core.h>
34
35#include "mcopdcopobject.h"
36
37#include "kmcop.moc"
38
39using namespace Arts;
40using namespace std;
41
42class KMCOPPrivate
43{
44public:
45 MCOPInfo mcopInfo;
46 TQPtrList<MCOPDCOPObject> list;
47};
48
49int main(int argc, char **argv)
50{
51 TDEAboutData aboutdata("kmcop", I18N_NOOP("KMCOP"),
52 "0.1", I18N_NOOP("TDE MCOP-DCOP Bridge"),
53 TDEAboutData::License_GPL, "(C) 2001, Nikolas Zimmermann");
54 aboutdata.addAuthor("Nikolas Zimmermann", I18N_NOOP("Author"), "wildfox@kde.org");
55
56 TDECmdLineArgs::init(argc, argv, &aboutdata);
57 TDEUniqueApplication::addCmdLineOptions();
58
59 if(!TDEUniqueApplication::start())
60 {
61 kdDebug() << "Running kmcop found" << endl;
62 return 0;
63 }
64
65 TDEUniqueApplication app;
66 app.disableSessionManagement();
67
68 KArtsDispatcher dispatcher;
69
70 KMCOP notify;
71 app.dcopClient()->setDefaultObject("arts");
72 app.dcopClient()->setDaemonMode(true);
73
74 return app.exec();
75}
76
77KMCOP::KMCOP() : TQObject(), DCOPObject("arts")
78{
79 d = new KMCOPPrivate();
80 d->mcopInfo = Reference("global:Arts_MCOPInfo");
81 d->list.setAutoDelete(true);
82}
83
84KMCOP::~KMCOP()
85{
86 delete d;
87}
88
89int KMCOP::objectCount()
90{
91 return d->mcopInfo.objectCount();
92}
93
94TQCString KMCOP::correctType(const TQCString &str)
95{
96 if(str == "string")
97 return "TQCString";
98 return str;
99}
100
101void KMCOP::addInterfacesHackHackHack()
102{
103 for(int i = 0; i <= objectCount(); i++)
104 {
105 Arts::Object obj = d->mcopInfo.objectForNumber(i);
106
107 if(!obj.isNull())
108 {
109 TQCString interfaceName = obj._interfaceName().c_str();
110
111 if(interfaceName != "Arts::TraderOffer")
112 {
113 Arts::InterfaceRepo ifaceRepo = Dispatcher::the()->interfaceRepo();
114
115 MCOPDCOPObject *interface = new MCOPDCOPObject(interfaceName);
116 d->list.append(interface);
117
118 InterfaceDef ifaceDef = ifaceRepo.queryInterface(string(interfaceName));
119 vector<MethodDef> ifaceMethods = ifaceDef.methods;
120
121 vector<MethodDef>::iterator ifaceMethodsIterator;
122 for(ifaceMethodsIterator = ifaceMethods.begin(); ifaceMethodsIterator != ifaceMethods.end(); ifaceMethodsIterator++)
123 {
124 TQCString function, signature;
125
126 MCOPEntryInfo *entry = new MCOPEntryInfo();
127
128 MethodDef currentMethod = *ifaceMethodsIterator;
129 vector<ParamDef> currentParameters = currentMethod.signature;
130
131 TQCString newType = correctType(TQCString(currentMethod.type.c_str()));
132
133 entry->setFunctionType(newType);
134 entry->setFunctionName(TQCString(currentMethod.name.c_str()));
135
136 function = entry->functionType() + TQCString(" ") + entry->functionName() + TQCString("(");
137
138 signature = TQCString("(");
139
140 QCStringList signatureList;
141
142 vector<ParamDef>::iterator methodParametersIterator;
143 for(methodParametersIterator = currentParameters.begin(); methodParametersIterator != currentParameters.end(); methodParametersIterator++)
144 {
145 ParamDef parameter = *methodParametersIterator;
146 if(methodParametersIterator != currentParameters.begin())
147 {
148 function += TQCString(", ");
149 signature += TQCString(",");
150 }
151
152 TQCString correctParameter = correctType(TQCString(parameter.type.c_str()));
153
154 function += correctParameter;
155 signature += correctParameter;
156
157 signatureList.append(TQCString(parameter.type.c_str()));
158 }
159
160 function += TQCString(")");
161 signature += TQCString(")");
162
163 entry->setSignature(signature);
164 entry->setSignatureList(signatureList);
165
166 interface->addDynamicFunction(function, entry);
167 }
168 }
169 }
170 }
171}
KArtsDispatcher
KArtsDispatcher ensures that an instance of Arts::Dispatcher using an Arts::QIOManager exists.
Definition: kartsdispatcher.h:65
TDEAboutData
TDEApplication::disableSessionManagement
void disableSessionManagement()
TDEApplication::dcopClient
static DCOPClient * dcopClient()
TDECmdLineArgs::init
static void init(int _argc, char **_argv, const char *_appname, const char *programName, const char *_description, const char *_version, bool noTDEApp=false)
I18N_NOOP
#define I18N_NOOP(x)
TDEUniqueApplication
TDEUniqueApplication::start
static bool start()
TDEUniqueApplication::addCmdLineOptions
static void addCmdLineOptions()
endl
kndbgstream & endl(kndbgstream &s)
kdDebug
kdbgstream kdDebug(int area=0)
tdelocale.h

arts

Skip menu "arts"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

arts

Skip menu "arts"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for arts by doxygen 1.9.4
This website is maintained by Timothy Pearson.