On Tue, 09 Aug 2005 14:06:01 +0200, David Eriksson wrote: > Hi, > > As Paul Durante were also doing his own C++ bindings for D-BUS instead of > using the Freedesktop-sponsored C++ bindings [1], I might just as well > confess I was hit my by the NIH syndrome [2] and also wrote a C++ wrapper > for the D-BUS API. It's not finished yet but it contains enough for my > needs at the moment. > > Comments are welcome! > > > Example code for a method call: > > dbus::Connection_ptr dbus_connection( > dbus::Bus::Get(DBUS_BUS_SYSTEM)); > > dbus::Message_ptr method_call( > dbus::Message::NewMethodCall( > "service", > "path", > "interface", > "method") > ); > > DBusMessageIter iter; > method_call->IterInit(iter); > > // [Adding parameters to iterator] > > dbus::Message_ptr reply( > dbus_connection->SendWithReplyAndBlock(method_call) ); > > DBusMessageIter reply_iter; > reply->IterInit(reply_iter); > > // [Getting return values from reply iterator] > > > > Implementation notes: > > - Written for D-BUS 0.23 (Using D-BUS 0.23.4 on Ubuntu 5.04) > > - Any C++ users who for various reasons are not using Boost [3] might not > like my bindings because I depend on boost::shared_ptr. > > - Many API calls are not wrapped; most notably iterators. > > - I plan to write an iostream-like wrapper for iterators > > - Poorly documented > > - No unit tests > > > View the source code at the URLs below. (Remove .html from the URLs above > to get the plain text files.) > > http://www.2good.nu/blandat/dbus-wrapper.hh.html > http://www.2good.nu/blandat/dbus-wrapper.cc.html > http://www.2good.nu/blandat/dbus-filter.hh.html > http://www.2good.nu/blandat/dbus-object.hh.html > > If anyone wants to use my C++ wrapper, I hereby release it according to > the the MIT license [4]. > > > [1] http://freedesktop.org/wiki/Software_2fdbus_2dcpp > > [2] http://en.wikipedia.org/wiki/Not_Invented_Here > > [3] http://boost.org > > [4] http://opensource.org/licenses/mit-license.php
_______________________________________________ Devel-conf mailing list [email protected] https://lists.altlinux.ru/mailman/listinfo/devel-conf
