OLD | NEW |
1 // Copyright (c) 2010 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 |
11 // --------------- ---------------------------------- | 11 // --------------- ---------------------------------- |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // paths (sometimes)?", available at: | 96 // paths (sometimes)?", available at: |
97 // http://blogs.msdn.com/oldnewthing/archive/2005/11/22/495740.aspx | 97 // http://blogs.msdn.com/oldnewthing/archive/2005/11/22/495740.aspx |
98 | 98 |
99 #ifndef BASE_FILE_PATH_H_ | 99 #ifndef BASE_FILE_PATH_H_ |
100 #define BASE_FILE_PATH_H_ | 100 #define BASE_FILE_PATH_H_ |
101 #pragma once | 101 #pragma once |
102 | 102 |
103 #include <string> | 103 #include <string> |
104 #include <vector> | 104 #include <vector> |
105 | 105 |
| 106 #include "base/base_api.h" |
106 #include "base/basictypes.h" | 107 #include "base/basictypes.h" |
107 #include "base/compiler_specific.h" | 108 #include "base/compiler_specific.h" |
108 #include "base/hash_tables.h" | 109 #include "base/hash_tables.h" |
109 #include "base/string_piece.h" // For implicit conversions. | 110 #include "base/string_piece.h" // For implicit conversions. |
110 | 111 |
111 // Windows-style drive letter support and pathname separator characters can be | 112 // Windows-style drive letter support and pathname separator characters can be |
112 // enabled and disabled independently, to aid testing. These #defines are | 113 // enabled and disabled independently, to aid testing. These #defines are |
113 // here so that the same setting can be used in both the implementation and | 114 // here so that the same setting can be used in both the implementation and |
114 // in the unit test. | 115 // in the unit test. |
115 #if defined(OS_WIN) | 116 #if defined(OS_WIN) |
116 #define FILE_PATH_USES_DRIVE_LETTERS | 117 #define FILE_PATH_USES_DRIVE_LETTERS |
117 #define FILE_PATH_USES_WIN_SEPARATORS | 118 #define FILE_PATH_USES_WIN_SEPARATORS |
118 #endif // OS_WIN | 119 #endif // OS_WIN |
119 | 120 |
120 class Pickle; | 121 class Pickle; |
121 | 122 |
122 // An abstraction to isolate users from the differences between native | 123 // An abstraction to isolate users from the differences between native |
123 // pathnames on different platforms. | 124 // pathnames on different platforms. |
124 class FilePath { | 125 class BASE_API FilePath { |
125 public: | 126 public: |
126 #if defined(OS_POSIX) | 127 #if defined(OS_POSIX) |
127 // On most platforms, native pathnames are char arrays, and the encoding | 128 // On most platforms, native pathnames are char arrays, and the encoding |
128 // may or may not be specified. On Mac OS X, native pathnames are encoded | 129 // may or may not be specified. On Mac OS X, native pathnames are encoded |
129 // in UTF-8. | 130 // in UTF-8. |
130 typedef std::string StringType; | 131 typedef std::string StringType; |
131 #elif defined(OS_WIN) | 132 #elif defined(OS_WIN) |
132 // On Windows, for Unicode-aware applications, native pathnames are wchar_t | 133 // On Windows, for Unicode-aware applications, native pathnames are wchar_t |
133 // arrays encoded in UTF-16. | 134 // arrays encoded in UTF-16. |
134 typedef std::wstring StringType; | 135 typedef std::wstring StringType; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 namespace stdext { | 396 namespace stdext { |
396 | 397 |
397 inline size_t hash_value(const FilePath& f) { | 398 inline size_t hash_value(const FilePath& f) { |
398 return hash_value(f.value()); | 399 return hash_value(f.value()); |
399 } | 400 } |
400 | 401 |
401 } // namespace stdext | 402 } // namespace stdext |
402 #endif // COMPILER | 403 #endif // COMPILER |
403 | 404 |
404 #endif // BASE_FILE_PATH_H_ | 405 #endif // BASE_FILE_PATH_H_ |
OLD | NEW |