| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 // Windows-style drive letter support and pathname separator characters can be | 118 // Windows-style drive letter support and pathname separator characters can be |
| 119 // enabled and disabled independently, to aid testing. These #defines are | 119 // enabled and disabled independently, to aid testing. These #defines are |
| 120 // here so that the same setting can be used in both the implementation and | 120 // here so that the same setting can be used in both the implementation and |
| 121 // in the unit test. | 121 // in the unit test. |
| 122 #if defined(OS_WIN) | 122 #if defined(OS_WIN) |
| 123 #define FILE_PATH_USES_DRIVE_LETTERS | 123 #define FILE_PATH_USES_DRIVE_LETTERS |
| 124 #define FILE_PATH_USES_WIN_SEPARATORS | 124 #define FILE_PATH_USES_WIN_SEPARATORS |
| 125 #endif // OS_WIN | 125 #endif // OS_WIN |
| 126 | 126 |
| 127 // To print path names portably use PRIsFP (based on PRIuS and friends from |
| 128 // C99 and format_macros.h) like this: |
| 129 // base::StringPrintf("Path is %" PRIsFP ".\n", path.value().c_str()); |
| 130 #if defined(OS_POSIX) |
| 131 #define PRIsFP "s" |
| 132 #elif defined(OS_WIN) |
| 133 #define PRIsFP "ls" |
| 134 #endif // OS_WIN |
| 135 |
| 127 namespace base { | 136 namespace base { |
| 128 | 137 |
| 129 class Pickle; | 138 class Pickle; |
| 130 class PickleIterator; | 139 class PickleIterator; |
| 131 | 140 |
| 132 // An abstraction to isolate users from the differences between native | 141 // An abstraction to isolate users from the differences between native |
| 133 // pathnames on different platforms. | 142 // pathnames on different platforms. |
| 134 class BASE_EXPORT FilePath { | 143 class BASE_EXPORT FilePath { |
| 135 public: | 144 public: |
| 136 #if defined(OS_POSIX) | 145 #if defined(OS_POSIX) |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 template<> | 467 template<> |
| 459 struct hash<base::FilePath> { | 468 struct hash<base::FilePath> { |
| 460 size_t operator()(const base::FilePath& f) const { | 469 size_t operator()(const base::FilePath& f) const { |
| 461 return hash<base::FilePath::StringType>()(f.value()); | 470 return hash<base::FilePath::StringType>()(f.value()); |
| 462 } | 471 } |
| 463 }; | 472 }; |
| 464 | 473 |
| 465 } // namespace BASE_HASH_NAMESPACE | 474 } // namespace BASE_HASH_NAMESPACE |
| 466 | 475 |
| 467 #endif // BASE_FILES_FILE_PATH_H_ | 476 #endif // BASE_FILES_FILE_PATH_H_ |
| OLD | NEW |