coleitr.h

Go to the documentation of this file.
00001 /*
00002  ******************************************************************************
00003  *   Copyright (C) 1997-2005, International Business Machines
00004  *   Corporation and others.  All Rights Reserved.
00005  ******************************************************************************
00006  */
00007 
00027 #ifndef COLEITR_H
00028 #define COLEITR_H
00029 
00030 #include "unicode/utypes.h"
00031 
00037 #if !UCONFIG_NO_COLLATION
00038 
00039 #include "unicode/uobject.h"
00040 #include "unicode/tblcoll.h"
00041 #include "unicode/ucoleitr.h"
00042 
00048 typedef struct UCollationElements UCollationElements;
00049 
00050 U_NAMESPACE_BEGIN
00051 
00119 class U_I18N_API CollationElementIterator : public UObject {
00120 public: 
00121 
00122     // CollationElementIterator public data member ------------------------------
00123 
00124     enum {
00129         NULLORDER = (int32_t)0xffffffff
00130     };
00131 
00132     // CollationElementIterator public constructor/destructor -------------------
00133 
00140     CollationElementIterator(const CollationElementIterator& other);
00141 
00146     virtual ~CollationElementIterator();
00147 
00148     // CollationElementIterator public methods ----------------------------------
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 inline int32_t primaryOrder(int32_t order);
00199 
00206     static inline int32_t secondaryOrder(int32_t order);
00207 
00214     static inline 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 inline 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 U_EXPORT2 getStaticClassID();
00288 
00289 protected:
00290   
00291     // CollationElementIterator protected constructors --------------------------
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     // CollationElementIterator protected methods -------------------------------
00324 
00331     const CollationElementIterator&
00332         operator=(const CollationElementIterator& other);
00333 
00334 private:
00335     CollationElementIterator(); // default constructor not implemented
00336 
00337     // CollationElementIterator private data members ----------------------------
00338 
00342     UCollationElements *m_data_;
00343 
00347     UBool isDataOwned_;
00348 
00349 };
00350 
00351 // CollationElementIterator inline method defination --------------------------
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 /* #if !UCONFIG_NO_COLLATION */
00398 
00399 #endif

Generated on Mon Aug 13 07:17:24 2007 for ICU 3.6 by  doxygen 1.5.2