[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: DCOPRef and dynamic stubs ( 3.1? )
From:       Matthias Ettrich <ettrich () trolltech ! com>
Date:       2002-09-09 13:10:20
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic