From 001af0ad79accea7253be680cb8485915ca5ac6a Mon Sep 17 00:00:00 2001 From: Vladimir Weinstein Date: Mon, 20 Jan 2003 07:42:28 +0000 Subject: [PATCH] ICU-2412 ucol_strcollIter - strcoll that takes UCharIterator * X-SVN-Rev: 10870 --- icu4c/source/i18n/ucol_imp.h | 8 ++++++++ icu4c/source/i18n/unicode/ucol.h | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/icu4c/source/i18n/ucol_imp.h b/icu4c/source/i18n/ucol_imp.h index 3a4e9ec0e6..97f2de9eb9 100644 --- a/icu4c/source/i18n/ucol_imp.h +++ b/icu4c/source/i18n/ucol_imp.h @@ -40,6 +40,7 @@ #include "utrie.h" #include "unicode/ures.h" #include "unicode/udata.h" +#include "unicode/uiter.h" /* UDataInfo for UCA mapping table */ static const UDataInfo ucaDataInfo={ @@ -136,6 +137,10 @@ minimum number for special Jamo /* UCOL_WAS_HIRAGANA - set to TRUE if there was a Hiragana */ /* otherwise set to false */ #define UCOL_WAS_HIRAGANA 32 + /* UCOL_USE_ITERATOR - set this if collIterate uses a */ + /* character iterator instead of simply accessing string */ + /* by index */ +#define UCOL_USE_ITERATOR 64 #define NFC_ZERO_CC_BLOCK_LIMIT_ 0x300 @@ -156,6 +161,8 @@ struct collIterate { uint8_t origFlags; uint32_t CEs[UCOL_EXPAND_CE_BUFFER_SIZE]; /* This is where we store CEs */ UChar stackWritableBuffer[UCOL_WRITABLE_BUFFER_SIZE]; /* A writable buffer. */ + UCharIterator *iterator; + /*int32_t iteratorIndex;*/ }; /* @@ -169,6 +176,7 @@ struct collIterateState { uint32_t buffersize; uint8_t flags; uint8_t origFlags; + int32_t iteratorIndex; }; U_CAPI void U_EXPORT2 diff --git a/icu4c/source/i18n/unicode/ucol.h b/icu4c/source/i18n/unicode/ucol.h index b074eddb9c..e527ae68f3 100644 --- a/icu4c/source/i18n/unicode/ucol.h +++ b/icu4c/source/i18n/unicode/ucol.h @@ -387,6 +387,25 @@ ucol_equal(const UCollator *coll, const UChar *source, int32_t sourceLength, const UChar *target, int32_t targetLength); +/** + * Compare two UTF-8 encoded trings. + * The strings will be compared using the options already specified. + * @param coll The UCollator containing the comparison rules. + * @param source The source string. + * @param sourceLength The length of source, or -1 if null-terminated. + * @param target The target string. + * @param targetLength The length of target, or -1 if null-terminated. + * @return The result of comparing the strings; one of UCOL_EQUAL, + * UCOL_GREATER, UCOL_LESS + * @see ucol_strcoll + * @draft ICU 2.6 + */ +U_CAPI UCollationResult U_EXPORT2 +ucol_strcollIter( const UCollator *coll, + UCharIterator *sIter, + UCharIterator *tIter, + UErrorCode *status); + /** * Get the collation strength used in a UCollator. * The strength influences how strings are compared.