mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-4281 Condense break iterator usage.
X-SVN-Rev: 16920
This commit is contained in:
parent
de39e80b8c
commit
d0d233155d
2 changed files with 32 additions and 28 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
* Copyright (C) 1997-2001, International Business Machines
|
||||
* Copyright (C) 1997-2004, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
******************************************************************************
|
||||
* Date Name Description
|
||||
|
@ -27,19 +27,6 @@ uhash_hashUnicodeString(const UHashTok key) {
|
|||
return (str == NULL) ? 0 : str->hashCode();
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
uhash_hashCaselessUnicodeString(const UHashTok key) {
|
||||
U_NAMESPACE_USE
|
||||
const UnicodeString *str = (const UnicodeString*) key.pointer;
|
||||
if (str == NULL) {
|
||||
return 0;
|
||||
}
|
||||
// Inefficient; a better way would be to have a hash function in
|
||||
// UnicodeString that does case folding on the fly.
|
||||
UnicodeString copy(*str);
|
||||
return copy.foldCase().hashCode();
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
uhash_deleteUnicodeString(void *obj) {
|
||||
U_NAMESPACE_USE
|
||||
|
@ -60,20 +47,6 @@ uhash_compareUnicodeString(const UHashTok key1, const UHashTok key2) {
|
|||
return *str1 == *str2;
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
uhash_compareCaselessUnicodeString(const UHashTok key1, const UHashTok key2) {
|
||||
U_NAMESPACE_USE
|
||||
const UnicodeString *str1 = (const UnicodeString*) key1.pointer;
|
||||
const UnicodeString *str2 = (const UnicodeString*) key2.pointer;
|
||||
if (str1 == str2) {
|
||||
return TRUE;
|
||||
}
|
||||
if (str1 == NULL || str2 == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
return str1->caseCompare(*str2, U_FOLD_CASE_DEFAULT) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deleter for Hashtable objects.
|
||||
*/
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "unicode/ubrk.h"
|
||||
#include "ustr_imp.h"
|
||||
#include "unormimp.h"
|
||||
#include "uhash.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
|
@ -242,3 +243,33 @@ UnicodeString::foldCase(uint32_t options) {
|
|||
}
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
// Defined here to reduce dependencies on break iterator
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
uhash_hashCaselessUnicodeString(const UHashTok key) {
|
||||
U_NAMESPACE_USE
|
||||
const UnicodeString *str = (const UnicodeString*) key.pointer;
|
||||
if (str == NULL) {
|
||||
return 0;
|
||||
}
|
||||
// Inefficient; a better way would be to have a hash function in
|
||||
// UnicodeString that does case folding on the fly.
|
||||
UnicodeString copy(*str);
|
||||
return copy.foldCase().hashCode();
|
||||
}
|
||||
|
||||
// Defined here to reduce dependencies on break iterator
|
||||
U_CAPI UBool U_EXPORT2
|
||||
uhash_compareCaselessUnicodeString(const UHashTok key1, const UHashTok key2) {
|
||||
U_NAMESPACE_USE
|
||||
const UnicodeString *str1 = (const UnicodeString*) key1.pointer;
|
||||
const UnicodeString *str2 = (const UnicodeString*) key2.pointer;
|
||||
if (str1 == str2) {
|
||||
return TRUE;
|
||||
}
|
||||
if (str1 == NULL || str2 == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
return str1->caseCompare(*str2, U_FOLD_CASE_DEFAULT) == 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue