OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 // FilePath is a container for pathnames stored in a platform's native string | 5 // FilePath is a container for pathnames stored in a platform's native string |
6 // type, providing containers for manipulation in according with the | 6 // type, providing containers for manipulation in according with the |
7 // platform's conventions for pathnames. It supports the following path | 7 // platform's conventions for pathnames. It supports the following path |
8 // types: | 8 // types: |
9 // | 9 // |
10 // POSIX Windows | 10 // POSIX Windows |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 return path_ == that.path_; | 122 return path_ == that.path_; |
123 } | 123 } |
124 | 124 |
125 // Required for some STL containers and operations | 125 // Required for some STL containers and operations |
126 bool operator<(const FilePath& that) const { | 126 bool operator<(const FilePath& that) const { |
127 return path_ < that.path_; | 127 return path_ < that.path_; |
128 } | 128 } |
129 | 129 |
130 const StringType& value() const { return path_; } | 130 const StringType& value() const { return path_; } |
131 | 131 |
| 132 bool empty() const { return path_.empty(); } |
| 133 |
132 // Returns true if |character| is in kSeparators. | 134 // Returns true if |character| is in kSeparators. |
133 static bool IsSeparator(CharType character); | 135 static bool IsSeparator(CharType character); |
134 | 136 |
135 // Returns a FilePath corresponding to the directory containing the path | 137 // Returns a FilePath corresponding to the directory containing the path |
136 // named by this object, stripping away the file component. If this object | 138 // named by this object, stripping away the file component. If this object |
137 // only contains one component, returns a FilePath identifying | 139 // only contains one component, returns a FilePath identifying |
138 // kCurrentDirectory. If this object already refers to the root directory, | 140 // kCurrentDirectory. If this object already refers to the root directory, |
139 // returns a FilePath identifying the root directory. | 141 // returns a FilePath identifying the root directory. |
140 FilePath DirName() const; | 142 FilePath DirName() const; |
141 | 143 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 namespace stdext { | 219 namespace stdext { |
218 | 220 |
219 inline size_t hash_value(const FilePath& f) { | 221 inline size_t hash_value(const FilePath& f) { |
220 return hash_value(f.value()); | 222 return hash_value(f.value()); |
221 } | 223 } |
222 | 224 |
223 } // namespace stdext | 225 } // namespace stdext |
224 #endif // COMPILER | 226 #endif // COMPILER |
225 | 227 |
226 #endif // BASE_FILE_PATH_H_ | 228 #endif // BASE_FILE_PATH_H_ |
OLD | NEW |