| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // http://blogs.msdn.com/oldnewthing/archive/2005/11/22/495740.aspx | 100 // http://blogs.msdn.com/oldnewthing/archive/2005/11/22/495740.aspx |
| 101 | 101 |
| 102 #ifndef BASE_FILES_FILE_PATH_H_ | 102 #ifndef BASE_FILES_FILE_PATH_H_ |
| 103 #define BASE_FILES_FILE_PATH_H_ | 103 #define BASE_FILES_FILE_PATH_H_ |
| 104 | 104 |
| 105 #include <stddef.h> | 105 #include <stddef.h> |
| 106 #include <string> | 106 #include <string> |
| 107 #include <vector> | 107 #include <vector> |
| 108 | 108 |
| 109 #include "base/base_export.h" | 109 #include "base/base_export.h" |
| 110 #include "base/compiler_specific.h" | |
| 111 #include "base/containers/hash_tables.h" | 110 #include "base/containers/hash_tables.h" |
| 112 #include "base/strings/string16.h" | 111 #include "base/strings/string16.h" |
| 113 #include "base/strings/string_piece.h" // For implicit conversions. | 112 #include "base/strings/string_piece.h" // For implicit conversions. |
| 114 #include "build/build_config.h" | 113 #include "build/build_config.h" |
| 115 | 114 |
| 116 // Windows-style drive letter support and pathname separator characters can be | 115 // Windows-style drive letter support and pathname separator characters can be |
| 117 // enabled and disabled independently, to aid testing. These #defines are | 116 // enabled and disabled independently, to aid testing. These #defines are |
| 118 // here so that the same setting can be used in both the implementation and | 117 // here so that the same setting can be used in both the implementation and |
| 119 // in the unit test. | 118 // in the unit test. |
| 120 #if defined(OS_WIN) | 119 #if defined(OS_WIN) |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 #define PRFilePathLiteral "%s" | 445 #define PRFilePathLiteral "%s" |
| 447 #elif defined(OS_WIN) | 446 #elif defined(OS_WIN) |
| 448 #define FILE_PATH_LITERAL(x) L ## x | 447 #define FILE_PATH_LITERAL(x) L ## x |
| 449 #define PRFilePath "ls" | 448 #define PRFilePath "ls" |
| 450 #define PRFilePathLiteral L"%ls" | 449 #define PRFilePathLiteral L"%ls" |
| 451 #endif // OS_WIN | 450 #endif // OS_WIN |
| 452 | 451 |
| 453 // Provide a hash function so that hash_sets and maps can contain FilePath | 452 // Provide a hash function so that hash_sets and maps can contain FilePath |
| 454 // objects. | 453 // objects. |
| 455 namespace BASE_HASH_NAMESPACE { | 454 namespace BASE_HASH_NAMESPACE { |
| 456 #if defined(COMPILER_GCC) | |
| 457 | 455 |
| 458 template<> | 456 template<> |
| 459 struct hash<base::FilePath> { | 457 struct hash<base::FilePath> { |
| 460 size_t operator()(const base::FilePath& f) const { | 458 size_t operator()(const base::FilePath& f) const { |
| 461 return hash<base::FilePath::StringType>()(f.value()); | 459 return hash<base::FilePath::StringType>()(f.value()); |
| 462 } | 460 } |
| 463 }; | 461 }; |
| 464 | 462 |
| 465 #elif defined(COMPILER_MSVC) | |
| 466 | |
| 467 inline size_t hash_value(const base::FilePath& f) { | |
| 468 return hash_value(f.value()); | |
| 469 } | |
| 470 | |
| 471 #endif // COMPILER | |
| 472 | |
| 473 } // namespace BASE_HASH_NAMESPACE | 463 } // namespace BASE_HASH_NAMESPACE |
| 474 | 464 |
| 475 #endif // BASE_FILES_FILE_PATH_H_ | 465 #endif // BASE_FILES_FILE_PATH_H_ |
| OLD | NEW |