OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 #define PRFilePathLiteral "%s" | 374 #define PRFilePathLiteral "%s" |
375 #elif defined(OS_WIN) | 375 #elif defined(OS_WIN) |
376 #define FILE_PATH_LITERAL(x) L ## x | 376 #define FILE_PATH_LITERAL(x) L ## x |
377 #define PRFilePath "ls" | 377 #define PRFilePath "ls" |
378 #define PRFilePathLiteral L"%ls" | 378 #define PRFilePathLiteral L"%ls" |
379 #endif // OS_WIN | 379 #endif // OS_WIN |
380 | 380 |
381 // Provide a hash function so that hash_sets and maps can contain FilePath | 381 // Provide a hash function so that hash_sets and maps can contain FilePath |
382 // objects. | 382 // objects. |
383 #if defined(COMPILER_GCC) | 383 #if defined(COMPILER_GCC) |
384 namespace __gnu_cxx { | 384 namespace HASH_NAMESPACE { |
385 | 385 |
386 template<> | 386 template<> |
387 struct hash<FilePath> { | 387 struct hash<FilePath> { |
388 size_t operator()(const FilePath& f) const { | 388 size_t operator()(const FilePath& f) const { |
389 return hash<FilePath::StringType>()(f.value()); | 389 return hash<FilePath::StringType>()(f.value()); |
390 } | 390 } |
391 }; | 391 }; |
392 | 392 |
393 } // namespace __gnu_cxx | 393 } // namespace HASH_NAMESPACE |
394 #elif defined(COMPILER_MSVC) | 394 #elif defined(COMPILER_MSVC) |
395 namespace stdext { | 395 namespace stdext { |
396 | 396 |
397 inline size_t hash_value(const FilePath& f) { | 397 inline size_t hash_value(const FilePath& f) { |
398 return hash_value(f.value()); | 398 return hash_value(f.value()); |
399 } | 399 } |
400 | 400 |
401 } // namespace stdext | 401 } // namespace stdext |
402 #endif // COMPILER | 402 #endif // COMPILER |
403 | 403 |
404 #endif // BASE_FILE_PATH_H_ | 404 #endif // BASE_FILE_PATH_H_ |
OLD | NEW |