OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 // Returns true if this FilePath contains any attempt to reference a parent | 276 // Returns true if this FilePath contains any attempt to reference a parent |
277 // directory (i.e. has a path component that is ".." | 277 // directory (i.e. has a path component that is ".." |
278 bool ReferencesParent() const; | 278 bool ReferencesParent() const; |
279 | 279 |
280 // Return a Unicode human-readable version of this path. | 280 // Return a Unicode human-readable version of this path. |
281 // Warning: you can *not*, in general, go from a display name back to a real | 281 // Warning: you can *not*, in general, go from a display name back to a real |
282 // path. Only use this when displaying paths to users, not just when you | 282 // path. Only use this when displaying paths to users, not just when you |
283 // want to stuff a string16 into some other API. | 283 // want to stuff a string16 into some other API. |
284 string16 LossyDisplayName() const; | 284 string16 LossyDisplayName() const; |
285 | 285 |
286 // Return the path as ASCII, or the empty string if the path is not ASCII. | |
287 // This should only be used for cases where the FilePath is representing a | |
288 // known-ASCII filename. | |
289 std::string MaybeAsASCII() const; | |
Avi (use Gerrit)
2011/03/01 19:56:36
method name FTW
| |
290 | |
286 // Older Chromium code assumes that paths are always wstrings. | 291 // Older Chromium code assumes that paths are always wstrings. |
287 // These functions convert wstrings to/from FilePaths, and are | 292 // These functions convert wstrings to/from FilePaths, and are |
288 // useful to smooth porting that old code to the FilePath API. | 293 // useful to smooth porting that old code to the FilePath API. |
289 // They have "Hack" in their names so people feel bad about using them. | 294 // They have "Hack" in their names so people feel bad about using them. |
290 // http://code.google.com/p/chromium/issues/detail?id=24672 | 295 // http://code.google.com/p/chromium/issues/detail?id=24672 |
291 // | 296 // |
292 // If you are trying to be a good citizen and remove these, ask yourself: | 297 // If you are trying to be a good citizen and remove these, ask yourself: |
293 // - Am I interacting with other Chrome code that deals with files? Then | 298 // - Am I interacting with other Chrome code that deals with files? Then |
294 // try to convert the API into using FilePath. | 299 // try to convert the API into using FilePath. |
295 // - Am I interacting with OS-native calls? Then use value() to get at an | 300 // - Am I interacting with OS-native calls? Then use value() to get at an |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 namespace stdext { | 396 namespace stdext { |
392 | 397 |
393 inline size_t hash_value(const FilePath& f) { | 398 inline size_t hash_value(const FilePath& f) { |
394 return hash_value(f.value()); | 399 return hash_value(f.value()); |
395 } | 400 } |
396 | 401 |
397 } // namespace stdext | 402 } // namespace stdext |
398 #endif // COMPILER | 403 #endif // COMPILER |
399 | 404 |
400 #endif // BASE_FILE_PATH_H_ | 405 #endif // BASE_FILE_PATH_H_ |
OLD | NEW |