Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

coleitr.h

00001 /*
00002 ******************************************************************************
00003 *   Copyright (C) 1997-2001, 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/tblcoll.h"
00031 #include "unicode/ucoleitr.h"
00032 
00033 typedef struct UCollationElements UCollationElements;
00034 
00035 U_NAMESPACE_BEGIN
00036 
00111 class U_I18N_API CollationElementIterator
00112 {
00113 public: 
00114 
00115   // CollationElementIterator public data member ------------------------------
00116 
00120   static int32_t const NULLORDER;
00121 
00122   // CollationElementIterator public constructor/destructor -------------------
00123 
00128   CollationElementIterator(const CollationElementIterator& other);
00129 
00134   ~CollationElementIterator();
00135   
00136   // CollationElementIterator public methods ----------------------------------
00137 
00142   UBool operator==(const CollationElementIterator& other) const;
00143 
00148   UBool operator!=(const CollationElementIterator& other) const;
00149 
00154   void reset(void);
00155     
00163   int32_t next(UErrorCode& status);
00164 
00172   int32_t previous(UErrorCode& status);
00173 
00180   static int32_t primaryOrder(int32_t order);
00181 
00188   static int32_t secondaryOrder(int32_t order);
00189 
00196   static int32_t tertiaryOrder(int32_t order);
00197 
00207   int32_t getMaxExpansion(int32_t order) const;
00208 
00215   int32_t strengthOrder(int32_t order) const;
00216 
00223   void setText(const UnicodeString& str, UErrorCode& status);
00224 
00231   void setText(CharacterIterator& str, UErrorCode& status);
00232 
00239   static UBool isIgnorable(int32_t order);
00240 
00246   int32_t getOffset(void) const;
00247 
00255   void setOffset(int32_t newOffset, UErrorCode& status);
00256 
00257 protected:
00258   
00259   // CollationElementIterator protected constructors --------------------------
00260 
00261   friend class RuleBasedCollator;
00262 
00275   CollationElementIterator(const UnicodeString& sourceText,
00276                            const RuleBasedCollator* order, UErrorCode& status);
00277 
00290   CollationElementIterator(const CharacterIterator& sourceText,
00291                            const RuleBasedCollator* order, UErrorCode& status);
00292   
00293   // CollationElementIterator protected methods -------------------------------
00294 
00298   const CollationElementIterator&
00299                               operator=(const CollationElementIterator& other);
00300 
00301 private:
00302 
00303   // CollationElementIterator private data members ----------------------------
00304 
00308   UCollationElements *m_data_;
00309 
00313   UBool isDataOwned_;
00314 };
00315 
00316 // CollationElementIterator inline method defination --------------------------
00317 
00323 inline int32_t CollationElementIterator::primaryOrder(int32_t order)
00324 {
00325   order &= RuleBasedCollator::PRIMARYORDERMASK;
00326   return (order >> RuleBasedCollator::PRIMARYORDERSHIFT);
00327 }
00328 
00334 inline int32_t CollationElementIterator::secondaryOrder(int32_t order)
00335 {
00336   order = order & RuleBasedCollator::SECONDARYORDERMASK;
00337   return (order >> RuleBasedCollator::SECONDARYORDERSHIFT);
00338 }
00339 
00345 inline int32_t CollationElementIterator::tertiaryOrder(int32_t order)
00346 {
00347   return (order &= RuleBasedCollator::TERTIARYORDERMASK);
00348 }
00349 
00350 inline int32_t CollationElementIterator::getMaxExpansion(int32_t order) const
00351 {
00352   return ucol_getMaxExpansion(m_data_, (uint32_t)order);
00353 }
00354 
00355 inline UBool CollationElementIterator::isIgnorable(int32_t order)
00356 {
00357   return (primaryOrder(order) == RuleBasedCollator::PRIMIGNORABLE);
00358 }
00359 
00360 U_NAMESPACE_END
00361 
00362 #endif

Generated on Sun May 22 18:49:33 2005 for ICU 2.1 by  doxygen 1.4.2