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_hidden public
00047 #define k_dcop public
00048 #define ASYNC void
00049 
00066 class DCOPObject
00067 {
00068 public:
00073   DCOPObject();
00079   DCOPObject(QObject *obj);
00084   DCOPObject(const QCString &objId);
00089   virtual ~DCOPObject();
00090 
00095   QCString objId() const;
00096 
00103   bool setObjId(const QCString &objId);
00104 
00136   virtual bool process(const QCString &fun, const QByteArray &data,
00137                QCString& replyType, QByteArray &replyData);
00138 
00139 
00162   virtual bool processDynamic(const QCString &fun, const QByteArray &data,
00163                   QCString& replyType, QByteArray &replyData);
00164 
00176   virtual QCStringList functionsDynamic();
00177 
00189   virtual QCStringList interfacesDynamic();
00190 
00200   virtual QCStringList interfaces();
00201 
00220   virtual QCStringList functions();
00221 
00228   void emitDCOPSignal( const QCString &signal, const QByteArray &data);
00229 
00249   bool connectDCOPSignal( const QCString &sender, const QCString &senderObj,
00250                           const QCString &signal,
00251                           const QCString &slot,
00252                           bool Volatile);
00253 
00271   bool disconnectDCOPSignal( const QCString &sender, const QCString &senderObj,
00272                              const QCString &signal,
00273                              const QCString &slot);
00274 
00283   DCOPClient *callingDcopClient();
00284 
00289   void setCallingDcopClient(DCOPClient *);
00290 
00298   static bool hasObject(const QCString &objId);
00299 
00306   static DCOPObject *find(const QCString &objId);
00307 
00308 
00318   static QPtrList<DCOPObject> match(const QCString &partialId);
00319 
00326   static QCString objectName( QObject* obj );
00327 
00328 private:
00332   QCString ident;
00333 
00334 protected:
00335   virtual void virtual_hook( int id, void* data );
00336 private:
00337   class DCOPObjectPrivate;
00338   DCOPObjectPrivate *d;
00339 };
00340 
00341 class DCOPObjectProxyPrivate;
00351 class DCOPObjectProxy
00352 {
00353 public:
00357     DCOPObjectProxy();
00358 
00365     DCOPObjectProxy( DCOPClient*);
00366 
00370     virtual ~DCOPObjectProxy();
00371 
00393     virtual bool process( const QCString& obj, const QCString& fun,
00394               const QByteArray& data,
00395               QCString& replyType, QByteArray &replyData );
00396 private:
00397     void* unused;
00398     void* unused_too;
00399     friend class DCOPClient;
00400     static QPtrList<DCOPObjectProxy>* proxies;
00401 protected:
00402     virtual void virtual_hook( int id, void* data );
00403 private:
00404     DCOPObjectProxyPrivate* d;
00405 };
00406 
00407 
00408 
00409 #endif
KDE Logo
This file is part of the documentation for dcop Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun May 16 22:00:42 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003