Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

coleitr.h

Go to the documentation of this file.
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/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   // CollationElementIterator public data member ------------------------------
00125 
00130   static int32_t const NULLORDER;
00131 
00132   // CollationElementIterator public constructor/destructor -------------------
00133 
00140   CollationElementIterator(const CollationElementIterator& other);
00141 
00146   ~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 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 { return getStaticClassID(); }
00281 
00287   static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
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 
00336   // CollationElementIterator private data members ----------------------------
00337 
00341   UCollationElements *m_data_;
00342 
00346   UBool isDataOwned_;
00347 
00352   static const char fgClassID;
00353 };
00354 
00355 // CollationElementIterator inline method defination --------------------------
00356 
00362 inline int32_t CollationElementIterator::primaryOrder(int32_t order)
00363 {
00364   order &= RuleBasedCollator::PRIMARYORDERMASK;
00365   return (order >> RuleBasedCollator::PRIMARYORDERSHIFT);
00366 }
00367 
00373 inline int32_t CollationElementIterator::secondaryOrder(int32_t order)
00374 {
00375   order = order & RuleBasedCollator::SECONDARYORDERMASK;
00376   return (order >> RuleBasedCollator::SECONDARYORDERSHIFT);
00377 }
00378 
00384 inline int32_t CollationElementIterator::tertiaryOrder(int32_t order)
00385 {
00386   return (order &= RuleBasedCollator::TERTIARYORDERMASK);
00387 }
00388 
00389 inline int32_t CollationElementIterator::getMaxExpansion(int32_t order) const
00390 {
00391   return ucol_getMaxExpansion(m_data_, (uint32_t)order);
00392 }
00393 
00394 inline UBool CollationElementIterator::isIgnorable(int32_t order)
00395 {
00396   return (primaryOrder(order) == RuleBasedCollator::PRIMIGNORABLE);
00397 }
00398 
00399 U_NAMESPACE_END
00400 
00401 #endif /* #if !UCONFIG_NO_COLLATION */
00402 
00403 #endif

Generated on Wed Dec 18 16:49:30 2002 for ICU 2.4 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001