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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 <stddef.h> | 103 #include <stddef.h> |
104 #include <string> | 104 #include <string> |
105 #include <vector> | 105 #include <vector> |
106 | 106 |
107 #include "base/base_api.h" | 107 #include "base/base_export.h" |
108 #include "base/compiler_specific.h" | 108 #include "base/compiler_specific.h" |
109 #include "base/hash_tables.h" | 109 #include "base/hash_tables.h" |
110 #include "base/string16.h" | 110 #include "base/string16.h" |
111 #include "base/string_piece.h" // For implicit conversions. | 111 #include "base/string_piece.h" // For implicit conversions. |
112 #include "build/build_config.h" | 112 #include "build/build_config.h" |
113 | 113 |
114 // Windows-style drive letter support and pathname separator characters can be | 114 // Windows-style drive letter support and pathname separator characters can be |
115 // enabled and disabled independently, to aid testing. These #defines are | 115 // enabled and disabled independently, to aid testing. These #defines are |
116 // here so that the same setting can be used in both the implementation and | 116 // here so that the same setting can be used in both the implementation and |
117 // in the unit test. | 117 // in the unit test. |
118 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
119 #define FILE_PATH_USES_DRIVE_LETTERS | 119 #define FILE_PATH_USES_DRIVE_LETTERS |
120 #define FILE_PATH_USES_WIN_SEPARATORS | 120 #define FILE_PATH_USES_WIN_SEPARATORS |
121 #endif // OS_WIN | 121 #endif // OS_WIN |
122 | 122 |
123 class Pickle; | 123 class Pickle; |
124 | 124 |
125 // An abstraction to isolate users from the differences between native | 125 // An abstraction to isolate users from the differences between native |
126 // pathnames on different platforms. | 126 // pathnames on different platforms. |
127 class BASE_API FilePath { | 127 class BASE_EXPORT FilePath { |
128 public: | 128 public: |
129 #if defined(OS_POSIX) | 129 #if defined(OS_POSIX) |
130 // On most platforms, native pathnames are char arrays, and the encoding | 130 // On most platforms, native pathnames are char arrays, and the encoding |
131 // may or may not be specified. On Mac OS X, native pathnames are encoded | 131 // may or may not be specified. On Mac OS X, native pathnames are encoded |
132 // in UTF-8. | 132 // in UTF-8. |
133 typedef std::string StringType; | 133 typedef std::string StringType; |
134 #elif defined(OS_WIN) | 134 #elif defined(OS_WIN) |
135 // On Windows, for Unicode-aware applications, native pathnames are wchar_t | 135 // On Windows, for Unicode-aware applications, native pathnames are wchar_t |
136 // arrays encoded in UTF-16. | 136 // arrays encoded in UTF-16. |
137 typedef std::wstring StringType; | 137 typedef std::wstring StringType; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 394 |
395 inline size_t hash_value(const FilePath& f) { | 395 inline size_t hash_value(const FilePath& f) { |
396 return hash_value(f.value()); | 396 return hash_value(f.value()); |
397 } | 397 } |
398 | 398 |
399 #endif // COMPILER | 399 #endif // COMPILER |
400 | 400 |
401 } // namespace BASE_HASH_NAMESPACE | 401 } // namespace BASE_HASH_NAMESPACE |
402 | 402 |
403 #endif // BASE_FILE_PATH_H_ | 403 #endif // BASE_FILE_PATH_H_ |
OLD | NEW |