00001
00002
00003
00004
00005
00006
00007
00027
#ifndef COLEITR_H
00028
#define COLEITR_H
00029
00030
#include "unicode/utypes.h"
00031
00032
#if !UCONFIG_NO_COLLATION
00033
00034
#include "unicode/uobject.h"
00035
#include "unicode/tblcoll.h"
00036
#include "unicode/ucoleitr.h"
00037
00043
typedef struct UCollationElements UCollationElements;
00044
00045
U_NAMESPACE_BEGIN
00046
00121 class U_I18N_API CollationElementIterator :
public UObject {
00122
public:
00123
00124
00125
00130 static int32_t
const NULLORDER;
00131
00132
00133
00140 CollationElementIterator(
const CollationElementIterator& other);
00141
00146 ~CollationElementIterator();
00147
00148
00149
00157
UBool operator==(
const CollationElementIterator& other)
const;
00158
00166
UBool operator!=(
const CollationElementIterator& other)
const;
00167
00172
void reset(
void);
00173
00181 int32_t next(
UErrorCode& status);
00182
00190 int32_t previous(
UErrorCode& status);
00191
00198
static int32_t primaryOrder(int32_t order);
00199
00206
static int32_t secondaryOrder(int32_t order);
00207
00214
static int32_t tertiaryOrder(int32_t order);
00215
00225 int32_t getMaxExpansion(int32_t order)
const;
00226
00233 int32_t strengthOrder(int32_t order)
const;
00234
00241
void setText(
const UnicodeString& str,
UErrorCode& status);
00242
00249
void setText(
CharacterIterator& str,
UErrorCode& status);
00250
00257
static UBool isIgnorable(int32_t order);
00258
00264 int32_t getOffset(
void) const;
00265
00273
void setOffset(int32_t newOffset,
UErrorCode& status);
00274
00280 virtual
UClassID getDynamicClassID() const;
00281
00287 static
UClassID getStaticClassID();
00288
00289 protected:
00290
00291
00295 friend class
RuleBasedCollator;
00296
00307 CollationElementIterator(const
UnicodeString& sourceText,
00308 const RuleBasedCollator* order,
UErrorCode& status);
00309
00320 CollationElementIterator(const
CharacterIterator& sourceText,
00321 const RuleBasedCollator* order,
UErrorCode& status);
00322
00323
00324
00331 const CollationElementIterator&
00332 operator=(const CollationElementIterator& other);
00333
00334 private:
00335 CollationElementIterator();
00336
00337
00338
00342 UCollationElements *m_data_;
00343
00347
UBool isDataOwned_;
00348
00349 };
00350
00351
00352
00358 inline int32_t CollationElementIterator::primaryOrder(int32_t order)
00359 {
00360 order &= RuleBasedCollator::PRIMARYORDERMASK;
00361
return (order >> RuleBasedCollator::PRIMARYORDERSHIFT);
00362 }
00363
00369 inline int32_t
CollationElementIterator::secondaryOrder(int32_t order)
00370 {
00371 order = order & RuleBasedCollator::SECONDARYORDERMASK;
00372
return (order >> RuleBasedCollator::SECONDARYORDERSHIFT);
00373 }
00374
00380 inline int32_t
CollationElementIterator::tertiaryOrder(int32_t order)
00381 {
00382
return (order &= RuleBasedCollator::TERTIARYORDERMASK);
00383 }
00384
00385 inline int32_t
CollationElementIterator::getMaxExpansion(int32_t order)
const
00386
{
00387
return ucol_getMaxExpansion(m_data_, (uint32_t)order);
00388 }
00389
00390 inline UBool CollationElementIterator::isIgnorable(int32_t order)
00391 {
00392
return (
primaryOrder(order) == RuleBasedCollator::PRIMIGNORABLE);
00393 }
00394
00395
U_NAMESPACE_END
00396
00397
#endif
00398
00399
#endif