| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |