From cf910da2d3cb23ac300968212dc8a196a64b2726 Mon Sep 17 00:00:00 2001 From: "keybuk@chromium.org" Date: Wed, 15 Feb 2012 04:21:08 +0000 Subject: dbus: add Property handling for clients D-Bus properties can be tricky to handle due to their reliance on variants, and since they use a common interface, result in a lot of copy and paste code to deal with. Add an API that simplifies matters somewhat; detailed documentation is in dbus/property.h, but fundamentally you add a struct Properties to the client implementation derived from dbus::PropertySet, and in it declare members of dbus::Property and connect them in the constructor with RegisterProperty(name, ptr). The API works on two levels, from a higher-level each member of the structure is a type-safe way to obtain the current value of the property, update the value, and set a new value. From the lower-level, it uses a generic reader/writer based interface so that the parent structure's GetAll and signal handling methods can update the values without requiring knowledge of the contained type. BUG=chromium:109194 TEST=unit tests included in CL change-Id: I111b9e60a2c6c35edd9e0ea9f6976928c6c6474b Review URL: http://codereview.chromium.org/9380053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122039 0039d316-1c4b-4281-b951-d872f2087c98 --- dbus/dbus.gyp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'dbus/dbus.gyp') diff --git a/dbus/dbus.gyp b/dbus/dbus.gyp index 8a3cb22..296ac53 100644 --- a/dbus/dbus.gyp +++ b/dbus/dbus.gyp @@ -29,6 +29,8 @@ 'object_path.h', 'object_proxy.cc', 'object_proxy.h', + 'property.cc', + 'property.h', 'scoped_dbus_error.h', ], }, @@ -83,6 +85,7 @@ 'end_to_end_sync_unittest.cc', 'message_unittest.cc', 'mock_unittest.cc', + 'property_unittest.cc', 'test_service.cc', 'test_service.h', ], -- cgit v1.1