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 
392 {
393  return (primaryOrder(order) == RuleBasedCollator::PRIMIGNORABLE);
394 }
395 
397 
398 #endif /* #if !UCONFIG_NO_COLLATION */
399 
400 #endif
virtual UClassID getDynamicClassID() const =0
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
static int32_t primaryOrder(int32_t order)
Gets the primary order of a collation order.
Definition: coleitr.h:359
int32_t ucol_getMaxExpansion(const UCollationElements *elems, int32_t order)
Get the maximum length of any expansion sequences that end with the specified comparison order...
C++ API: RuleBasedCollator class provides the simple implementation of Collator.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:358
struct UCollationElements UCollationElements
File coleitr.h.
Definition: coleitr.h:49
static int32_t secondaryOrder(int32_t order)
Gets the secondary order of a collation order.
Definition: coleitr.h:370
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
The RuleBasedCollator class provides the simple implementation of Collator, using data-driven tables...
Definition: tblcoll.h:111
Abstract class that defines an API for iteration on text objects.
Definition: chariter.h:356
static int32_t tertiaryOrder(int32_t order)
Gets the tertiary order of a collation order.
Definition: coleitr.h:381
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition: stringpiece.h:218
C API: UCollationElements.
The CollationElementIterator class is used as an iterator to walk through each character of an intern...
Definition: coleitr.h:120
C++ API: Common ICU base class UObject.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:476
Basic definitions for ICU, for both C and C++ APIs.
int32_t getMaxExpansion(int32_t order) const
Return the maximum length of any expansion sequences that end with the specified comparison order...
Definition: coleitr.h:386
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:246
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:229
int8_t UBool
The ICU boolean type.
Definition: umachine.h:200
static UBool isIgnorable(int32_t order)
Checks if a comparison order is ignorable.
Definition: coleitr.h:391