::DBus::Struct member access

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Dec 3 09:30:54 PST 2013


On 03/12/13 16:43, Leonel Florin Selles wrote:
>             /*Service * service = new Service;
>             service->id = ((int *) innerStruct)[0];
>             service->Name = ((string *) innerStruct)[1];
>             service->Rate = ((double *) innerStruct)[2];
>             service->CollectUnit = ((int *) innerStruct)[3];
>             service->ServiceType = ((int *) innerStruct)[4];
>             service->FreeOfCharge = ((bool *) innerStruct)[5];

I don't know anything about dbus-c++, but those C-style casts aren't
going to do the right thing. There's probably a get<>() template method
that takes an integer and returns the appropriate type, or an overloaded
operator[], or something?

As far as I know, none of the "plain C++" bindings for libdbus
(dbus-c++, dbus-cpp, dbus-cxx) are actively maintained. I would suggest
QtDBus (C++ with Qt) or GDBus (C with GLib, but C can be used from C++).

    S



More information about the dbus mailing list