- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- Search for |

- File List
- Globals

# coleitr.h

Go to the documentation of this file.

    00001 /*
    00002  ******************************************************************************
    00003  *   Copyright (C) 1997-2008, International Business Machines
    00004  *   Corporation and others.  All Rights Reserved.
    00005  ******************************************************************************
    00006  */
    00007
    00032 #ifndef COLEITR_H
    00033 #define COLEITR_H
    00034
    00035 #include "unicode/utypes.h"
    00036
    00037
    00038 #if !UCONFIG_NO_COLLATION
    00039
    00040 #include "unicode/uobject.h"
    00041 #include "unicode/tblcoll.h"
    00042 #include "unicode/ucoleitr.h"
    00043
    00049 typedef struct UCollationElements UCollationElements;
    00050
    00051 U_NAMESPACE_BEGIN
    00052
    00120 class U_I18N_API CollationElementIterator : public UObject {
    00121 public:
    00122
    00123     // CollationElementIterator public data member ------------------------------
    00124
    00125     enum {
    00130         NULLORDER = (int32_t)0xffffffff
    00131     };
    00132
    00133     // CollationElementIterator public constructor/destructor -------------------
    00134
    00141     CollationElementIterator(const CollationElementIterator& other);
    00142
    00147     virtual ~CollationElementIterator();
    00148
    00149     // CollationElementIterator public methods ----------------------------------
    00150
    00158     UBool operator==(const CollationElementIterator& other) const;
    00159
    00167     UBool operator!=(const CollationElementIterator& other) const;
    00168
    00173     void reset(void);
    00174
    00182     int32_t next(UErrorCode& status);
    00183
    00191     int32_t previous(UErrorCode& status);
    00192
    00199     static inline int32_t primaryOrder(int32_t order);
    00200
    00207     static inline int32_t secondaryOrder(int32_t order);
    00208
    00215     static inline int32_t tertiaryOrder(int32_t order);
    00216
    00226     int32_t getMaxExpansion(int32_t order) const;
    00227
    00234     int32_t strengthOrder(int32_t order) const;
    00235
    00242     void setText(const UnicodeString& str, UErrorCode& status);
    00243
    00250     void setText(CharacterIterator& str, UErrorCode& status);
    00251
    00258     static inline UBool isIgnorable(int32_t order);
    00259
    00265     int32_t getOffset(void) const;
    00266
    00274     void setOffset(int32_t newOffset, UErrorCode& status);
    00275
    00281     virtual UClassID getDynamicClassID() const;
    00282
    00288     static UClassID U_EXPORT2 getStaticClassID();
    00289
    00290 protected:
    00291
    00292     // CollationElementIterator protected constructors --------------------------
    00296     friend class RuleBasedCollator;
    00297
    00308     CollationElementIterator(const UnicodeString& sourceText,
    00309         const RuleBasedCollator* order, UErrorCode& status);
    00310
    00321     CollationElementIterator(const CharacterIterator& sourceText,
    00322         const RuleBasedCollator* order, UErrorCode& status);
    00323
    00324     // CollationElementIterator protected methods -------------------------------
    00325
    00332     const CollationElementIterator&
    00333         operator=(const CollationElementIterator& other);
    00334
    00335 private:
    00336     CollationElementIterator(); // default constructor not implemented
    00337
    00338     // CollationElementIterator private data members ----------------------------
    00339
    00343     UCollationElements *m_data_;
    00344
    00348     UBool isDataOwned_;
    00349
    00350 };
    00351
    00352 // CollationElementIterator inline method defination --------------------------
    00353
    00359 inline int32_t CollationElementIterator::primaryOrder(int32_t order)
    00360 {
    00361     order &= RuleBasedCollator::PRIMARYORDERMASK;
    00362     return (order >> RuleBasedCollator::PRIMARYORDERSHIFT);
    00363 }
    00364
    00370 inline int32_t CollationElementIterator::secondaryOrder(int32_t order)
    00371 {
    00372     order = order & RuleBasedCollator::SECONDARYORDERMASK;
    00373     return (order >> RuleBasedCollator::SECONDARYORDERSHIFT);
    00374 }
    00375
    00381 inline int32_t CollationElementIterator::tertiaryOrder(int32_t order)
    00382 {
    00383     return (order &= RuleBasedCollator::TERTIARYORDERMASK);
    00384 }
    00385
    00386 inline int32_t CollationElementIterator::getMaxExpansion(int32_t order) const
    00387 {
    00388     return ucol_getMaxExpansion(m_data_, (uint32_t)order);
    00389 }
    00390
    00391 inline UBool CollationElementIterator::isIgnorable(int32_t order)
    00392 {
    00393     return (primaryOrder(order) == RuleBasedCollator::PRIMIGNORABLE);
    00394 }
    00395
    00396 U_NAMESPACE_END
    00397
    00398 #endif /* #if !UCONFIG_NO_COLLATION */
    00399
    00400 #endif