blob: f69c22bc275a1941bcc32ef5d0b4b69e6582ba99 [file] [log] [blame]
Darin Petkove0a312e2011-07-20 13:45:28 -07001// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef SHILL_DBUS_PROPERTIES_
6#define SHILL_DBUS_PROPERTIES_
7
8#include <map>
9#include <string>
10
11#include <base/basictypes.h>
12#include <dbus-c++/types.h>
13
14namespace shill {
15
16typedef std::map<std::string, DBus::Variant> DBusPropertiesMap;
17
18class DBusProperties {
19 public:
Eric Shienbrood7fce52c2012-04-13 19:11:02 -040020 static bool GetBool(const DBusPropertiesMap &properties,
21 const std::string &key,
22 bool *value);
23
24 static bool GetInt32(const DBusPropertiesMap &properties,
25 const std::string &key,
26 int32 *value);
Darin Petkove0a312e2011-07-20 13:45:28 -070027
Nathan Williamse9840802012-04-18 18:47:40 -040028 static bool GetObjectPath(const DBusPropertiesMap &properties,
29 const std::string &key,
30 std::string *value);
31
Eric Shienbrood7fce52c2012-04-13 19:11:02 -040032 static bool GetString(const DBusPropertiesMap &properties,
Darin Petkove0a312e2011-07-20 13:45:28 -070033 const std::string &key,
Eric Shienbrood7fce52c2012-04-13 19:11:02 -040034 std::string *value);
Darin Petkove0a312e2011-07-20 13:45:28 -070035
Darin Petkovceb68172011-07-29 14:47:48 -070036 static bool GetUint16(const DBusPropertiesMap &properties,
37 const std::string &key,
38 uint16 *value);
39
Eric Shienbrood7fce52c2012-04-13 19:11:02 -040040 static bool GetUint32(const DBusPropertiesMap &properties,
41 const std::string &key,
42 uint32 *value);
43
Darin Petkove0a312e2011-07-20 13:45:28 -070044 private:
45 DISALLOW_COPY_AND_ASSIGN(DBusProperties);
46};
47
48} // namespace shill
49
50#endif // SHILL_DBUS_PROPERTIES_