OLD | NEW |
1 // Copyright (c) 2010 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 #ifndef BASE_I18N_FILE_UTIL_ICU_H_ | 5 #ifndef BASE_I18N_FILE_UTIL_ICU_H_ |
6 #define BASE_I18N_FILE_UTIL_ICU_H_ | 6 #define BASE_I18N_FILE_UTIL_ICU_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // File utilities that use the ICU library go in this file. | 9 // File utilities that use the ICU library go in this file. |
10 | 10 |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/i18n/base_i18n_export.h" |
12 #include "base/string16.h" | 13 #include "base/string16.h" |
13 | 14 |
14 namespace file_util { | 15 namespace file_util { |
15 | 16 |
16 // Returns true if file_name does not have any illegal character. The input | 17 // Returns true if file_name does not have any illegal character. The input |
17 // param has the same restriction as that for ReplaceIllegalCharacters. | 18 // param has the same restriction as that for ReplaceIllegalCharacters. |
18 bool IsFilenameLegal(const string16& file_name); | 19 BASE_I18N_EXPORT bool IsFilenameLegal(const string16& file_name); |
19 | 20 |
20 // Replaces characters in 'file_name' that are illegal for file names with | 21 // Replaces characters in 'file_name' that are illegal for file names with |
21 // 'replace_char'. 'file_name' must not be a full or relative path, but just the | 22 // 'replace_char'. 'file_name' must not be a full or relative path, but just the |
22 // file name component (since slashes are considered illegal). Any leading or | 23 // file name component (since slashes are considered illegal). Any leading or |
23 // trailing whitespace in 'file_name' is removed. | 24 // trailing whitespace in 'file_name' is removed. |
24 // Example: | 25 // Example: |
25 // file_name == "bad:file*name?.txt", changed to: "bad-file-name-.txt" when | 26 // file_name == "bad:file*name?.txt", changed to: "bad-file-name-.txt" when |
26 // 'replace_char' is '-'. | 27 // 'replace_char' is '-'. |
27 void ReplaceIllegalCharactersInPath(FilePath::StringType* file_name, | 28 BASE_I18N_EXPORT void ReplaceIllegalCharactersInPath( |
28 char replace_char); | 29 FilePath::StringType* file_name, |
| 30 char replace_char); |
29 | 31 |
30 // Compares two filenames using the current locale information. This can be | 32 // Compares two filenames using the current locale information. This can be |
31 // used to sort directory listings. It behaves like "operator<" for use in | 33 // used to sort directory listings. It behaves like "operator<" for use in |
32 // std::sort. | 34 // std::sort. |
33 bool LocaleAwareCompareFilenames(const FilePath& a, const FilePath& b); | 35 BASE_I18N_EXPORT bool LocaleAwareCompareFilenames(const FilePath& a, |
| 36 const FilePath& b); |
34 | 37 |
35 } // namespace file_util | 38 } // namespace file_util |
36 | 39 |
37 #endif // BASE_I18N_FILE_UTIL_ICU_H_ | 40 #endif // BASE_I18N_FILE_UTIL_ICU_H_ |
OLD | NEW |