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

Side by Side Diff: source/i18n/collationruleparser.cpp

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 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
« no previous file with comments | « source/i18n/collationrootelements.cpp ('k') | source/i18n/collationsettings.h » ('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) 2013-2014, International Business Machines 3 * Copyright (C) 2013-2015, International Business Machines
4 * Corporation and others. All Rights Reserved. 4 * Corporation and others. All Rights Reserved.
5 ******************************************************************************* 5 *******************************************************************************
6 * collationruleparser.cpp 6 * collationruleparser.cpp
7 * 7 *
8 * (replaced the former ucol_tok.cpp) 8 * (replaced the former ucol_tok.cpp)
9 * 9 *
10 * created on: 2013apr10 10 * created on: 2013apr10
11 * created by: Markus W. Scherer 11 * created by: Markus W. Scherer
12 */ 12 */
13 13
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 if(U_FAILURE(errorCode)) { return; } 699 if(U_FAILURE(errorCode)) { return; }
700 int32_t code = getReorderCode(word.data()); 700 int32_t code = getReorderCode(word.data());
701 if(code < 0) { 701 if(code < 0) {
702 setParseError("unknown script or reorder code", errorCode); 702 setParseError("unknown script or reorder code", errorCode);
703 return; 703 return;
704 } 704 }
705 reorderCodes.addElement(code, errorCode); 705 reorderCodes.addElement(code, errorCode);
706 if(U_FAILURE(errorCode)) { return; } 706 if(U_FAILURE(errorCode)) { return; }
707 i = limit; 707 i = limit;
708 } 708 }
709 int32_t length = reorderCodes.size(); 709 settings->setReordering(*baseData, reorderCodes.getBuffer(), reorderCodes.si ze(), errorCode);
710 if(length == 1 && reorderCodes.elementAti(0) == UCOL_REORDER_CODE_NONE) {
711 settings->resetReordering();
712 return;
713 }
714 uint8_t table[256];
715 baseData->makeReorderTable(reorderCodes.getBuffer(), length, table, errorCod e);
716 if(U_FAILURE(errorCode)) { return; }
717 if(!settings->setReordering(reorderCodes.getBuffer(), length, table)) {
718 errorCode = U_MEMORY_ALLOCATION_ERROR;
719 }
720 } 710 }
721 711
722 static const char *const gSpecialReorderCodes[] = { 712 static const char *const gSpecialReorderCodes[] = {
723 "space", "punct", "symbol", "currency", "digit" 713 "space", "punct", "symbol", "currency", "digit"
724 }; 714 };
725 715
726 int32_t 716 int32_t
727 CollationRuleParser::getReorderCode(const char *word) { 717 CollationRuleParser::getReorderCode(const char *word) {
728 for(int32_t i = 0; i < UPRV_LENGTHOF(gSpecialReorderCodes); ++i) { 718 for(int32_t i = 0; i < UPRV_LENGTHOF(gSpecialReorderCodes); ++i) {
729 if(uprv_stricmp(word, gSpecialReorderCodes[i]) == 0) { 719 if(uprv_stricmp(word, gSpecialReorderCodes[i]) == 0) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 CollationRuleParser::skipWhiteSpace(int32_t i) const { 867 CollationRuleParser::skipWhiteSpace(int32_t i) const {
878 while(i < rules->length() && PatternProps::isWhiteSpace(rules->charAt(i))) { 868 while(i < rules->length() && PatternProps::isWhiteSpace(rules->charAt(i))) {
879 ++i; 869 ++i;
880 } 870 }
881 return i; 871 return i;
882 } 872 }
883 873
884 U_NAMESPACE_END 874 U_NAMESPACE_END
885 875
886 #endif // !UCONFIG_NO_COLLATION 876 #endif // !UCONFIG_NO_COLLATION
OLDNEW
« no previous file with comments | « source/i18n/collationrootelements.cpp ('k') | source/i18n/collationsettings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698