OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DBUS_OBJECT_PATH_H_ | 5 #ifndef DBUS_OBJECT_PATH_H_ |
6 #define DBUS_OBJECT_PATH_H_ | 6 #define DBUS_OBJECT_PATH_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 // | 22 // |
23 // The compiler synthesised copy constructor and assignment operator are | 23 // The compiler synthesised copy constructor and assignment operator are |
24 // sufficient for our needs, as is implicit initialization of a std::string | 24 // sufficient for our needs, as is implicit initialization of a std::string |
25 // from a string constant. | 25 // from a string constant. |
26 ObjectPath() {} | 26 ObjectPath() {} |
27 explicit ObjectPath(const std::string& value) : value_(value) {} | 27 explicit ObjectPath(const std::string& value) : value_(value) {} |
28 | 28 |
29 // Retrieves value as a std::string. | 29 // Retrieves value as a std::string. |
30 const std::string& value() const { return value_; } | 30 const std::string& value() const { return value_; } |
31 | 31 |
| 32 // Returns true if the value is a valid object path. |
| 33 bool IsValid() const; |
| 34 |
32 // Permit sufficient comparison to allow an ObjectPath to be used as a | 35 // Permit sufficient comparison to allow an ObjectPath to be used as a |
33 // key in a std::map. | 36 // key in a std::map. |
34 bool operator<(const ObjectPath&) const; | 37 bool operator<(const ObjectPath&) const; |
35 | 38 |
36 // Permit testing for equality, required for mocks to work and useful for | 39 // Permit testing for equality, required for mocks to work and useful for |
37 // observers. | 40 // observers. |
38 bool operator==(const ObjectPath&) const; | 41 bool operator==(const ObjectPath&) const; |
39 bool operator!=(const ObjectPath&) const; | 42 bool operator!=(const ObjectPath&) const; |
40 private: | 43 private: |
41 std::string value_; | 44 std::string value_; |
42 }; | 45 }; |
43 | 46 |
44 } // namespace dbus | 47 } // namespace dbus |
45 | 48 |
46 #endif // DBUS_OBJECT_PATH_H_ | 49 #endif // DBUS_OBJECT_PATH_H_ |
OLD | NEW |