| 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // Remove trailing separators from this object. If the path is absolute, it | 389 // Remove trailing separators from this object. If the path is absolute, it |
| 390 // will never be stripped any more than to refer to the absolute root | 390 // will never be stripped any more than to refer to the absolute root |
| 391 // directory, so "////" will become "/", not "". A leading pair of | 391 // directory, so "////" will become "/", not "". A leading pair of |
| 392 // separators is never stripped, to support alternate roots. This is used to | 392 // separators is never stripped, to support alternate roots. This is used to |
| 393 // support UNC paths on Windows. | 393 // support UNC paths on Windows. |
| 394 void StripTrailingSeparatorsInternal(); | 394 void StripTrailingSeparatorsInternal(); |
| 395 | 395 |
| 396 StringType path_; | 396 StringType path_; |
| 397 }; | 397 }; |
| 398 | 398 |
| 399 // This is required by googletest to print a readable output on test failures. |
| 400 BASE_EXPORT extern void PrintTo(const FilePath& path, std::ostream* out); |
| 401 |
| 399 // Macros for string literal initialization of FilePath::CharType[], and for | 402 // Macros for string literal initialization of FilePath::CharType[], and for |
| 400 // using a FilePath::CharType[] in a printf-style format string. | 403 // using a FilePath::CharType[] in a printf-style format string. |
| 401 #if defined(OS_POSIX) | 404 #if defined(OS_POSIX) |
| 402 #define FILE_PATH_LITERAL(x) x | 405 #define FILE_PATH_LITERAL(x) x |
| 403 #define PRFilePath "s" | 406 #define PRFilePath "s" |
| 404 #define PRFilePathLiteral "%s" | 407 #define PRFilePathLiteral "%s" |
| 405 #elif defined(OS_WIN) | 408 #elif defined(OS_WIN) |
| 406 #define FILE_PATH_LITERAL(x) L ## x | 409 #define FILE_PATH_LITERAL(x) L ## x |
| 407 #define PRFilePath "ls" | 410 #define PRFilePath "ls" |
| 408 #define PRFilePathLiteral L"%ls" | 411 #define PRFilePathLiteral L"%ls" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 424 | 427 |
| 425 inline size_t hash_value(const FilePath& f) { | 428 inline size_t hash_value(const FilePath& f) { |
| 426 return hash_value(f.value()); | 429 return hash_value(f.value()); |
| 427 } | 430 } |
| 428 | 431 |
| 429 #endif // COMPILER | 432 #endif // COMPILER |
| 430 | 433 |
| 431 } // namespace BASE_HASH_NAMESPACE | 434 } // namespace BASE_HASH_NAMESPACE |
| 432 | 435 |
| 433 #endif // BASE_FILE_PATH_H_ | 436 #endif // BASE_FILE_PATH_H_ |
| OLD | NEW |