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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 106 |
107 #include <iosfwd> | 107 #include <iosfwd> |
108 #include <string> | 108 #include <string> |
109 #include <vector> | 109 #include <vector> |
110 | 110 |
111 #include "base/base_export.h" | 111 #include "base/base_export.h" |
112 #include "base/compiler_specific.h" | 112 #include "base/compiler_specific.h" |
113 #include "base/containers/hash_tables.h" | |
114 #include "base/macros.h" | 113 #include "base/macros.h" |
115 #include "base/strings/string16.h" | 114 #include "base/strings/string16.h" |
116 #include "base/strings/string_piece.h" | 115 #include "base/strings/string_piece.h" |
117 #include "build/build_config.h" | 116 #include "build/build_config.h" |
118 | 117 |
119 // Windows-style drive letter support and pathname separator characters can be | 118 // Windows-style drive letter support and pathname separator characters can be |
120 // enabled and disabled independently, to aid testing. These #defines are | 119 // enabled and disabled independently, to aid testing. These #defines are |
121 // 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 |
122 // in the unit test. | 121 // in the unit test. |
123 #if defined(OS_WIN) | 122 #if defined(OS_WIN) |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 // Macros for string literal initialization of FilePath::CharType[], and for | 462 // Macros for string literal initialization of FilePath::CharType[], and for |
464 // using a FilePath::CharType[] in a printf-style format string. | 463 // using a FilePath::CharType[] in a printf-style format string. |
465 #if defined(OS_POSIX) | 464 #if defined(OS_POSIX) |
466 #define FILE_PATH_LITERAL(x) x | 465 #define FILE_PATH_LITERAL(x) x |
467 #define PRFilePath "s" | 466 #define PRFilePath "s" |
468 #elif defined(OS_WIN) | 467 #elif defined(OS_WIN) |
469 #define FILE_PATH_LITERAL(x) L ## x | 468 #define FILE_PATH_LITERAL(x) L ## x |
470 #define PRFilePath "ls" | 469 #define PRFilePath "ls" |
471 #endif // OS_WIN | 470 #endif // OS_WIN |
472 | 471 |
473 // Provide a hash function so that hash_sets and maps can contain FilePath | 472 namespace std { |
474 // objects. | |
475 namespace BASE_HASH_NAMESPACE { | |
476 | 473 |
477 template<> | 474 template <> |
478 struct hash<base::FilePath> { | 475 struct hash<base::FilePath> { |
479 size_t operator()(const base::FilePath& f) const { | 476 typedef base::FilePath argument_type; |
| 477 typedef std::size_t result_type; |
| 478 result_type operator()(argument_type const& f) const { |
480 return hash<base::FilePath::StringType>()(f.value()); | 479 return hash<base::FilePath::StringType>()(f.value()); |
481 } | 480 } |
482 }; | 481 }; |
483 | 482 |
484 } // namespace BASE_HASH_NAMESPACE | 483 } // namespace std |
485 | 484 |
486 #endif // BASE_FILES_FILE_PATH_H_ | 485 #endif // BASE_FILES_FILE_PATH_H_ |
OLD | NEW |