dcop Library API Documentation

dcopsignals.h

00001 /*
00002 Copyright (c) 2000 Waldo Bastian <bastian@kde.org>
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a copy
00005 of this software and associated documentation files (the "Software"), to deal
00006 in the Software without restriction, including without limitation the rights
00007 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00008 copies of the Software, and to permit persons to whom the Software is
00009 furnished to do so, subject to the following conditions:
00010 
00011 The above copyright notice and this permission notice shall be included in
00012 all copies or substantial portions of the Software.
00013 
00014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00017 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00018 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00019 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00020 */
00021 
00022 #ifndef DCOPSIGNALS_H
00023 #define DCOPSIGNALS_H "$Id: dcopsignals.h,v 1.5 2002/09/29 13:05:01 tjansen Exp $"
00024 
00025 #include <qdict.h>
00026 #include <qptrlist.h>
00027 #include <qstring.h>
00028 
00029 class DCOPConnection;
00030 
00031 //
00032 // This requires:
00033 // DCOPSignalConnectionList * DCOPConnection::signalConnectionList()
00035 class DCOPSignalConnection
00036 {
00037 public:
00038    QCString sender;      // Sender client, empty means any client
00039    DCOPConnection *senderConn; //Sender client.
00040    QCString senderObj;   // Object that sends the signal.
00041    QCString signal;      // Signal name. Connections are sorted on signal name.
00042 
00043    DCOPConnection *recvConn; // Client that wants to receive the signal
00044    QCString recvObj;     // Object that wants to receive the signal
00045    QCString slot;        // Function to send to in the object.
00046 };
00047 
00049 class DCOPSignalConnectionList : public QPtrList<DCOPSignalConnection>
00050 {
00051 public:
00052    DCOPSignalConnectionList() { };
00053 };
00054 
00058 class DCOPSignals
00059 {
00060 public:
00061    DCOPSignals();
00062 
00071    void emitSignal( DCOPConnection *conn, const QCString &fun, const QByteArray &data, bool excludeSelf);
00072 
00087    bool connectSignal( const QCString &sender, const QCString &senderObj,
00088                        const QCString &signal,
00089                        DCOPConnection *conn, const QCString &receiverObj,
00090                        const QCString &slot, bool Volatile);
00091 
00101    bool disconnectSignal( const QCString &sender, const QCString &senderObj,
00102                        const QCString &signal,
00103                        DCOPConnection *conn, const QCString &receiverObj,
00104                        const QCString &slot);
00105 
00112    void removeConnections(DCOPConnection *conn, const QCString &obj=0);
00113 
00114 
00115    /*
00116     * The administration.
00117     *
00118     * All connections are sorted by "signal" and then inserted in the
00119     * administration as a list.
00120     *
00121     * connections[signal] gives a list of all connections related to
00122     * a given signal. The connections in this list may specify different
00123     * senders and receiving clients/objects.
00124     */
00125    QAsciiDict<DCOPSignalConnectionList> connections;
00126 };
00127 
00128 //
00129 // connectSignal:
00130 //
00131 // Check whether signal and slot match wrt arguments.
00132 // A slot may ignore arguments from the signal.
00133 //
00134 // If volatile
00135 //    then lookup senderConn...
00136 //         If not found?
00137 //            then return false
00138 // Create DCOPSignalConnection.
00139 // Add DCOPSignalConnection to "connections".
00140 // Add DCOPSignalConnection to conn->connectionList()
00141 // If volatile
00142 //    then Add DCOPSignalConnection to senderConn->connectionList()
00143 // Return true
00144 
00145 
00146 // removeConnections:
00147 //
00148 // For each DCOPSignalConnection in conn->connectionList
00149 //    if DCOPSignalConnection->sender == conn->appId
00150 //        then remove DCOPSignalConnection from DCOPSIgnalConnection->conn
00151 //    if DCOPSignalConnection->conn == conn
00152 //       then.. this is ugly.. remove DCOPSignalConnection from DCOPSignalConnection->sender
00153 //    WARNING: Take care when sender and conn are the same client!
00154 //    Remove DCOPSignalConnection from connections[DCOPSignalConnection->signal]
00155 
00156 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:20:25 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001