20 #include <tdeuniqueapplication.h>
21 #include <tdeaboutdata.h>
22 #include <tdecmdlineargs.h>
24 #include <dcopclient.h>
26 #include <tqvaluelist.h>
27 #include <tqcstring.h>
29 #include <kartsdispatcher.h>
30 #include <soundserver.h>
31 #include <dispatcher.h>
35 #include "mcopdcopobject.h"
46 TQPtrList<MCOPDCOPObject> list;
49 int main(
int argc,
char **argv)
53 TDEAboutData::License_GPL,
"(C) 2001, Nikolas Zimmermann");
54 aboutdata.addAuthor(
"Nikolas Zimmermann",
I18N_NOOP(
"Author"),
"wildfox@kde.org");
77 KMCOP::KMCOP() : TQObject(), DCOPObject(
"arts")
79 d =
new KMCOPPrivate();
80 d->mcopInfo = Reference(
"global:Arts_MCOPInfo");
81 d->list.setAutoDelete(
true);
89 int KMCOP::objectCount()
91 return d->mcopInfo.objectCount();
94 TQCString KMCOP::correctType(
const TQCString &str)
101 void KMCOP::addInterfacesHackHackHack()
103 for(
int i = 0; i <= objectCount(); i++)
105 Arts::Object obj = d->mcopInfo.objectForNumber(i);
109 TQCString interfaceName = obj._interfaceName().c_str();
111 if(interfaceName !=
"Arts::TraderOffer")
113 Arts::InterfaceRepo ifaceRepo = Dispatcher::the()->interfaceRepo();
115 MCOPDCOPObject *
interface = new MCOPDCOPObject(interfaceName);
116 d->list.append(interface);
118 InterfaceDef ifaceDef = ifaceRepo.queryInterface(
string(interfaceName));
119 vector<MethodDef> ifaceMethods = ifaceDef.methods;
121 vector<MethodDef>::iterator ifaceMethodsIterator;
122 for(ifaceMethodsIterator = ifaceMethods.begin(); ifaceMethodsIterator != ifaceMethods.end(); ifaceMethodsIterator++)
124 TQCString
function, signature;
126 MCOPEntryInfo *entry =
new MCOPEntryInfo();
128 MethodDef currentMethod = *ifaceMethodsIterator;
129 vector<ParamDef> currentParameters = currentMethod.signature;
131 TQCString newType = correctType(TQCString(currentMethod.type.c_str()));
133 entry->setFunctionType(newType);
134 entry->setFunctionName(TQCString(currentMethod.name.c_str()));
136 function = entry->functionType() + TQCString(
" ") + entry->functionName() + TQCString(
"(");
138 signature = TQCString(
"(");
140 QCStringList signatureList;
142 vector<ParamDef>::iterator methodParametersIterator;
143 for(methodParametersIterator = currentParameters.begin(); methodParametersIterator != currentParameters.end(); methodParametersIterator++)
145 ParamDef parameter = *methodParametersIterator;
146 if(methodParametersIterator != currentParameters.begin())
148 function += TQCString(
", ");
149 signature += TQCString(
",");
152 TQCString correctParameter = correctType(TQCString(parameter.type.c_str()));
154 function += correctParameter;
155 signature += correctParameter;
157 signatureList.append(TQCString(parameter.type.c_str()));
160 function += TQCString(
")");
161 signature += TQCString(
")");
163 entry->setSignature(signature);
164 entry->setSignatureList(signatureList);
166 interface->addDynamicFunction(
function, entry);
KArtsDispatcher ensures that an instance of Arts::Dispatcher using an Arts::QIOManager exists.
void disableSessionManagement()
static DCOPClient * dcopClient()
static void init(int _argc, char **_argv, const char *_appname, const char *programName, const char *_description, const char *_version, bool noKApp=false)
static void addCmdLineOptions()
kndbgstream & endl(kndbgstream &s)
kdbgstream kdDebug(int area=0)