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 inline UClassID getDynamicClassID() const;
00281
00287 static inline 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
00353 static const char fgClassID;
00354 };
00355
00356
00357
00358 inline UClassID
00359 CollationElementIterator::getStaticClassID()
00360 { return (UClassID)&fgClassID; }
00361
00362 inline UClassID
00363 CollationElementIterator::getDynamicClassID() const
00364 { return CollationElementIterator::getStaticClassID(); }
00365
00371 inline int32_t CollationElementIterator::primaryOrder(int32_t order)
00372 {
00373 order &= RuleBasedCollator::PRIMARYORDERMASK;
00374 return (order >> RuleBasedCollator::PRIMARYORDERSHIFT);
00375 }
00376
00382 inline int32_t CollationElementIterator::secondaryOrder(int32_t order)
00383 {
00384 order = order & RuleBasedCollator::SECONDARYORDERMASK;
00385 return (order >> RuleBasedCollator::SECONDARYORDERSHIFT);
00386 }
00387
00393 inline int32_t CollationElementIterator::tertiaryOrder(int32_t order)
00394 {
00395 return (order &= RuleBasedCollator::TERTIARYORDERMASK);
00396 }
00397
00398 inline int32_t CollationElementIterator::getMaxExpansion(int32_t order) const
00399 {
00400 return ucol_getMaxExpansion(m_data_, (uint32_t)order);
00401 }
00402
00403 inline UBool CollationElementIterator::isIgnorable(int32_t order)
00404 {
00405 return (primaryOrder(order) == RuleBasedCollator::PRIMIGNORABLE);
00406 }
00407
00408 U_NAMESPACE_END
00409
00410 #endif
00411
00412 #endif