ICU 50.1.2  50.1.2
coleitr.h
Go to the documentation of this file.
1 /*
2  ******************************************************************************
3  * Copyright (C) 1997-2008, International Business Machines
4  * Corporation and others. All Rights Reserved.
5  ******************************************************************************
6  */
7 
32 #ifndef COLEITR_H
33 #define COLEITR_H
34 
35 #include "unicode/utypes.h"
36 
37 
38 #if !UCONFIG_NO_COLLATION
39 
40 #include "unicode/uobject.h"
41 #include "unicode/tblcoll.h"
42 #include "unicode/ucoleitr.h"
43 
50 
52 
121 public:
122 
123  // CollationElementIterator public data member ------------------------------
124 
125  enum {
130  NULLORDER = (int32_t)0xffffffff
131  };
132 
133  // CollationElementIterator public constructor/destructor -------------------
134 
142 
147  virtual ~CollationElementIterator();
148 
149  // CollationElementIterator public methods ----------------------------------
150 
158  UBool operator==(const CollationElementIterator& other) const;
159 
167  UBool operator!=(const CollationElementIterator& other) const;
168 
173  void reset(void);
174 
182  int32_t next(UErrorCode& status);
183 
191  int32_t previous(UErrorCode& status);
192 
199  static inline int32_t primaryOrder(int32_t order);
200 
207  static inline int32_t secondaryOrder(int32_t order);
208 
215  static inline int32_t tertiaryOrder(int32_t order);
216 
226  int32_t getMaxExpansion(int32_t order) const;
227 
234  int32_t strengthOrder(int32_t order) const;
235 
242  void setText(const UnicodeString& str, UErrorCode& status);
243 
250  void setText(CharacterIterator& str, UErrorCode& status);
251 
258  static inline UBool isIgnorable(int32_t order);
259 
265  int32_t getOffset(void) const;
266 
274  void setOffset(int32_t newOffset, UErrorCode& status);
275 
281  virtual UClassID getDynamicClassID() const;
282 
288  static UClassID U_EXPORT2 getStaticClassID();
289 
290 protected:
291 
292  // CollationElementIterator protected constructors --------------------------
296  friend class RuleBasedCollator;
297 
308  CollationElementIterator(const UnicodeString& sourceText,
309  const RuleBasedCollator* order, UErrorCode& status);
310 
322  const RuleBasedCollator* order, UErrorCode& status);
323 
324  // CollationElementIterator protected methods -------------------------------
325 
333  operator=(const CollationElementIterator& other);
334 
335 private:
336  CollationElementIterator(); // default constructor not implemented
337 
338  // CollationElementIterator private data members ----------------------------
339 
343  UCollationElements *m_data_;
344 
348  UBool isDataOwned_;
349 
350 };
351 
352 // CollationElementIterator inline method defination --------------------------
353 
359 inline int32_t CollationElementIterator::primaryOrder(int32_t order)
360 {
361  order &= RuleBasedCollator::PRIMARYORDERMASK;
362  return (order >> RuleBasedCollator::PRIMARYORDERSHIFT);
363 }
364 
370 inline int32_t CollationElementIterator::secondaryOrder(int32_t order)
371 {
372  order = order & RuleBasedCollator::SECONDARYORDERMASK;
373  return (order >> RuleBasedCollator::SECONDARYORDERSHIFT);
374 }
375 
381 inline int32_t CollationElementIterator::tertiaryOrder(int32_t order)
382 {
383  return (order &= RuleBasedCollator::TERTIARYORDERMASK);
384 }
385 
386 inline int32_t CollationElementIterator::getMaxExpansion(int32_t order) const
387 {
388  return ucol_getMaxExpansion(m_data_, (uint32_t)order);
389 }
390 
391 inline UBool CollationElementIterator::isIgnorable(int32_t order)
392 {
393  return (primaryOrder(order) == RuleBasedCollator::PRIMIGNORABLE);
394 }
395 
397 
398 #endif /* #if !UCONFIG_NO_COLLATION */
399 
400 #endif