[Telepathy] tq-qt4 refcount proposal

Andre Moreira Magalhaes andre.magalhaes at collabora.co.uk
Mon Mar 23 10:48:02 PDT 2009


Simon McVittie wrote:
> On Mon, 23 Mar 2009 at 10:35:11 -0500, Ian Monroe wrote
>   
>>> 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...
>
>   
I am not sure if we should use #1 or #2. Number #1 is easier to 
implement, less code and #2 is more "beautiful" in the sense you have 
all class related things in the class header itself.

>>> 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.
>
>   
We should probably start another thread on this, if we need to vote :D.
I was thinking that maybe we could change the namespace to just Tp (not 
even Telepathy - too verbose as well) or just remove namespaces and 
prepend Tp in the class names.

>>> 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.
>
>   
Indeed

BR
Andrunko


More information about the telepathy mailing list