| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // and BaseName().value() on each child component. | 150 // and BaseName().value() on each child component. |
| 151 void GetComponents(std::vector<FilePath::StringType>* components) const; | 151 void GetComponents(std::vector<FilePath::StringType>* components) const; |
| 152 | 152 |
| 153 // Returns true if this FilePath is a strict parent of the |child|. Absolute | 153 // Returns true if this FilePath is a strict parent of the |child|. Absolute |
| 154 // and relative paths are accepted i.e. is /foo parent to /foo/bar and | 154 // and relative paths are accepted i.e. is /foo parent to /foo/bar and |
| 155 // is foo parent to foo/bar. Does not convert paths to absolute, follow | 155 // is foo parent to foo/bar. Does not convert paths to absolute, follow |
| 156 // symlinks or directory navigation (e.g. ".."). A path is *NOT* its own | 156 // symlinks or directory navigation (e.g. ".."). A path is *NOT* its own |
| 157 // parent. | 157 // parent. |
| 158 bool IsParent(const FilePath& child) const; | 158 bool IsParent(const FilePath& child) const; |
| 159 | 159 |
| 160 // If IsParent(child) holds, appends to path (if non-NULL) the |
| 161 // relative path to child and returns true. For example, if parent |
| 162 // holds "/Users/johndoe/Library/Application Support", child holds |
| 163 // "/Users/johndoe/Library/Application Support/Google/Chrome/Default", and |
| 164 // *path holds "/Users/johndoe/Library/Caches", then after |
| 165 // parent.AppendRelativePath(child, path) is called *path will hold |
| 166 // "/Users/johndoe/Library/Caches/Google/Chrome/Default". Otherwise, |
| 167 // returns false. |
| 168 bool AppendRelativePath(const FilePath& child, FilePath* path) const; |
| 169 |
| 160 // Returns a FilePath corresponding to the directory containing the path | 170 // Returns a FilePath corresponding to the directory containing the path |
| 161 // named by this object, stripping away the file component. If this object | 171 // named by this object, stripping away the file component. If this object |
| 162 // only contains one component, returns a FilePath identifying | 172 // only contains one component, returns a FilePath identifying |
| 163 // kCurrentDirectory. If this object already refers to the root directory, | 173 // kCurrentDirectory. If this object already refers to the root directory, |
| 164 // returns a FilePath identifying the root directory. | 174 // returns a FilePath identifying the root directory. |
| 165 FilePath DirName() const; | 175 FilePath DirName() const; |
| 166 | 176 |
| 167 // Returns a FilePath corresponding to the last path component of this | 177 // Returns a FilePath corresponding to the last path component of this |
| 168 // object, either a file or a directory. If this object already refers to | 178 // object, either a file or a directory. If this object already refers to |
| 169 // the root directory, returns a FilePath identifying the root directory; | 179 // the root directory, returns a FilePath identifying the root directory; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 namespace stdext { | 296 namespace stdext { |
| 287 | 297 |
| 288 inline size_t hash_value(const FilePath& f) { | 298 inline size_t hash_value(const FilePath& f) { |
| 289 return hash_value(f.value()); | 299 return hash_value(f.value()); |
| 290 } | 300 } |
| 291 | 301 |
| 292 } // namespace stdext | 302 } // namespace stdext |
| 293 #endif // COMPILER | 303 #endif // COMPILER |
| 294 | 304 |
| 295 #endif // BASE_FILE_PATH_H_ | 305 #endif // BASE_FILE_PATH_H_ |
| OLD | NEW |