| 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 // 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 bool empty() const { return path_.empty(); } | 182 bool empty() const { return path_.empty(); } |
| 183 | 183 |
| 184 void clear() { path_.clear(); } | 184 void clear() { path_.clear(); } |
| 185 | 185 |
| 186 // Returns true if |character| is in kSeparators. | 186 // Returns true if |character| is in kSeparators. |
| 187 static bool IsSeparator(CharType character); | 187 static bool IsSeparator(CharType character); |
| 188 | 188 |
| 189 // Returns a vector of all of the components of the provided path. It is | 189 // Returns a vector of all of the components of the provided path. It is |
| 190 // equivalent to calling DirName().value() on the path's root component, | 190 // equivalent to calling DirName().value() on the path's root component, |
| 191 // and BaseName().value() on each child component. | 191 // and BaseName().value() on each child component. |
| 192 // |
| 193 // To make sure this is lossless so we can differentiate absolute and |
| 194 // relative paths, the root slash will be included even though no other |
| 195 // slashes will be. The precise behavior is: |
| 196 // |
| 197 // Posix: "/foo/bar" -> [ "/", "foo", "bar" ] |
| 198 // Windows: "C:\foo\bar" -> [ "C:", "\\", "foo", "bar" ] |
| 192 void GetComponents(std::vector<FilePath::StringType>* components) const; | 199 void GetComponents(std::vector<FilePath::StringType>* components) const; |
| 193 | 200 |
| 194 // Returns true if this FilePath is a strict parent of the |child|. Absolute | 201 // Returns true if this FilePath is a strict parent of the |child|. Absolute |
| 195 // and relative paths are accepted i.e. is /foo parent to /foo/bar and | 202 // and relative paths are accepted i.e. is /foo parent to /foo/bar and |
| 196 // is foo parent to foo/bar. Does not convert paths to absolute, follow | 203 // is foo parent to foo/bar. Does not convert paths to absolute, follow |
| 197 // symlinks or directory navigation (e.g. ".."). A path is *NOT* its own | 204 // symlinks or directory navigation (e.g. ".."). A path is *NOT* its own |
| 198 // parent. | 205 // parent. |
| 199 bool IsParent(const FilePath& child) const; | 206 bool IsParent(const FilePath& child) const; |
| 200 | 207 |
| 201 // If IsParent(child) holds, appends to path (if non-NULL) the | 208 // If IsParent(child) holds, appends to path (if non-NULL) the |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 462 |
| 456 inline size_t hash_value(const base::FilePath& f) { | 463 inline size_t hash_value(const base::FilePath& f) { |
| 457 return hash_value(f.value()); | 464 return hash_value(f.value()); |
| 458 } | 465 } |
| 459 | 466 |
| 460 #endif // COMPILER | 467 #endif // COMPILER |
| 461 | 468 |
| 462 } // namespace BASE_HASH_NAMESPACE | 469 } // namespace BASE_HASH_NAMESPACE |
| 463 | 470 |
| 464 #endif // BASE_FILES_FILE_PATH_H_ | 471 #endif // BASE_FILES_FILE_PATH_H_ |
| OLD | NEW |