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

Side by Side Diff: source/i18n/transreg.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/tmutfmt.cpp ('k') | source/i18n/tzfmt.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) 2001-2011, International Business Machines 3 * Copyright (c) 2001-2014, 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 * 08/10/2001 aliu Creation. 7 * 08/10/2001 aliu Creation.
8 ********************************************************************** 8 **********************************************************************
9 */ 9 */
10 10
11 #include "unicode/utypes.h" 11 #include "unicode/utypes.h"
12 12
13 #if !UCONFIG_NO_TRANSLITERATION 13 #if !UCONFIG_NO_TRANSLITERATION
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 StringEnumeration* TransliteratorRegistry::getAvailableIDs() const { 721 StringEnumeration* TransliteratorRegistry::getAvailableIDs() const {
722 return new Enumeration(*this); 722 return new Enumeration(*this);
723 } 723 }
724 724
725 int32_t TransliteratorRegistry::countAvailableSources(void) const { 725 int32_t TransliteratorRegistry::countAvailableSources(void) const {
726 return specDAG.count(); 726 return specDAG.count();
727 } 727 }
728 728
729 UnicodeString& TransliteratorRegistry::getAvailableSource(int32_t index, 729 UnicodeString& TransliteratorRegistry::getAvailableSource(int32_t index,
730 UnicodeString& result) const { 730 UnicodeString& result) const {
731 int32_t pos = -1; 731 int32_t pos = UHASH_FIRST;
732 const UHashElement *e = 0; 732 const UHashElement *e = 0;
733 while (index-- >= 0) { 733 while (index-- >= 0) {
734 e = specDAG.nextElement(pos); 734 e = specDAG.nextElement(pos);
735 if (e == 0) { 735 if (e == 0) {
736 break; 736 break;
737 } 737 }
738 } 738 }
739 if (e == 0) { 739 if (e == 0) {
740 result.truncate(0); 740 result.truncate(0);
741 } else { 741 } else {
742 result = *(UnicodeString*) e->key.pointer; 742 result = *(UnicodeString*) e->key.pointer;
743 } 743 }
744 return result; 744 return result;
745 } 745 }
746 746
747 int32_t TransliteratorRegistry::countAvailableTargets(const UnicodeString& sourc e) const { 747 int32_t TransliteratorRegistry::countAvailableTargets(const UnicodeString& sourc e) const {
748 Hashtable *targets = (Hashtable*) specDAG.get(source); 748 Hashtable *targets = (Hashtable*) specDAG.get(source);
749 return (targets == 0) ? 0 : targets->count(); 749 return (targets == 0) ? 0 : targets->count();
750 } 750 }
751 751
752 UnicodeString& TransliteratorRegistry::getAvailableTarget(int32_t index, 752 UnicodeString& TransliteratorRegistry::getAvailableTarget(int32_t index,
753 const UnicodeString& s ource, 753 const UnicodeString& s ource,
754 UnicodeString& result) const { 754 UnicodeString& result) const {
755 Hashtable *targets = (Hashtable*) specDAG.get(source); 755 Hashtable *targets = (Hashtable*) specDAG.get(source);
756 if (targets == 0) { 756 if (targets == 0) {
757 result.truncate(0); // invalid source 757 result.truncate(0); // invalid source
758 return result; 758 return result;
759 } 759 }
760 int32_t pos = -1; 760 int32_t pos = UHASH_FIRST;
761 const UHashElement *e = 0; 761 const UHashElement *e = 0;
762 while (index-- >= 0) { 762 while (index-- >= 0) {
763 e = targets->nextElement(pos); 763 e = targets->nextElement(pos);
764 if (e == 0) { 764 if (e == 0) {
765 break; 765 break;
766 } 766 }
767 } 767 }
768 if (e == 0) { 768 if (e == 0) {
769 result.truncate(0); // invalid index 769 result.truncate(0); // invalid index
770 } else { 770 } else {
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 default: 1353 default:
1354 U_ASSERT(FALSE); // can't get here 1354 U_ASSERT(FALSE); // can't get here
1355 return 0; 1355 return 0;
1356 } 1356 }
1357 } 1357 }
1358 U_NAMESPACE_END 1358 U_NAMESPACE_END
1359 1359
1360 #endif /* #if !UCONFIG_NO_TRANSLITERATION */ 1360 #endif /* #if !UCONFIG_NO_TRANSLITERATION */
1361 1361
1362 //eof 1362 //eof
OLDNEW
« no previous file with comments | « source/i18n/tmutfmt.cpp ('k') | source/i18n/tzfmt.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698