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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // | 334 // |
335 // Like AsUTF8Unsafe(), this function is unsafe. This function | 335 // Like AsUTF8Unsafe(), this function is unsafe. This function |
336 // internally calls SysWideToNativeMB() on POSIX systems other than Mac | 336 // internally calls SysWideToNativeMB() on POSIX systems other than Mac |
337 // and Chrome OS, to mitigate the encoding issue. See the comment at | 337 // and Chrome OS, to mitigate the encoding issue. See the comment at |
338 // AsUTF8Unsafe() for details. | 338 // AsUTF8Unsafe() for details. |
339 static FilePath FromUTF8Unsafe(const std::string& utf8); | 339 static FilePath FromUTF8Unsafe(const std::string& utf8); |
340 | 340 |
341 void WriteToPickle(Pickle* pickle); | 341 void WriteToPickle(Pickle* pickle); |
342 bool ReadFromPickle(Pickle* pickle, void** iter); | 342 bool ReadFromPickle(Pickle* pickle, void** iter); |
343 | 343 |
344 #if defined(FILE_PATH_USES_WIN_SEPARATORS) | 344 // Normalize all path separators to backslash on Windows |
345 // Normalize all path separators to backslash. | 345 // (if FILE_PATH_USES_WIN_SEPARATORS is true), or do nothing on POSIX systems. |
346 FilePath NormalizeWindowsPathSeparators() const; | 346 FilePath NormalizePathSeparators() const; |
347 #endif | |
348 | 347 |
349 // Compare two strings in the same way the file system does. | 348 // Compare two strings in the same way the file system does. |
350 // Note that these always ignore case, even on file systems that are case- | 349 // Note that these always ignore case, even on file systems that are case- |
351 // sensitive. If case-sensitive comparison is ever needed, add corresponding | 350 // sensitive. If case-sensitive comparison is ever needed, add corresponding |
352 // methods here. | 351 // methods here. |
353 // The methods are written as a static method so that they can also be used | 352 // The methods are written as a static method so that they can also be used |
354 // on parts of a file path, e.g., just the extension. | 353 // on parts of a file path, e.g., just the extension. |
355 // CompareIgnoreCase() returns -1, 0 or 1 for less-than, equal-to and | 354 // CompareIgnoreCase() returns -1, 0 or 1 for less-than, equal-to and |
356 // greater-than respectively. | 355 // greater-than respectively. |
357 static int CompareIgnoreCase(const StringType& string1, | 356 static int CompareIgnoreCase(const StringType& string1, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 419 |
421 inline size_t hash_value(const FilePath& f) { | 420 inline size_t hash_value(const FilePath& f) { |
422 return hash_value(f.value()); | 421 return hash_value(f.value()); |
423 } | 422 } |
424 | 423 |
425 #endif // COMPILER | 424 #endif // COMPILER |
426 | 425 |
427 } // namespace BASE_HASH_NAMESPACE | 426 } // namespace BASE_HASH_NAMESPACE |
428 | 427 |
429 #endif // BASE_FILE_PATH_H_ | 428 #endif // BASE_FILE_PATH_H_ |
OLD | NEW |