Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: third_party/icu/source/i18n/translit.cpp

Issue 6520018: Get ICU 4.6 to be compiled without RTTI.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: do not include typeinfo at all Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/icu/source/i18n/tmutfmt.cpp ('k') | third_party/icu/source/i18n/tzrule.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ********************************************************************** 2 **********************************************************************
3 * Copyright (C) 1999-2010, International Business Machines 3 * Copyright (C) 1999-2010, International Business Machines
4 * Corporation and others. All Rights Reserved. 4 * Corporation and others. All Rights Reserved.
5 ********************************************************************** 5 **********************************************************************
6 * Date Name Description 6 * Date Name Description
7 * 11/17/99 aliu Creation. 7 * 11/17/99 aliu Creation.
8 ********************************************************************** 8 **********************************************************************
9 */ 9 */
10 10
11 #include <typeinfo> // for 'typeid' to work
12 11
13 #include "unicode/utypes.h" 12 #include "unicode/utypes.h"
14 13
15 #if !UCONFIG_NO_TRANSLITERATION 14 #if !UCONFIG_NO_TRANSLITERATION
16 15
17 #include "unicode/putil.h" 16 #include "unicode/putil.h"
18 #include "unicode/translit.h" 17 #include "unicode/translit.h"
19 #include "unicode/locid.h" 18 #include "unicode/locid.h"
20 #include "unicode/msgfmt.h" 19 #include "unicode/msgfmt.h"
21 #include "unicode/rep.h" 20 #include "unicode/rep.h"
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 1094
1096 int32_t limit = parser.idBlockVector.size(); 1095 int32_t limit = parser.idBlockVector.size();
1097 if (parser.dataVector.size() > limit) 1096 if (parser.dataVector.size() > limit)
1098 limit = parser.dataVector.size(); 1097 limit = parser.dataVector.size();
1099 1098
1100 for (int32_t i = 0; i < limit; i++) { 1099 for (int32_t i = 0; i < limit; i++) {
1101 if (i < parser.idBlockVector.size()) { 1100 if (i < parser.idBlockVector.size()) {
1102 UnicodeString* idBlock = (UnicodeString*)parser.idBlockVector.el ementAt(i); 1101 UnicodeString* idBlock = (UnicodeString*)parser.idBlockVector.el ementAt(i);
1103 if (!idBlock->isEmpty()) { 1102 if (!idBlock->isEmpty()) {
1104 Transliterator* temp = createInstance(*idBlock, UTRANS_FORWA RD, parseError, status); 1103 Transliterator* temp = createInstance(*idBlock, UTRANS_FORWA RD, parseError, status);
1105 if (temp != NULL && typeid(*temp) != typeid(NullTransliterat or)) 1104 // Chrome: Blind replacement of typeid with CR_TYPEID
1105 // doesn't work here.
1106 if (temp != NULL && CR_TYPEID(*temp) != NullTransliterator:: getStaticClassID())
1106 transliterators.addElement(temp, status); 1107 transliterators.addElement(temp, status);
1107 else 1108 else
1108 delete temp; 1109 delete temp;
1109 } 1110 }
1110 } 1111 }
1111 if (!parser.dataVector.isEmpty()) { 1112 if (!parser.dataVector.isEmpty()) {
1112 TransliterationRuleData* data = (TransliterationRuleData*)parser .dataVector.orphanElementAt(0); 1113 TransliterationRuleData* data = (TransliterationRuleData*)parser .dataVector.orphanElementAt(0);
1113 RuleBasedTransliterator* temprbt = new RuleBasedTransliterator(U nicodeString(CompoundTransliterator::PASS_STRING) + (passNumber++), 1114 RuleBasedTransliterator* temprbt = new RuleBasedTransliterator(U nicodeString(CompoundTransliterator::PASS_STRING) + (passNumber++),
1114 data, TRUE); 1115 data, TRUE);
1115 // Check if NULL before adding it to transliterators to avoid fu ture usage of NULL pointer. 1116 // Check if NULL before adding it to transliterators to avoid fu ture usage of NULL pointer.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 } else { 1152 } else {
1152 rulesSource = getID(); 1153 rulesSource = getID();
1153 } 1154 }
1154 // KEEP in sync with rbt_pars 1155 // KEEP in sync with rbt_pars
1155 rulesSource.insert(0, UNICODE_STRING_SIMPLE("::")); 1156 rulesSource.insert(0, UNICODE_STRING_SIMPLE("::"));
1156 rulesSource.append(ID_DELIM); 1157 rulesSource.append(ID_DELIM);
1157 return rulesSource; 1158 return rulesSource;
1158 } 1159 }
1159 1160
1160 int32_t Transliterator::countElements() const { 1161 int32_t Transliterator::countElements() const {
1161 const CompoundTransliterator* ct = dynamic_cast<const CompoundTransliterator *>(this); 1162 const CompoundTransliterator* ct = CR_DYNAMIC_CAST<const CompoundTranslitera tor*>(this);
1162 return ct != NULL ? ct->getCount() : 0; 1163 return ct != NULL ? ct->getCount() : 0;
1163 } 1164 }
1164 1165
1165 const Transliterator& Transliterator::getElement(int32_t index, UErrorCode& ec) const { 1166 const Transliterator& Transliterator::getElement(int32_t index, UErrorCode& ec) const {
1166 if (U_FAILURE(ec)) { 1167 if (U_FAILURE(ec)) {
1167 return *this; 1168 return *this;
1168 } 1169 }
1169 const CompoundTransliterator* cpd = dynamic_cast<const CompoundTransliterato r*>(this); 1170 const CompoundTransliterator* cpd = CR_DYNAMIC_CAST<const CompoundTransliter ator*>(this);
1170 int32_t n = (cpd == NULL) ? 1 : cpd->getCount(); 1171 int32_t n = (cpd == NULL) ? 1 : cpd->getCount();
1171 if (index < 0 || index >= n) { 1172 if (index < 0 || index >= n) {
1172 ec = U_INDEX_OUTOFBOUNDS_ERROR; 1173 ec = U_INDEX_OUTOFBOUNDS_ERROR;
1173 return *this; 1174 return *this;
1174 } else { 1175 } else {
1175 return (n == 1) ? *this : cpd->getTransliterator(index); 1176 return (n == 1) ? *this : cpd->getTransliterator(index);
1176 } 1177 }
1177 } 1178 }
1178 1179
1179 UnicodeSet& Transliterator::getSourceSet(UnicodeSet& result) const { 1180 UnicodeSet& Transliterator::getSourceSet(UnicodeSet& result) const {
1180 handleGetSourceSet(result); 1181 handleGetSourceSet(result);
1181 if (filter != NULL) { 1182 if (filter != NULL) {
1182 UnicodeSet* filterSet = dynamic_cast<UnicodeSet*>(filter); 1183 UnicodeSet* filterSet = CR_DYNAMIC_CAST<UnicodeSet*>(filter);
1183 UBool deleteFilterSet = FALSE; 1184 UBool deleteFilterSet = FALSE;
1184 // Most, but not all filters will be UnicodeSets. Optimize for 1185 // Most, but not all filters will be UnicodeSets. Optimize for
1185 // the high-runner case. 1186 // the high-runner case.
1186 if (filterSet == NULL) { 1187 if (filterSet == NULL) {
1187 filterSet = new UnicodeSet(); 1188 filterSet = new UnicodeSet();
1188 // Check null pointer 1189 // Check null pointer
1189 if (filterSet == NULL) { 1190 if (filterSet == NULL) {
1190 return result; 1191 return result;
1191 } 1192 }
1192 deleteFilterSet = TRUE; 1193 deleteFilterSet = TRUE;
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 delete registry; 1636 delete registry;
1636 registry = NULL; 1637 registry = NULL;
1637 } 1638 }
1638 umtx_destroy(&registryMutex); 1639 umtx_destroy(&registryMutex);
1639 return TRUE; 1640 return TRUE;
1640 } 1641 }
1641 1642
1642 #endif /* #if !UCONFIG_NO_TRANSLITERATION */ 1643 #endif /* #if !UCONFIG_NO_TRANSLITERATION */
1643 1644
1644 //eof 1645 //eof
OLDNEW
« no previous file with comments | « third_party/icu/source/i18n/tmutfmt.cpp ('k') | third_party/icu/source/i18n/tzrule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698