26 #include <tqcstring.h>
27 #include <dcoptypes.h>
28 #include <kdatastream.h>
29 #include "tdelibs_export.h"
57 if ( typeCheck( dcopTypeName(t),
true ) ) {
58 TQDataStream reply( data, IO_ReadOnly );
70 template <
class T>
bool get( T& t,
const char* tname ) {
71 if ( typeCheck( tname,
false ) ) {
72 TQDataStream reply( data, IO_ReadOnly );
86 template <
class T>
bool get( T& t ) {
87 if ( typeCheck( dcopTypeName(t),
false ) ) {
88 TQDataStream reply( data, IO_ReadOnly );
99 inline bool isValid()
const {
return !type.isNull(); }
106 bool typeCheck(
const char* t );
107 bool typeCheck(
const char* t,
bool warn );
130 template <
class T>
DCOPArg(
const T& t,
const char* tname_arg )
133 TQDataStream ds( data, IO_WriteOnly );
145 : tname( dcopTypeName(t) )
147 TQDataStream ds( data, IO_WriteOnly );
157 inline const char* dcopTypeName(
const DCOPArg &arg ) {
return arg.
tname; }
159 { str.writeRawBytes( arg.
data.data(), arg.
data.size() );
return str; }
298 DCOPRef(
const TQCString& app,
const TQCString& obj =
"" );
316 DCOPRef(
const TQCString& app,
const TQCString& obj,
const TQCString& type );
329 TQCString app()
const;
336 TQCString obj()
const;
341 TQCString object()
const;
347 TQCString type()
const;
361 void setRef(
const TQCString& app,
const TQCString& obj =
"" );
369 void setRef(
const TQCString& app,
const TQCString& obj,
const TQCString& type );
419 return callInternal( fun,
"()", data );
438 return callInternal( fun,
"()", data, useEventLoop, timeout );
459 args.sprintf(
"(%s)",
462 TQDataStream ds( data, IO_WriteOnly );
464 return callInternal( fun, args, data );
487 args.sprintf(
"(%s)",
490 TQDataStream ds( data, IO_WriteOnly );
492 return callInternal( fun, args, data, useEventLoop, timeout );
512 template <
class T1,
class T2>
517 args.sprintf(
"(%s,%s)",
521 TQDataStream ds( data, IO_WriteOnly );
523 return callInternal( fun, args, data );
543 template <
class T1,
class T2>
549 args.sprintf(
"(%s,%s)",
553 TQDataStream ds( data, IO_WriteOnly );
555 return callInternal( fun, args, data, useEventLoop, timeout );
577 template <
class T1,
class T2,
class T3>
583 args.sprintf(
"(%s,%s,%s)",
588 TQDataStream ds( data, IO_WriteOnly );
589 ds << t1 << t2 << t3;
590 return callInternal( fun, args, data );
612 template <
class T1,
class T2,
class T3>
619 args.sprintf(
"(%s,%s,%s)",
624 TQDataStream ds( data, IO_WriteOnly );
625 ds << t1 << t2 << t3;
626 return callInternal( fun, args, data, useEventLoop, timeout );
650 template <
class T1,
class T2,
class T3,
class T4>
657 args.sprintf(
"(%s,%s,%s,%s)",
663 TQDataStream ds( data, IO_WriteOnly );
664 ds << t1 << t2 << t3 << t4;
665 return callInternal( fun, args, data );
689 template <
class T1,
class T2,
class T3,
class T4>
697 args.sprintf(
"(%s,%s,%s,%s)",
703 TQDataStream ds( data, IO_WriteOnly );
704 ds << t1 << t2 << t3 << t4;
705 return callInternal( fun, args, data, useEventLoop, timeout );
731 template <
class T1,
class T2,
class T3,
class T4,
class T5>
739 args.sprintf(
"(%s,%s,%s,%s,%s)",
746 TQDataStream ds( data, IO_WriteOnly );
747 ds << t1 << t2 << t3 << t4 << t5;
748 return callInternal( fun, args, data );
774 template <
class T1,
class T2,
class T3,
class T4,
class T5>
783 args.sprintf(
"(%s,%s,%s,%s,%s)",
790 TQDataStream ds( data, IO_WriteOnly );
791 ds << t1 << t2 << t3 << t4 << t5;
792 return callInternal( fun, args, data, useEventLoop, timeout );
820 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6>
829 args.sprintf(
"(%s,%s,%s,%s,%s,%s)",
837 TQDataStream ds( data, IO_WriteOnly );
838 ds << t1 << t2 << t3 << t4 << t5 << t6;
839 return callInternal( fun, args, data );
867 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6>
877 args.sprintf(
"(%s,%s,%s,%s,%s,%s)",
885 TQDataStream ds( data, IO_WriteOnly );
886 ds << t1 << t2 << t3 << t4 << t5 << t6;
887 return callInternal( fun, args, data, useEventLoop, timeout );
916 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7>
926 args.sprintf(
"(%s,%s,%s,%s,%s,%s,%s)",
935 TQDataStream ds( data, IO_WriteOnly );
936 ds << t1 << t2 << t3 << t4 << t5 << t6 << t7;
937 return callInternal( fun, args, data );
967 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7>
978 args.sprintf(
"(%s,%s,%s,%s,%s,%s,%s)",
987 TQDataStream ds( data, IO_WriteOnly );
988 ds << t1 << t2 << t3 << t4 << t5 << t6 << t7;
989 return callInternal( fun, args, data, useEventLoop, timeout );
1021 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8>
1032 args.sprintf(
"(%s,%s,%s,%s,%s,%s,%s,%s)",
1042 TQDataStream ds( data, IO_WriteOnly );
1043 ds << t1 << t2 << t3 << t4 << t5 << t6 << t7 << t8;
1044 return callInternal( fun, args, data );
1076 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8>
1088 args.sprintf(
"(%s,%s,%s,%s,%s,%s,%s,%s)",
1098 TQDataStream ds( data, IO_WriteOnly );
1099 ds << t1 << t2 << t3 << t4 << t5 << t6 << t7 << t8;
1100 return callInternal( fun, args, data, useEventLoop, timeout );
1116 bool send(
const TQCString& fun ) {
1118 return sendInternal( fun,
"()", data );
1138 bool send(
const TQCString& fun,
const T1& t1 ) {
1140 args.sprintf(
"(%s)",
1143 TQDataStream ds( data, IO_WriteOnly );
1145 return sendInternal( fun, args, data );
1165 template <
class T1,
class T2>
1170 args.sprintf(
"(%s,%s)",
1174 TQDataStream ds( data, IO_WriteOnly );
1176 return sendInternal( fun, args, data );
1198 template <
class T1,
class T2,
class T3>
1204 args.sprintf(
"(%s,%s,%s)",
1209 TQDataStream ds( data, IO_WriteOnly );
1210 ds << t1 << t2 << t3;
1211 return sendInternal( fun, args, data );
1235 template <
class T1,
class T2,
class T3,
class T4>
1242 args.sprintf(
"(%s,%s,%s,%s)",
1248 TQDataStream ds( data, IO_WriteOnly );
1249 ds << t1 << t2 << t3 << t4;
1250 return sendInternal( fun, args, data );
1276 template <
class T1,
class T2,
class T3,
class T4,
class T5>
1284 args.sprintf(
"(%s,%s,%s,%s,%s)",
1291 TQDataStream ds( data, IO_WriteOnly );
1292 ds << t1 << t2 << t3 << t4 << t5;
1293 return sendInternal( fun, args, data );
1321 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6>
1330 args.sprintf(
"(%s,%s,%s,%s,%s,%s)",
1338 TQDataStream ds( data, IO_WriteOnly );
1339 ds << t1 << t2 << t3 << t4 << t5 << t6;
1340 return sendInternal( fun, args, data );
1370 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7>
1380 args.sprintf(
"(%s,%s,%s,%s,%s,%s,%s)",
1389 TQDataStream ds( data, IO_WriteOnly );
1390 ds << t1 << t2 << t3 << t4 << t5 << t6 << t7;
1391 return sendInternal( fun, args, data );
1423 template <
class T1,
class T2,
class T3,
class T4,
class T5,
class T6,
class T7,
class T8>
1434 args.sprintf(
"(%s,%s,%s,%s,%s,%s,%s,%s)",
1444 TQDataStream ds( data, IO_WriteOnly );
1445 ds << t1 << t2 << t3 << t4 << t5 << t6 << t7 << t8;
1446 return sendInternal( fun, args, data );
1452 DCOPReply callInternal(
const TQCString& fun,
const TQCString& args,
const TQByteArray& data,
1453 EventLoopFlag useEventLoop,
int timeout );
1454 DCOPReply callInternal(
const TQCString& fun,
const TQCString& args,
const TQByteArray& data );
1455 bool sendInternal(
const TQCString& fun,
const TQCString& args,
const TQByteArray& data );
1461 class DCOPRefPrivate;
1472 DCOP_EXPORT TQDataStream& operator>>( TQDataStream&,
DCOPRef& ref );
const char * tname
The signature type name of the data.
TQByteArray data
The serialized data.
DCOPArg(const T &t, const char *tname_arg)
Creates a DCOPArg for DCOPRef::call().
DCOPArg(const T &t)
Creates a DCOPArg for DCOPRef::call().
Inter-process communication and remote procedure calls for KDE applications.
Provides an interface for receiving DCOP messages.
A DCOPRef(erence) encapsulates a remote DCOP object as a triple <app,obj,type> where type is optional...
DCOPReply callExt(const TQCString &fun, EventLoopFlag useEventLoop, int timeout, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5)
Like call(), with additional arguments allowing entering the event loop and specifying timeout.
bool send(const TQCString &fun, const T1 &t1, const T2 &t2)
Calls the function fun on the object referenced by this reference.
DCOPReply call(const TQCString &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)
Calls the function fun on the object referenced by this reference.
bool send(const TQCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
Calls the function fun on the object referenced by this reference.
bool send(const TQCString &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)
Calls the function fun on the object referenced by this reference.
bool send(const TQCString &fun, const T1 &t1)
Calls the function fun on the object referenced by this reference.
DCOPReply callExt(const TQCString &fun, EventLoopFlag useEventLoop, int timeout, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6, const T7 &t7)
Like call(), with additional arguments allowing entering the event loop and specifying timeout.
DCOPReply call(const TQCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6, const T7 &t7)
Calls the function fun on the object referenced by this reference.
DCOPReply callExt(const TQCString &fun, EventLoopFlag useEventLoop, int timeout, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
Like call(), with additional arguments allowing entering the event loop and specifying timeout.
DCOPReply call(const TQCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5)
Calls the function fun on the object referenced by this reference.
DCOPReply call(const TQCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6)
Calls the function fun on the object referenced by this reference.
bool send(const TQCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5)
Calls the function fun on the object referenced by this reference.
DCOPReply callExt(const TQCString &fun, EventLoopFlag useEventLoop, int timeout, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6)
Like call(), with additional arguments allowing entering the event loop and specifying timeout.
EventLoopFlag
Flag for allowing entering the event loop if the call blocks too long.
DCOPReply call(const TQCString &fun, const T1 &t1, const T2 &t2)
Calls the function fun on the object referenced by this reference.
DCOPReply callExt(const TQCString &fun, EventLoopFlag useEventLoop, int timeout, const T1 &t1, const T2 &t2)
Like call(), with additional arguments allowing entering the event loop and specifying timeout.
DCOPReply call(const TQCString &fun, const T1 &t1, const T2 &t2, const T3 &t3)
Calls the function fun on the object referenced by this reference.
bool send(const TQCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6)
Calls the function fun on the object referenced by this reference.
bool send(const TQCString &fun, const T1 &t1, const T2 &t2, const T3 &t3)
Calls the function fun on the object referenced by this reference.
DCOPReply call(const TQCString &fun)
Calls the function fun on the object referenced by this reference.
bool send(const TQCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6, const T7 &t7)
Calls the function fun on the object referenced by this reference.
DCOPReply callExt(const TQCString &fun, EventLoopFlag useEventLoop, int timeout, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8)
Like call(), with additional arguments allowing entering the event loop and specifying timeout.
DCOPReply call(const TQCString &fun, const T1 &t1)
Calls the function fun on the object referenced by this reference.
DCOPReply callExt(const TQCString &fun, EventLoopFlag useEventLoop, int timeout, const T1 &t1, const T2 &t2, const T3 &t3)
Like call(), with additional arguments allowing entering the event loop and specifying timeout.
DCOPReply callExt(const TQCString &fun, EventLoopFlag useEventLoop=NoEventLoop, int timeout=-1)
Like call(), with additional arguments allowing entering the event loop and specifying timeout.
bool send(const TQCString &fun)
Calls the function fun on the object referenced by this reference.
DCOPReply call(const TQCString &fun, const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
Calls the function fun on the object referenced by this reference.
DCOPReply callExt(const TQCString &fun, EventLoopFlag useEventLoop, int timeout, const T1 &t1)
Like call(), with additional arguments allowing entering the event loop and specifying timeout.
Represents the return value of a DCOPRef:call() or DCOPRef:send() invocation.
TQByteArray data
The serialized data.
bool get(T &t, const char *tname)
Retrieves the value from the type T.
TQCString type
The name of the type, or 0 if unknown.
bool get(T &t)
Retrieves the value from the type T.
bool isValid() const
Checks whether the type is valid.
kdbgstream & operator<<(const TQValueList< T > &list)