OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 2003-2010, International Business Machines | 4 * Copyright (C) 2003-2014, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * file name: nptrans.h | 8 * file name: nptrans.h |
9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
11 * indentation:4 | 11 * indentation:4 |
12 * | 12 * |
13 * created on: 2003feb1 | 13 * created on: 2003feb1 |
14 * created by: Ram Viswanadha | 14 * created by: Ram Viswanadha |
15 */ | 15 */ |
16 | 16 |
17 #include "unicode/utypes.h" | 17 #include "unicode/utypes.h" |
18 | 18 |
19 #if !UCONFIG_NO_TRANSLITERATION | 19 #if !UCONFIG_NO_TRANSLITERATION |
20 #if !UCONFIG_NO_IDNA | 20 #if !UCONFIG_NO_IDNA |
21 | 21 |
22 #include "nptrans.h" | 22 #include "nptrans.h" |
23 #include "unicode/resbund.h" | 23 #include "unicode/resbund.h" |
24 #include "unicode/uniset.h" | 24 #include "unicode/uniset.h" |
25 #include "sprpimpl.h" | 25 #include "sprpimpl.h" |
26 #include "cmemory.h" | 26 #include "cmemory.h" |
27 #include "ustr_imp.h" | 27 #include "ustr_imp.h" |
28 #include "intltest.h" | 28 #include "intltest.h" |
29 | 29 |
30 #ifdef DEBUG | 30 #ifdef NPTRANS_DEBUG |
31 #include <stdio.h> | 31 #include <stdio.h> |
32 #endif | 32 #endif |
33 | 33 |
34 const char NamePrepTransform::fgClassID=0; | 34 const char NamePrepTransform::fgClassID=0; |
35 | 35 |
36 //Factory method | 36 //Factory method |
37 NamePrepTransform* NamePrepTransform::createInstance(UParseError& parseError, UE
rrorCode& status){ | 37 NamePrepTransform* NamePrepTransform::createInstance(UParseError& parseError, UE
rrorCode& status){ |
38 NamePrepTransform* transform = new NamePrepTransform(parseError, status); | 38 NamePrepTransform* transform = new NamePrepTransform(parseError, status); |
39 if(U_FAILURE(status)){ | 39 if(U_FAILURE(status)){ |
40 delete transform; | 40 delete transform; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 //create the unassigned set | 77 //create the unassigned set |
78 int32_t patternLen =0; | 78 int32_t patternLen =0; |
79 const UChar* pattern = ures_getStringByKey(bundle,"UnassignedSet",&patte
rnLen, &status); | 79 const UChar* pattern = ures_getStringByKey(bundle,"UnassignedSet",&patte
rnLen, &status); |
80 unassigned.applyPattern(UnicodeString(pattern, patternLen), status); | 80 unassigned.applyPattern(UnicodeString(pattern, patternLen), status); |
81 | 81 |
82 //create prohibited set | 82 //create prohibited set |
83 patternLen=0; | 83 patternLen=0; |
84 pattern = ures_getStringByKey(bundle,"ProhibitedSet",&patternLen, &stat
us); | 84 pattern = ures_getStringByKey(bundle,"ProhibitedSet",&patternLen, &stat
us); |
85 UnicodeString test(pattern,patternLen); | 85 UnicodeString test(pattern,patternLen); |
86 prohibited.applyPattern(test,status); | 86 prohibited.applyPattern(test,status); |
87 #ifdef DEBUG | 87 #ifdef NPTRANS_DEBUG |
88 if(U_FAILURE(status)){ | 88 if(U_FAILURE(status)){ |
89 printf("Construction of Unicode set failed\n"); | 89 printf("Construction of Unicode set failed\n"); |
90 } | 90 } |
91 | 91 |
92 if(U_SUCCESS(status)){ | 92 if(U_SUCCESS(status)){ |
93 if(prohibited.contains((UChar) 0x644)){ | 93 if(prohibited.contains((UChar) 0x644)){ |
94 printf("The string contains 0x644 ... damn !!\n"); | 94 printf("The string contains 0x644 ... !!\n"); |
95 } | 95 } |
96 UnicodeString temp; | 96 UnicodeString temp; |
97 prohibited.toPattern(temp,TRUE); | 97 prohibited.toPattern(temp,TRUE); |
98 | 98 |
99 for(int32_t i=0;i<temp.length();i++){ | 99 for(int32_t i=0;i<temp.length();i++){ |
100 printf("%c", (char)temp.charAt(i)); | 100 printf("%c", (char)temp.charAt(i)); |
101 } | 101 } |
102 printf("\n"); | 102 printf("\n"); |
103 } | 103 } |
104 #endif | 104 #endif |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // check error status | 275 // check error status |
276 if(U_FAILURE(status)){ | 276 if(U_FAILURE(status)){ |
277 return FALSE; | 277 return FALSE; |
278 } | 278 } |
279 | 279 |
280 return labelSeparatorSet.contains(ch); | 280 return labelSeparatorSet.contains(ch); |
281 } | 281 } |
282 | 282 |
283 #endif /* #if !UCONFIG_NO_IDNA */ | 283 #endif /* #if !UCONFIG_NO_IDNA */ |
284 #endif /* #if !UCONFIG_NO_TRANSLITERATION */ | 284 #endif /* #if !UCONFIG_NO_TRANSLITERATION */ |
OLD | NEW |