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