ICU 52.1  52.1
coleitr.h
Go to the documentation of this file.
1 /*
2  ******************************************************************************
3  * Copyright (C) 1997-2013, 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 
117 public:
118 
119  // CollationElementIterator public data member ------------------------------
120 
121  enum {
126  NULLORDER = (int32_t)0xffffffff
127  };
128 
129  // CollationElementIterator public constructor/destructor -------------------
130 
138 
143  virtual ~CollationElementIterator();
144 
145  // CollationElementIterator public methods ----------------------------------
146 
154  UBool operator==(const CollationElementIterator& other) const;
155 
163  UBool operator!=(const CollationElementIterator& other) const;
164 
169  void reset(void);
170 
178  int32_t next(UErrorCode& status);
179 
187  int32_t previous(UErrorCode& status);
188 
195  static inline int32_t primaryOrder(int32_t order);
196 
203  static inline int32_t secondaryOrder(int32_t order);
204 
211  static inline int32_t tertiaryOrder(int32_t order);
212 
222  int32_t getMaxExpansion(int32_t order) const;
223 
230  int32_t strengthOrder(int32_t order) const;
231 
238  void setText(const UnicodeString& str, UErrorCode& status);
239 
246  void setText(CharacterIterator& str, UErrorCode& status);
247 
254  static inline UBool isIgnorable(int32_t order);
255 
261  int32_t getOffset(void) const;
262 
270  void setOffset(int32_t newOffset, UErrorCode& status);
271 
277  virtual UClassID getDynamicClassID() const;
278 
284  static UClassID U_EXPORT2 getStaticClassID();
285 
286 private:
287  friend class RuleBasedCollator;
288 
298  CollationElementIterator(const UnicodeString& sourceText,
299  const RuleBasedCollator* order, UErrorCode& status);
300 
311  const RuleBasedCollator* order, UErrorCode& status);
312 
319  operator=(const CollationElementIterator& other);
320 
321  CollationElementIterator(); // default constructor not implemented
322 
323  // CollationElementIterator private data members ----------------------------
324 
328  UCollationElements *m_data_;
329 
333  UBool isDataOwned_;
334 };
335 
336 // CollationElementIterator inline method defination --------------------------
337 
343 inline int32_t CollationElementIterator::primaryOrder(int32_t order)
344 {
345  order &= RuleBasedCollator::PRIMARYORDERMASK;
346  return (order >> RuleBasedCollator::PRIMARYORDERSHIFT);
347 }
348 
354 inline int32_t CollationElementIterator::secondaryOrder(int32_t order)
355 {
356  order = order & RuleBasedCollator::SECONDARYORDERMASK;
357  return (order >> RuleBasedCollator::SECONDARYORDERSHIFT);
358 }
359 
365 inline int32_t CollationElementIterator::tertiaryOrder(int32_t order)
366 {
367  return (order &= RuleBasedCollator::TERTIARYORDERMASK);
368 }
369 
370 inline int32_t CollationElementIterator::getMaxExpansion(int32_t order) const
371 {
372  return ucol_getMaxExpansion(m_data_, (uint32_t)order);
373 }
374 
375 inline UBool CollationElementIterator::isIgnorable(int32_t order)
376 {
377  return (primaryOrder(order) == RuleBasedCollator::PRIMIGNORABLE);
378 }
379 
381 
382 #endif /* #if !UCONFIG_NO_COLLATION */
383 
384 #endif