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.
5 #ifndef DBUS_OBJECT_PATH_H_
6 #define DBUS_OBJECT_PATH_H_
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.
19 // Permit initialization without a value for passing to
20 // dbus::MessageReader::PopObjectPath to fill in and from std::string
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.
27 explicit ObjectPath(const std::string
& value
) : value_(value
) {}
29 // Retrieves value as a std::string.
30 const std::string
& value() const { return value_
; }
32 // Permit sufficient comparison to allow an ObjectPath to be used as a
34 bool operator<(const ObjectPath
&) const;
36 // Permit testing for equality, required for mocks to work and useful for
38 bool operator==(const ObjectPath
&) const;
39 bool operator!=(const ObjectPath
&) const;
46 #endif // DBUS_OBJECT_PATH_H_