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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 // Remove trailing separators from this object. If the path is absolute, it | 426 // Remove trailing separators from this object. If the path is absolute, it |
427 // will never be stripped any more than to refer to the absolute root | 427 // will never be stripped any more than to refer to the absolute root |
428 // directory, so "////" will become "/", not "". A leading pair of | 428 // directory, so "////" will become "/", not "". A leading pair of |
429 // separators is never stripped, to support alternate roots. This is used to | 429 // separators is never stripped, to support alternate roots. This is used to |
430 // support UNC paths on Windows. | 430 // support UNC paths on Windows. |
431 void StripTrailingSeparatorsInternal(); | 431 void StripTrailingSeparatorsInternal(); |
432 | 432 |
433 StringType path_; | 433 StringType path_; |
434 }; | 434 }; |
435 | 435 |
436 // This is required by googletest to print a readable output on test failures. | |
437 BASE_EXPORT extern void PrintTo(const FilePath& path, std::ostream* out); | |
danakj
2015/05/22 20:59:23
While you're here, including std::ostream everywhe
Matt Giuca
2015/05/25 03:40:15
Done (moved to test_support_base), but...
On 2015
Matt Giuca
2015/05/25 05:54:01
Sorry, by <iostream> I meant <ostream>.
| |
438 | |
436 } // namespace base | 439 } // namespace base |
437 | 440 |
438 // This is required by googletest to print a readable output on test failures. | |
439 BASE_EXPORT extern void PrintTo(const base::FilePath& path, std::ostream* out); | |
440 | |
441 // Macros for string literal initialization of FilePath::CharType[], and for | 441 // Macros for string literal initialization of FilePath::CharType[], and for |
442 // using a FilePath::CharType[] in a printf-style format string. | 442 // using a FilePath::CharType[] in a printf-style format string. |
443 #if defined(OS_POSIX) | 443 #if defined(OS_POSIX) |
444 #define FILE_PATH_LITERAL(x) x | 444 #define FILE_PATH_LITERAL(x) x |
445 #define PRFilePath "s" | 445 #define PRFilePath "s" |
446 #elif defined(OS_WIN) | 446 #elif defined(OS_WIN) |
447 #define FILE_PATH_LITERAL(x) L ## x | 447 #define FILE_PATH_LITERAL(x) L ## x |
448 #define PRFilePath "ls" | 448 #define PRFilePath "ls" |
449 #endif // OS_WIN | 449 #endif // OS_WIN |
450 | 450 |
451 // Provide a hash function so that hash_sets and maps can contain FilePath | 451 // Provide a hash function so that hash_sets and maps can contain FilePath |
452 // objects. | 452 // objects. |
453 namespace BASE_HASH_NAMESPACE { | 453 namespace BASE_HASH_NAMESPACE { |
454 | 454 |
455 template<> | 455 template<> |
456 struct hash<base::FilePath> { | 456 struct hash<base::FilePath> { |
457 size_t operator()(const base::FilePath& f) const { | 457 size_t operator()(const base::FilePath& f) const { |
458 return hash<base::FilePath::StringType>()(f.value()); | 458 return hash<base::FilePath::StringType>()(f.value()); |
459 } | 459 } |
460 }; | 460 }; |
461 | 461 |
462 } // namespace BASE_HASH_NAMESPACE | 462 } // namespace BASE_HASH_NAMESPACE |
463 | 463 |
464 #endif // BASE_FILES_FILE_PATH_H_ | 464 #endif // BASE_FILES_FILE_PATH_H_ |
OLD | NEW |