| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // File utilities that use the ICU library go in this file. | 5 // File utilities that use the ICU library go in this file. |
| 6 | 6 |
| 7 #include "base/i18n/file_util_icu.h" | 7 #include "base/i18n/file_util_icu.h" |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 set.reset(new icu::UnicodeSet(icu::UnicodeString( | 55 set.reset(new icu::UnicodeSet(icu::UnicodeString( |
| 56 L"[[\"*/:<>?\\\\|][:Cc:][:Cf:] - [\u200c\u200d]]"), status)); | 56 L"[[\"*/:<>?\\\\|][:Cc:][:Cf:] - [\u200c\u200d]]"), status)); |
| 57 #else | 57 #else |
| 58 set.reset(new icu::UnicodeSet(UNICODE_STRING_SIMPLE( | 58 set.reset(new icu::UnicodeSet(UNICODE_STRING_SIMPLE( |
| 59 "[[\"*/:<>?\\\\|][:Cc:][:Cf:] - [\\u200c\\u200d]]").unescape(), | 59 "[[\"*/:<>?\\\\|][:Cc:][:Cf:] - [\\u200c\\u200d]]").unescape(), |
| 60 status)); | 60 status)); |
| 61 #endif | 61 #endif |
| 62 DCHECK(U_SUCCESS(status)); | 62 DCHECK(U_SUCCESS(status)); |
| 63 // Add non-characters. If this becomes a performance bottleneck by | 63 // Add non-characters. If this becomes a performance bottleneck by |
| 64 // any chance, do not add these to |set| and change IsFilenameLegal() | 64 // any chance, do not add these to |set| and change IsFilenameLegal() |
| 65 // to check |ucs4 & 0xFFFEu == 0xFFFEu|, in addition to calling | 65 // to check |ucs4 & 0xFFFEu == 0xFFFEu|, in addiition to calling |
| 66 // containsNone(). | 66 // containsNone(). |
| 67 set->add(0xFDD0, 0xFDEF); | 67 set->add(0xFDD0, 0xFDEF); |
| 68 set->add(0xFFFD); // Standard replacement character. | |
| 69 for (int i = 0; i <= 0x10; ++i) { | 68 for (int i = 0; i <= 0x10; ++i) { |
| 70 int plane_base = 0x10000 * i; | 69 int plane_base = 0x10000 * i; |
| 71 set->add(plane_base + 0xFFFE, plane_base + 0xFFFF); | 70 set->add(plane_base + 0xFFFE, plane_base + 0xFFFF); |
| 72 } | 71 } |
| 73 set->freeze(); | 72 set->freeze(); |
| 74 } | 73 } |
| 75 | 74 |
| 76 class LocaleAwareComparator { | 75 class LocaleAwareComparator { |
| 77 public: | 76 public: |
| 78 LocaleAwareComparator() { | 77 LocaleAwareComparator() { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // TODO(yuzo): Perhaps we should define SysNativeMBToUTF16? | 181 // TODO(yuzo): Perhaps we should define SysNativeMBToUTF16? |
| 183 return Singleton<LocaleAwareComparator>()->Compare( | 182 return Singleton<LocaleAwareComparator>()->Compare( |
| 184 WideToUTF16(base::SysNativeMBToWide(a.value().c_str())), | 183 WideToUTF16(base::SysNativeMBToWide(a.value().c_str())), |
| 185 WideToUTF16(base::SysNativeMBToWide(b.value().c_str()))) < 0; | 184 WideToUTF16(base::SysNativeMBToWide(b.value().c_str()))) < 0; |
| 186 #else | 185 #else |
| 187 #error Not implemented on your system | 186 #error Not implemented on your system |
| 188 #endif | 187 #endif |
| 189 } | 188 } |
| 190 | 189 |
| 191 } // namespace | 190 } // namespace |
| OLD | NEW |