Chromium Code Reviews| 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 | |
|
Mark Mentovai
2010/12/16 19:48:19
Windows, a proper name, requires a capital letter.
Kavita Kanetkar
2010/12/17 00:59:32
Done.
| |
| 156 // with a special extended path prefix. | |
| 157 static const CharType kExtendedPathPrefix[]; | |
| 158 #endif | |
| 159 | |
| 154 FilePath(); | 160 FilePath(); |
| 155 FilePath(const FilePath& that); | 161 FilePath(const FilePath& that); |
| 156 explicit FilePath(const StringType& path); | 162 explicit FilePath(const StringType& path); |
| 157 ~FilePath(); | 163 ~FilePath(); |
| 158 FilePath& operator=(const FilePath& that); | 164 FilePath& operator=(const FilePath& that); |
| 159 | 165 |
| 160 bool operator==(const FilePath& that) const; | 166 bool operator==(const FilePath& that) const; |
| 161 | 167 |
| 162 bool operator!=(const FilePath& that) const; | 168 bool operator!=(const FilePath& that) const; |
| 163 | 169 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 FilePath::StringType* path); | 306 FilePath::StringType* path); |
| 301 | 307 |
| 302 void WriteToPickle(Pickle* pickle); | 308 void WriteToPickle(Pickle* pickle); |
| 303 bool ReadFromPickle(Pickle* pickle, void** iter); | 309 bool ReadFromPickle(Pickle* pickle, void** iter); |
| 304 | 310 |
| 305 #if defined(FILE_PATH_USES_WIN_SEPARATORS) | 311 #if defined(FILE_PATH_USES_WIN_SEPARATORS) |
| 306 // Normalize all path separators to backslash. | 312 // Normalize all path separators to backslash. |
| 307 FilePath NormalizeWindowsPathSeparators() const; | 313 FilePath NormalizeWindowsPathSeparators() const; |
| 308 #endif | 314 #endif |
| 309 | 315 |
| 316 #if defined(OS_WIN) | |
| 317 // On windows, returns whether or not path starts with extended path prefix. | |
|
Mark Mentovai
2010/12/16 19:48:19
path. Which path? The path?
extended path prefix.
Kavita Kanetkar
2010/12/17 00:59:32
Done.
| |
| 318 bool StartsWithExtendedPathPrefix() const; | |
|
Mark Mentovai
2010/12/16 19:48:19
A new function requires a unit test, even if it’s
Kavita Kanetkar
2010/12/17 00:59:32
Done.
| |
| 319 #endif | |
| 320 | |
| 310 // Compare two strings in the same way the file system does. | 321 // 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- | 322 // Note that these always ignore case, even on file systems that are case- |
| 312 // sensitive. If case-sensitive comparison is ever needed, add corresponding | 323 // sensitive. If case-sensitive comparison is ever needed, add corresponding |
| 313 // methods here. | 324 // methods here. |
| 314 // The methods are written as a static method so that they can also be used | 325 // 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. | 326 // on parts of a file path, e.g., just the extension. |
| 316 // CompareIgnoreCase() returns -1, 0 or 1 for less-than, equal-to and | 327 // CompareIgnoreCase() returns -1, 0 or 1 for less-than, equal-to and |
| 317 // greater-than respectively. | 328 // greater-than respectively. |
| 318 static int CompareIgnoreCase(const StringType& string1, | 329 static int CompareIgnoreCase(const StringType& string1, |
| 319 const StringType& string2); | 330 const StringType& string2); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 namespace stdext { | 393 namespace stdext { |
| 383 | 394 |
| 384 inline size_t hash_value(const FilePath& f) { | 395 inline size_t hash_value(const FilePath& f) { |
| 385 return hash_value(f.value()); | 396 return hash_value(f.value()); |
| 386 } | 397 } |
| 387 | 398 |
| 388 } // namespace stdext | 399 } // namespace stdext |
| 389 #endif // COMPILER | 400 #endif // COMPILER |
| 390 | 401 |
| 391 #endif // BASE_FILE_PATH_H_ | 402 #endif // BASE_FILE_PATH_H_ |
| OLD | NEW |