OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/chrome/browser/ui/util/unicode_util.h" | 5 #import "ios/chrome/browser/ui/util/unicode_util.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." |
| 11 #endif |
| 12 |
9 namespace unicode_util { | 13 namespace unicode_util { |
10 namespace { | 14 namespace { |
11 // Character ranges for characters with R or AL bidirectionality. | 15 // Character ranges for characters with R or AL bidirectionality. |
12 // http://www.ietf.org/rfc/rfc3454.txt | 16 // http://www.ietf.org/rfc/rfc3454.txt |
13 const NSUInteger kRTLRangeCount = 34; | 17 const NSUInteger kRTLRangeCount = 34; |
14 unichar kRTLUnicodeRanges[kRTLRangeCount][2] = { | 18 unichar kRTLUnicodeRanges[kRTLRangeCount][2] = { |
15 {0x05BE, 0x05BE}, {0x05C0, 0x05C0}, {0x05C3, 0x05C3}, {0x05D0, 0x05EA}, | 19 {0x05BE, 0x05BE}, {0x05C0, 0x05C0}, {0x05C3, 0x05C3}, {0x05D0, 0x05EA}, |
16 {0x05F0, 0x05F4}, {0x061B, 0x061B}, {0x061F, 0x061F}, {0x0621, 0x063A}, | 20 {0x05F0, 0x05F4}, {0x061B, 0x061B}, {0x061F, 0x061F}, {0x0621, 0x063A}, |
17 {0x0640, 0x064A}, {0x066D, 0x066F}, {0x0671, 0x06D5}, {0x06DD, 0x06DD}, | 21 {0x0640, 0x064A}, {0x066D, 0x066F}, {0x0671, 0x06D5}, {0x06DD, 0x06DD}, |
18 {0x06E5, 0x06E6}, {0x06FA, 0x06FE}, {0x0700, 0x070D}, {0x0710, 0x0710}, | 22 {0x06E5, 0x06E6}, {0x06FA, 0x06FE}, {0x0700, 0x070D}, {0x0710, 0x0710}, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 else if (c < 0x0100) | 107 else if (c < 0x0100) |
104 zero_prefix = @"00"; | 108 zero_prefix = @"00"; |
105 else if (c < 0x1000) | 109 else if (c < 0x1000) |
106 zero_prefix = @"0"; | 110 zero_prefix = @"0"; |
107 [unicode_string appendFormat:@"\\u%@%x", zero_prefix, c]; | 111 [unicode_string appendFormat:@"\\u%@%x", zero_prefix, c]; |
108 } | 112 } |
109 return unicode_string; | 113 return unicode_string; |
110 } | 114 } |
111 | 115 |
112 } // namespace unicode_util | 116 } // namespace unicode_util |
OLD | NEW |