[Telepathy] tp-qt4 FileTransfer API proposal

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Sep 11 08:13:14 PDT 2009


On Tue, 01 Sep 2009 at 19:36:24 +0100, Will Thompson wrote:
> Andre Moreira Magalhaes wrote:
> > So changing it won't make much difference from what we have now. We 
> > would have a class with the constructor containing all the default 
> > values. Why let in the constructor? As they can't be changed after creation.

No, the point of the FTProps object is to emulate Python keyword arguments.
I believe this is called "the named parameters idiom" in C++, if you replace
this:

>     FTProps p("cat.jpg", "image/jpeg", 5000);
> 
>     p.lastModificationTime(47547);
>     cr = account.createFileTransfer("foo at bar.com", p)
> 
>     // and never use 'p' again.

with something like this:

account.createFileTransfer("foo at bar.com", "cat.jpg", "image/jpeg", 5000,
    FTProps()
        .lastModificationTime(47547)
	.description("my cat")
	.hash("crc32", "deadbeef"));

This also allows adding more properties later, if needed (as long as the
FTProps struct has a mPriv).

    S
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 793 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/telepathy/attachments/20090911/d2dddd92/attachment.pgp 


More information about the telepathy mailing list