| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 string16 AsUTF16Unsafe() const; | 366 string16 AsUTF16Unsafe() const; |
| 367 | 367 |
| 368 // Returns a FilePath object from a path name in UTF-8. This function | 368 // Returns a FilePath object from a path name in UTF-8. This function |
| 369 // should only be used for cases where you are sure that the input | 369 // should only be used for cases where you are sure that the input |
| 370 // string is UTF-8. | 370 // string is UTF-8. |
| 371 // | 371 // |
| 372 // Like AsUTF8Unsafe(), this function is unsafe. This function | 372 // Like AsUTF8Unsafe(), this function is unsafe. This function |
| 373 // internally calls SysWideToNativeMB() on POSIX systems other than Mac | 373 // internally calls SysWideToNativeMB() on POSIX systems other than Mac |
| 374 // and Chrome OS, to mitigate the encoding issue. See the comment at | 374 // and Chrome OS, to mitigate the encoding issue. See the comment at |
| 375 // AsUTF8Unsafe() for details. | 375 // AsUTF8Unsafe() for details. |
| 376 static FilePath FromUTF8Unsafe(const std::string& utf8); | 376 static FilePath FromUTF8Unsafe(StringPiece utf8); |
| 377 | 377 |
| 378 // Similar to FromUTF8Unsafe, but accepts UTF-16 instead. | 378 // Similar to FromUTF8Unsafe, but accepts UTF-16 instead. |
| 379 static FilePath FromUTF16Unsafe(const string16& utf16); | 379 static FilePath FromUTF16Unsafe(StringPiece16 utf16); |
| 380 | 380 |
| 381 void GetSizeForPickle(PickleSizer* sizer) const; | 381 void GetSizeForPickle(PickleSizer* sizer) const; |
| 382 void WriteToPickle(Pickle* pickle) const; | 382 void WriteToPickle(Pickle* pickle) const; |
| 383 bool ReadFromPickle(PickleIterator* iter); | 383 bool ReadFromPickle(PickleIterator* iter); |
| 384 | 384 |
| 385 // Normalize all path separators to backslash on Windows | 385 // Normalize all path separators to backslash on Windows |
| 386 // (if FILE_PATH_USES_WIN_SEPARATORS is true), or do nothing on POSIX systems. | 386 // (if FILE_PATH_USES_WIN_SEPARATORS is true), or do nothing on POSIX systems. |
| 387 FilePath NormalizePathSeparators() const; | 387 FilePath NormalizePathSeparators() const; |
| 388 | 388 |
| 389 // Normalize all path separattors to given type on Windows | 389 // Normalize all path separattors to given type on Windows |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 template<> | 470 template<> |
| 471 struct hash<base::FilePath> { | 471 struct hash<base::FilePath> { |
| 472 size_t operator()(const base::FilePath& f) const { | 472 size_t operator()(const base::FilePath& f) const { |
| 473 return hash<base::FilePath::StringType>()(f.value()); | 473 return hash<base::FilePath::StringType>()(f.value()); |
| 474 } | 474 } |
| 475 }; | 475 }; |
| 476 | 476 |
| 477 } // namespace BASE_HASH_NAMESPACE | 477 } // namespace BASE_HASH_NAMESPACE |
| 478 | 478 |
| 479 #endif // BASE_FILES_FILE_PATH_H_ | 479 #endif // BASE_FILES_FILE_PATH_H_ |
| OLD | NEW |