|
Public Methods |
| | DCOPRef () |
| | DCOPRef (const DCOPRef &ref) |
| | DCOPRef (const QCString &app, const QCString &obj="") |
| | DCOPRef (DCOPObject *object) |
| | DCOPRef (const QCString &app, const QCString &obj, const QCString &type) |
| bool | isNull () const |
| QCString | app () const |
| QCString | obj () const |
| QCString | object () const |
| QCString | type () const |
| DCOPRef & | operator= (const DCOPRef &) |
| void | setRef (const QCString &app, const QCString &obj="") |
| void | setRef (const QCString &app, const QCString &obj, const QCString &type) |
| void | clear () |
| DCOPClient * | dcopClient () const |
| void | setDCOPClient (DCOPClient *client) |
| DCOPReply | call (const QCString &fun) |
| template<class T1> DCOPReply | call (const QCString &fun, const T1 &t1) |
| template<class T1, class T2> DCOPReply | call (const QCString &fun, const T1 &t1, const T2 &t2) |
| template<class T1, class T2, class T3> DCOPReply | call (const QCString &fun, const T1 &t1, const T2 &t2, const T3 &t3) |
| template<class T1, class T2, class T3, class T4> DCOPReply | call (const QCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4) |
| template<class T1, class T2, class T3, class T4, class T5> DCOPReply | call (const QCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5) |
| template<class T1, class T2, class T3, class T4, class T5, class T6> DCOPReply | call (const QCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6) |
| template<class T1, class T2, class T3, class T4, class T5, class T6, class T7> DCOPReply | call (const QCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6, const T7 &t7) |
| template<class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8> DCOPReply | call (const QCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8) |
| bool | send (const QCString &fun) |
| template<class T1> bool | send (const QCString &fun, const T1 &t1) |
| template<class T1, class T2> bool | send (const QCString &fun, const T1 &t1, const T2 &t2) |
| template<class T1, class T2, class T3> bool | send (const QCString &fun, const T1 &t1, const T2 &t2, const T3 &t3) |
| template<class T1, class T2, class T3, class T4> bool | send (const QCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4) |
| template<class T1, class T2, class T3, class T4, class T5> bool | send (const QCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5) |
| template<class T1, class T2, class T3, class T4, class T5, class T6> bool | send (const QCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6) |
| template<class T1, class T2, class T3, class T4, class T5, class T6, class T7> bool | send (const QCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6, const T7 &t7) |
| template<class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8> bool | send (const QCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8) |
A DCOP reference makes it possible to return references to other DCOP objects in a DCOP interface, for example in the method giveMeAnotherObject() in an interface like this:
In addition, the reference can operate as a comfortable generic stub to call remote DCOP objects in cases where no DCOPStub is available. The advantage of using DCOPRef instead of the low-level functions DCOPClient::call() and DCOPClient::send() are the nicer syntax and the implicit runtime error checking.
Say you want to call the method "doSomething" from the above interface on an object called "example" that lives in application "foo". Using DCOPRef, you would write
If it is important for you to know whether the call succeeded or not, you can use the slightly more elaborate pattern:
For curiosity, here is how you would achieve the exactly same functionality by using DCOPClient::call() directly:
As you might see from the code snippet, the DCOPRef has to "guess" the names of the datatypes of the arguments to construct a dcop call. This is done through global inline overloads of the dcopTypeName function, for example
If you use custom data types that do support QDataStream but have no corrsponding dcopTypeName overload, you can either provide such an overload or use a DCOPArg wrapper that allows you to specify the type.