Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: dbus/object_path.h

Issue 9378039: dbus: add ObjectPath type (Closed) Base URL: http://git.chromium.org/git/chromium/src@master
Patch Set: add patch for cryptohome_client Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « dbus/mock_unittest.cc ('k') | dbus/object_path.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium 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 DBUS_OBJECT_PATH_H_
6 #define DBUS_OBJECT_PATH_H_
7 #pragma once
8
9 #include <string>
10
11 namespace dbus {
12
13 // ObjectPath is a type used to distinguish D-Bus object paths from simple
14 // strings, especially since normal practice is that these should be only
15 // initialized from static constants or obtained from remote objects and no
16 // assumptions about their value made.
17 class ObjectPath {
18 public:
19 // Permit initialization without a value for passing to
20 // dbus::MessageReader::PopObjectPath to fill in and from std::string
21 // objects.
22 //
23 // The compiler synthesised copy constructor and assignment operator are
24 // sufficient for our needs, as is implicit initialization of a std::string
25 // from a string constant.
26 ObjectPath() {}
27 explicit ObjectPath(const std::string& value) : value_(value) {}
28
29 // Retrieves value as a std::string.
30 const std::string& value() const { return value_; }
31
32 // Permit sufficient comparison to allow an ObjectPath to be used as a
33 // key in a std::map.
34 bool operator<(const ObjectPath&) const;
35
36 // Permit testing for equality, required for mocks to work and useful for
37 // observers.
38 bool operator==(const ObjectPath&) const;
39 bool operator!=(const ObjectPath&) const;
40 private:
41 std::string value_;
42 };
43
44 } // namespace dbus
45
46 #endif // DBUS_OBJECT_PATH_H_
OLDNEW
« no previous file with comments | « dbus/mock_unittest.cc ('k') | dbus/object_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698