dcop Library API Documentation

dcopobject.h

00001 /*
00002 Copyright (c) 1999,2000 Preston Brown <pbrown@kde.org>
00003 Copyright (c) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
00004 
00005 Permission is hereby granted, free of charge, to any person obtaining a copy
00006 of this software and associated documentation files (the "Software"), to deal
00007 in the Software without restriction, including without limitation the rights
00008 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00009 copies of the Software, and to permit persons to whom the Software is
00010 furnished to do so, subject to the following conditions:
00011 
00012 The above copyright notice and this permission notice shall be included in
00013 all copies or substantial portions of the Software.
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00018 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00019 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00020 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00021 */
00022 
00023 #ifndef _DCOPOBJECT_H
00024 #define _DCOPOBJECT_H
00025 
00026 #include <qobject.h>
00027 #include <qmap.h>
00028 #include <qstring.h>
00029 #include <qptrlist.h>
00030 #include <qvaluelist.h>
00031 #include <kdatastream.h> // needed for proper bool marshalling
00032 
00033 class DCOPClient;
00034 typedef QValueList<QCString> QCStringList;
00035 
00036 // Makros for DCOP interfaces
00037 
00038 #define K_DCOP \
00039 public:        \
00040   virtual bool process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData); \
00041   QCStringList functions(); \
00042   QCStringList interfaces(); \
00043 private:
00044 
00045 #define k_dcop_signals public
00046 #define k_dcop public
00047 #define ASYNC void
00048 
00065 class DCOPObject
00066 {
00067 public:
00072   DCOPObject();
00078   DCOPObject(QObject *obj);
00083   DCOPObject(const QCString &objId);
00088   virtual ~DCOPObject();
00089 
00094   QCString objId() const;
00095 
00102   bool setObjId(const QCString &objId);
00103 
00135   virtual bool process(const QCString &fun, const QByteArray &data,
00136                QCString& replyType, QByteArray &replyData);
00137 
00138 
00161   virtual bool processDynamic(const QCString &fun, const QByteArray &data,
00162                   QCString& replyType, QByteArray &replyData);
00163 
00175   virtual QCStringList functionsDynamic();
00176 
00188   virtual QCStringList interfacesDynamic();
00189 
00199   virtual QCStringList interfaces();
00200 
00219   virtual QCStringList functions();
00220 
00227   void emitDCOPSignal( const QCString &signal, const QByteArray &data);
00228 
00248   bool connectDCOPSignal( const QCString &sender, const QCString &senderObj,
00249                           const QCString &signal,
00250                           const QCString &slot,
00251                           bool Volatile);
00252 
00270   bool disconnectDCOPSignal( const QCString &sender, const QCString &senderObj,
00271                              const QCString &signal,
00272                              const QCString &slot);
00273 
00282   DCOPClient *callingDcopClient();
00283 
00288   void setCallingDcopClient(DCOPClient *);
00289 
00297   static bool hasObject(const QCString &objId);
00298 
00305   static DCOPObject *find(const QCString &objId);
00306 
00307 
00317   static QPtrList<DCOPObject> match(const QCString &partialId);
00318 
00325   static QCString objectName( QObject* obj );
00326 
00327 private:
00331   QCString ident;
00332 
00333 protected:
00334   virtual void virtual_hook( int id, void* data );
00335 private:
00336   class DCOPObjectPrivate;
00337   DCOPObjectPrivate *d;
00338 };
00339 
00340 class DCOPObjectProxyPrivate;
00350 class DCOPObjectProxy
00351 {
00352 public:
00356     DCOPObjectProxy();
00357 
00364     DCOPObjectProxy( DCOPClient*);
00365 
00369     virtual ~DCOPObjectProxy();
00370 
00391     virtual bool process( const QCString& obj, const QCString& fun,
00392               const QByteArray& data,
00393               QCString& replyType, QByteArray &replyData );
00394 private:
00395     void* unused;
00396     void* unused_too;
00397     friend class DCOPClient;
00398     static QPtrList<DCOPObjectProxy>* proxies;
00399 protected:
00400     virtual void virtual_hook( int id, void* data );
00401 private:
00402     DCOPObjectProxyPrivate* d;
00403 };
00404 
00405 
00406 
00407 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:14:34 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001