[Development] D-Bus and (de-)marshalling of complex types (QDBusArgument)
Alberto Mardegan
mardy at users.sourceforge.net
Thu Apr 26 14:11:05 CEST 2012
On 04/26/2012 01:19 PM, Thiago Macieira wrote:
>> However, unless I'm missing something, this only explains why we cannot
>> marshal for aggregate types (structures); we should still be able to
>> marshal array and dictionary types.
>
> Not exactly... there are two reasons why this can't be done.
[...]
Thanks for the explanation, it makes sense.
>> Should we have a QDBusArgument::signature() method?
>
> It's there: QDBusArgument::currentSignature()
>
> For whatever reason that I can't remember right now, the method is marked
> \internal in the documentation.
OK. For the time being I decided to work around the issue in a way that
I don't need this demarshalling at all, but if I'll ever need it I'll
try to remember about currentSignature(), thanks.
> Depending on the context, you don't need to know the signature and
> currentType() might be enough. You can do a beginMap() and you'll have a type
> of MapEntryType. Then you beginMapEntry() and you should have a BasicType --
> which is always demarshalled. After you demarshall that, you'll have any type
> again.
Yep. The advantage of knowing the signature in advance is that it makes
the code a bit cleaner (you don't need to read the first map entry to
infer the types), and especially that it works even if the map is empty.
Ciao,
Alberto
--
http://blog.mardy.it <- geek in un lingua international!
More information about the Development
mailing list