DCOPRef and dynamic stubs ( 3.1? )

Matthias Ettrich ettrich at trolltech.com
Mon Sep 9 14:10:20 BST 2002


On Monday 09 September 2002 14:34, Simon Hausmann wrote:
[snip]
>
> Good idea. But in the call template method, how do you distinguish
> between a normal argument and the special DCOPArg?
>
[snip]

I was thinking along the lines of:

class DCOPArg  {
public:
    template <class T> DCOPArg( const T& t, const char* tname_arg )
	: tname(tname_arg)
	{
	    QDataStream ds( data, IO_WriteOnly );
	    ds << t;
	}
    QByteArray data;
    const char* tname;
};
inline const char* dcopTypeName( const DCOPArg &arg )  { return arg.tname; }
inline QDataStream & operator << (QDataStream & str, const DCOPArg& arg )
   { str.writeRawBytes( arg.data.data(), arg.data.size() ); return str; }

Everything else happens magically.

>
> Another thought coming to my mind is to take your idea of the
> beautiful send( "setFoo", bar, blubb ); syntax and make the
> implementation call the arg().arg() approach. That makes the common
> case easy while providing flexibility for custom types with the
> arg() approach. Hm, not sure if having two APIs for the same thing
> is a good a idea though.

true.

 Matthias





More information about the kde-core-devel mailing list