ICU-1006 add case insensitive keys option to ct
X-SVN-Rev: 5038
This commit is contained in:
parent
355858163a
commit
f014c842dd
@ -25,13 +25,14 @@ class Hashtable {
|
|||||||
UHashtable* hash;
|
UHashtable* hash;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Hashtable(UErrorCode& status);
|
Hashtable(UBool ignoreKeyCase, UErrorCode& status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a hashtable, _disregarding any error_. Use this constructor
|
* Construct a hashtable, _disregarding any error_. Use this constructor
|
||||||
* with caution.
|
* with caution.
|
||||||
|
* @param ignoreKeyCase if TRUE, keys are case insensitive
|
||||||
*/
|
*/
|
||||||
Hashtable();
|
Hashtable(UBool ignoreKeyCase = FALSE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Non-virtual destructor; make this virtual if Hashtable is subclassed
|
* Non-virtual destructor; make this virtual if Hashtable is subclassed
|
||||||
@ -56,21 +57,28 @@ public:
|
|||||||
* Implementation
|
* Implementation
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
inline Hashtable::Hashtable(UErrorCode& status) : hash(0) {
|
inline Hashtable::Hashtable(UBool ignoreKeyCase, UErrorCode& status) :
|
||||||
|
hash(0) {
|
||||||
if (U_FAILURE(status)) {
|
if (U_FAILURE(status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hash = uhash_open(uhash_hashUnicodeString,
|
hash = uhash_open(ignoreKeyCase ? uhash_hashCaselessUnicodeString
|
||||||
uhash_compareUnicodeString, &status);
|
: uhash_hashUnicodeString,
|
||||||
|
ignoreKeyCase ? uhash_compareCaselessUnicodeString
|
||||||
|
: uhash_compareUnicodeString,
|
||||||
|
&status);
|
||||||
if (U_SUCCESS(status)) {
|
if (U_SUCCESS(status)) {
|
||||||
uhash_setKeyDeleter(hash, uhash_deleteUnicodeString);
|
uhash_setKeyDeleter(hash, uhash_deleteUnicodeString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Hashtable::Hashtable() : hash(0) {
|
inline Hashtable::Hashtable(UBool ignoreKeyCase) : hash(0) {
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
hash = uhash_open(uhash_hashUnicodeString,
|
hash = uhash_open(ignoreKeyCase ? uhash_hashCaselessUnicodeString
|
||||||
uhash_compareUnicodeString, &status);
|
: uhash_hashUnicodeString,
|
||||||
|
ignoreKeyCase ? uhash_compareCaselessUnicodeString
|
||||||
|
: uhash_compareUnicodeString,
|
||||||
|
&status);
|
||||||
if (U_SUCCESS(status)) {
|
if (U_SUCCESS(status)) {
|
||||||
uhash_setKeyDeleter(hash, uhash_deleteUnicodeString);
|
uhash_setKeyDeleter(hash, uhash_deleteUnicodeString);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user