# class DCOPObject | Provides an interface for receiving DCOP messages. More...
Definition | `#include <dcopobject.h>`
Inherited by | MyDCOPObject
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- DCOPObject ()
- DCOPObject (QObject *obj)
- DCOPObject (const QCString &objId)
- virtual ~DCOPObject ()
- QCString objId () const
- virtual bool process (const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
- virtual bool processDynamic (const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
- virtual QCStringList interfaces ()
- virtual QCStringList functions ()
- void emitDCOPSignal ( const QCString &signal, const QByteArray &data)
- bool connectDCOPSignal ( const QCString &sender, const QCString &senderObj, const QCString &signal, const QCString &slot, bool Volatile)
- bool disconnectDCOPSignal ( const QCString &sender, const QCString &senderObj, const QCString &signal, const QCString &slot)

#### Public Static Methods

- static bool hasObject (const QCString &objId)
- static DCOPObject * find (const QCString &objId)
- static QList<DCOPObject> match (const QCString &partialId)
- static QCString objectName ( QObject* obj )

## Detailed Description

Provides an interface for receiving DCOP messages.

This class provides an interface for receiving DCOP messages. To use it, simply multiply-inherit from DCOPObject and from some other class, and then implement the DCOPObject::process() method. Because this method is pure virtual, you `must` implement the method.

DCOPObject () | ### DCOPObject

Creates a DCOPObject and calculates the object id using its physical memory address.

DCOPObject (QObject *obj) | ### DCOPObject

Creates a DCOPObject and calculates the object id using QObject::name().

DCOPObject (const QCString &objId) | ### DCOPObject

Creates a DCOPObject with object Id `objId`.

~DCOPObject () | ### ~DCOPObject

[virtual]

Destroys the DCOPObject and removes it from the map of known objects.

QCString objId () | ### objId

[const]

bool process (const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData) | ### process

[virtual]

Dispatches a message.

Usually you want to use an IDL compiler to automatically generate an implementation for this function.

If this function returns `false`, then processDynamic() is called.

Note to implementators: remember to call the baseclasses implementation.

Parameters:

fun | is the normalized function signature. Such a signature usually looks like `foobar`(QString,int). The return type, qualifiers like "const" etc. are not part of the signature.

See also: DCOPClient::normalizeFunctionSignature(), functions()

bool processDynamic (const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData) | ### processDynamic

[virtual]

This function is of interest when you used an IDL compiler to generate the implementation for process() but you still want to dispatch some functions dynamically. Dynamically means that methods may appear and vanish during runtime.

Returns: `false` by default.

See also: process(), DCOPClient::normalizeFunctionSignature(), functions()

QCStringList interfaces () | ### interfaces

[virtual]

Returns the names of the interfaces, specific ones last. The functions gets reimplemented by the IDL compiler. If you don't use the IDL compiler, consider implementing this function manually if you want your object to be easily explorable.

See also: functions()

QCStringList functions () | ### functions

[virtual]

Returns the list of functions understood by the object. It gets reimplemented by the IDL compiler. If you don't use the IDL compiler, consider implementing this function manually if you want your object to be easily scriptable.

Rationale: functions() allows an interpreter to do client-side type-casting properly.

Note to implementators: remember to call the baseclasses implementation.

See also: process(), processDynamic(), DCOPClient::normalizeFunctionSignature()

void emitDCOPSignal ( const QCString &signal, const QByteArray &data) | ### emitDCOPSignal

Emit `signal` as DCOP signal from this object with `data` as arguments

bool connectDCOPSignal ( const QCString &sender, const QCString &senderObj, const QCString &signal, const QCString &slot, bool Volatile) | ### connectDCOPSignal

Connect to a DCOP signal

- `Volatile` is true and `sender` does not exist.
- `signal` and `slot` do not have matching arguments.

Parameters:

sender | the name of the client that emits the signal. When empty the signal will be passed from any client.
senderObj | the name of the sending object that emits the signal.
signal | the name of the signal. The arguments should match with slot.
slot | The name of the slot to call. Its arguments should match with signal.
Volatile | If true, the connection will not be reestablished when `sender` unregisters and reregisters with DCOP. In this case the `sender` must be registered when the connection is made. If false, the connection will be reestablished when `sender` reregisters. In this case the connection can be made even if `sender` is not registered at that time.

Returns: false if a connection could not be established. This will be the case when

bool disconnectDCOPSignal ( const QCString &sender, const QCString &senderObj, const QCString &signal, const QCString &slot) | ### disconnectDCOPSignal

Disconnect a DCOP signal

A special case is when both sender & signal are empty. In this case all connections related to this object in the current client are disconnected. (Both connections from as well as to this object!)

Parameters:

sender | the name of the client that emits the signal.
senderObj | the name of the object that emits the signal. If empty all objects will be disconnected.
signal | the name of the signal. The arguments should match with slot. If empty all objects will be disconnected.
slot | The name of the slot the signal is connected to. If empty all slots will be disconnected.

Returns: false if no connection(s) where removed.

bool hasObject (const QCString &objId) | ### hasObject

[static]

DCOPObjectProxy

Returns: `true` if an obejct with the questionable `objId` is known in this process. This query does not ask proxies.

DCOPObject * find (const QCString &objId) | ### find

[static]

This function does not query the DCOPObjectProxy.

Returns: the DCOPObject for the id `objId`.

QList<DCOPObject> match (const QCString &partialId) | ### match

[static]

This function is used for multicasting a DCOP message to several objects inside a single process.

Returns: a list of DCOPObjects beginning with the string contained in `partialId`.

QCString objectName ( QObject* obj ) | ### objectName

[static]

Creates an object id for the QObject `obj`. This is done using the QObject::name() function.

- Author: Preston Brown <pbrown@kde.org>, Matthias Ettrich <ettrich@kde.org>
- Generated: root@sparc.ports.openbsd.org on Wed May 2 09:33:39 2001, using kdoc 2.0a53.