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

Side by Side Diff: src/extensions/experimental/collator.cc

Issue 7033038: Make 'ignoreCase' works in collator. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 7 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 | « src/extensions/experimental/collator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // by a caller in JavaScript. Otherwise, we don't touch because 146 // by a caller in JavaScript. Otherwise, we don't touch because
147 // we don't want to change the locale-dependent default value. 147 // we don't want to change the locale-dependent default value.
148 // The three options below are very likely to have the same default 148 // The three options below are very likely to have the same default
149 // across locales, but I haven't checked them all. Others we may add 149 // across locales, but I haven't checked them all. Others we may add
150 // in the future have certainly locale-dependent default (e.g. 150 // in the future have certainly locale-dependent default (e.g.
151 // caseFirst is upperFirst for Danish while is off for most other locales). 151 // caseFirst is upperFirst for Danish while is off for most other locales).
152 152
153 bool ignore_case, ignore_accents, numeric; 153 bool ignore_case, ignore_accents, numeric;
154 154
155 if (ExtractBooleanOption(options, "ignoreCase", &ignore_case)) { 155 if (ExtractBooleanOption(options, "ignoreCase", &ignore_case)) {
156 // We need to explicitly set the level to secondary to get case ignored.
157 // The default L3 ignores UCOL_CASE_LEVEL == UCOL_OFF !
158 if (ignore_case) {
159 collator->setStrength(icu::Collator::SECONDARY);
160 }
156 collator->setAttribute(UCOL_CASE_LEVEL, ignore_case ? UCOL_OFF : UCOL_ON, 161 collator->setAttribute(UCOL_CASE_LEVEL, ignore_case ? UCOL_OFF : UCOL_ON,
157 status); 162 status);
158 if (U_FAILURE(status)) { 163 if (U_FAILURE(status)) {
159 delete collator; 164 delete collator;
160 return ThrowExceptionForICUError("Failed to set ignoreCase."); 165 return ThrowExceptionForICUError("Failed to set ignoreCase.");
161 } 166 }
162 } 167 }
163 168
164 // Accents are taken into account with strength secondary or higher. 169 // Accents are taken into account with strength secondary or higher.
165 if (ExtractBooleanOption(options, "ignoreAccents", &ignore_accents)) { 170 if (ExtractBooleanOption(options, "ignoreAccents", &ignore_accents)) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 wrapper->SetPointerInInternalField(0, collator); 214 wrapper->SetPointerInInternalField(0, collator);
210 215
211 // Make object handle weak so we can delete iterator once GC kicks in. 216 // Make object handle weak so we can delete iterator once GC kicks in.
212 wrapper.MakeWeak(NULL, DeleteCollator); 217 wrapper.MakeWeak(NULL, DeleteCollator);
213 218
214 return wrapper; 219 return wrapper;
215 } 220 }
216 221
217 } } // namespace v8::internal 222 } } // namespace v8::internal
218 223
OLDNEW
« no previous file with comments | « src/extensions/experimental/collator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698