[Telepathy] tq-qt4 refcount proposal

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Mar 23 09:54:45 PDT 2009


On Mon, 23 Mar 2009 at 10:35:11 -0500, Ian Monroe wrote:
> On Monday 23 March 2009 10:04:02 Andre Moreira Magalhaes wrote:
> > The biggest problem here is that you can't forward declare typedefs, so
> > that would be quite difficult.

Right, and that's unfortunate...

> > You could declare typedef AccountPtr on account.h and typedef
> > AccountManagerPtr on account-manager.h and both headers have to include
> > the other, so this wouldn't work.

You could break each cycle by declaring all the typedefs involved in the
cycle, in the header that #includes none of the other headers?

This might end up as basically the same thing as (1) below, though...

> > Solutions:
> > 1 - Have a header that defines all XXXPtr typedefs.

That's slightly unfortunate, but not *that* bad...

> > 2 - Instead of using typedefs making the XXXPtr a class inherited from
> > QExplicitlySharedDataPointer<XXX> and forward declare it.

That doesn't sound bad. Is there any down side to this? Presumably the entire
class would be inline in the header...

> > 3 - Do not use typedefs at all, always use
> > QExplicitlySharedDataPointer<XXX> or SharedPtr<XXX> as I did.

This makes connecting to a signal ludicrously verbose (the full type name would
be QExplicitlySharedDataPointer<Telepathy::Client::Foo> or
Telepathy::SharedPtr<Telepathy::Client::Foo>, neither of which is very
convenient). I'm already unhappy with how much you need to type to connect
to our signals (Telepathy::Client::PendingOperation anyone?)

I'm even starting to think we should flatten the Telepathy::Client namespace
into the Telepathy namespace (massive API breakage, but easily fixed with sed),
mirroring the structure of telepathy-glib - in telepathy-glib, TpConnection is
a high-level connection client object, tp_cli_connection_* are auto-generated
client stuff, tp_svc_connection_* are auto-generated service stuff and
TpBaseConnection is the service base class.

> > 4 - ???
> 
> Well so the AccountManager header itself might not use the 'AccountPtr', but 
> the .cpp files and all the users code could use it still. I'm guessing there's 
> some Doxygen trickery that could be preformed so that the docs still show 
> 'AccountPtr'.

This is not an option. Qt signals use string matching rather than
namespace-literate C++ symbol matching, so you have to spell the class name
in precisely the same way when declaring the signal and when connecting to it.

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


More information about the telepathy mailing list