OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 | 144 |
145 // A special path component meaning "this directory." | 145 // A special path component meaning "this directory." |
146 static const CharType kCurrentDirectory[]; | 146 static const CharType kCurrentDirectory[]; |
147 | 147 |
148 // A special path component meaning "the parent directory." | 148 // A special path component meaning "the parent directory." |
149 static const CharType kParentDirectory[]; | 149 static const CharType kParentDirectory[]; |
150 | 150 |
151 // The character used to identify a file extension. | 151 // The character used to identify a file extension. |
152 static const CharType kExtensionSeparator; | 152 static const CharType kExtensionSeparator; |
153 | 153 |
154 #if defined(OS_WIN) | |
155 // Path length is limited to 260 on Windows unless prefixed | |
156 // with a special extended path prefix. UNC needs a separate | |
157 // prefix containing "UNC" in it. | |
158 static const CharType kExtendedPathPrefix[]; | |
159 static const CharType kUNCExtendedPathPrefix[]; | |
160 // '\\' Prefix for network shares. | |
Erik does not do reviews
2010/12/23 17:57:27
nit: newline above comments
| |
161 static const CharType kSharePrefix[]; | |
162 #endif | |
163 | |
154 FilePath(); | 164 FilePath(); |
155 FilePath(const FilePath& that); | 165 FilePath(const FilePath& that); |
156 explicit FilePath(const StringType& path); | 166 explicit FilePath(const StringType& path); |
157 ~FilePath(); | 167 ~FilePath(); |
158 FilePath& operator=(const FilePath& that); | 168 FilePath& operator=(const FilePath& that); |
159 | 169 |
160 bool operator==(const FilePath& that) const; | 170 bool operator==(const FilePath& that) const; |
161 | 171 |
162 bool operator!=(const FilePath& that) const; | 172 bool operator!=(const FilePath& that) const; |
163 | 173 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 FilePath::StringType* path); | 310 FilePath::StringType* path); |
301 | 311 |
302 void WriteToPickle(Pickle* pickle); | 312 void WriteToPickle(Pickle* pickle); |
303 bool ReadFromPickle(Pickle* pickle, void** iter); | 313 bool ReadFromPickle(Pickle* pickle, void** iter); |
304 | 314 |
305 #if defined(FILE_PATH_USES_WIN_SEPARATORS) | 315 #if defined(FILE_PATH_USES_WIN_SEPARATORS) |
306 // Normalize all path separators to backslash. | 316 // Normalize all path separators to backslash. |
307 FilePath NormalizeWindowsPathSeparators() const; | 317 FilePath NormalizeWindowsPathSeparators() const; |
308 #endif | 318 #endif |
309 | 319 |
320 #if defined(OS_WIN) | |
321 // Gets the long form if it is in 8.3 file name format. Note that this | |
322 // is not supported for WinCE. | |
323 // This also prepends the extended path prefix so that paths longer | |
324 // than MAX_PATH char can be supported. | |
325 // Note: The path needs to exist to make this return a correct long path | |
Erik does not do reviews
2010/12/23 17:57:27
This isn't acceptable in FilePath. One of FilePat
| |
326 // if it has 8.3 short names contained in it. | |
327 FilePath GetLongPathHack() const; | |
328 | |
329 bool StartsWithExtendedPathOrUNCPrefix() const; | |
330 #endif | |
331 | |
310 // Compare two strings in the same way the file system does. | 332 // Compare two strings in the same way the file system does. |
311 // Note that these always ignore case, even on file systems that are case- | 333 // Note that these always ignore case, even on file systems that are case- |
312 // sensitive. If case-sensitive comparison is ever needed, add corresponding | 334 // sensitive. If case-sensitive comparison is ever needed, add corresponding |
313 // methods here. | 335 // methods here. |
314 // The methods are written as a static method so that they can also be used | 336 // The methods are written as a static method so that they can also be used |
315 // on parts of a file path, e.g., just the extension. | 337 // on parts of a file path, e.g., just the extension. |
316 // CompareIgnoreCase() returns -1, 0 or 1 for less-than, equal-to and | 338 // CompareIgnoreCase() returns -1, 0 or 1 for less-than, equal-to and |
317 // greater-than respectively. | 339 // greater-than respectively. |
318 static int CompareIgnoreCase(const StringType& string1, | 340 static int CompareIgnoreCase(const StringType& string1, |
319 const StringType& string2); | 341 const StringType& string2); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 namespace stdext { | 404 namespace stdext { |
383 | 405 |
384 inline size_t hash_value(const FilePath& f) { | 406 inline size_t hash_value(const FilePath& f) { |
385 return hash_value(f.value()); | 407 return hash_value(f.value()); |
386 } | 408 } |
387 | 409 |
388 } // namespace stdext | 410 } // namespace stdext |
389 #endif // COMPILER | 411 #endif // COMPILER |
390 | 412 |
391 #endif // BASE_FILE_PATH_H_ | 413 #endif // BASE_FILE_PATH_H_ |
OLD | NEW |