ICU 4.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
360 {
361  order &= RuleBasedCollator::PRIMARYORDERMASK;
362  return (order >> RuleBasedCollator::PRIMARYORDERSHIFT);
363 }
364 
371 {
372  order = order & RuleBasedCollator::SECONDARYORDERMASK;
373  return (order >> RuleBasedCollator::SECONDARYORDERSHIFT);
374 }
375 
382 {
383  return (order &= RuleBasedCollator::TERTIARYORDERMASK);
384 }
385 
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
static int32_t secondaryOrder(int32_t order)
Gets the secondary order of a collation order.
Definition: coleitr.h:370
The RuleBasedCollator class provides the simple implementation of Collator, using data-driven tables...
Definition: tblcoll.h:111
The CollationElementIterator class is used as an iterator to walk through each character of an intern...
Definition: coleitr.h:120
static int32_t tertiaryOrder(int32_t order)
Gets the tertiary order of a collation order.
Definition: coleitr.h:381
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...
unsigned int uint32_t
Define 64 bit limits.
Definition: pwin32.h:147
C++ API: RuleBasedCollator class provides the simple implementation of Collator.
Abstract class that defines an API for iteration on text objects.
Definition: chariter.h:356
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:475
static int32_t primaryOrder(int32_t order)
Gets the primary order of a collation order.
Definition: coleitr.h:359
struct UCollationElements UCollationElements
File coleitr.h.
Definition: coleitr.h:49
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:183
RuleBasedCollator & operator=(const RuleBasedCollator &other)
Assignment operator.
C API: UCollationElements.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:187
#define U_EXPORT2
Definition: platform.h:338
C++ API: Common ICU base class UObject.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API If the compiler doesn't support namespaces...
Definition: uversion.h:184
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:212
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
void * UClassID
UClassID is used to identify classes without using RTTI, since RTTI is not yet supported by all C++ c...
Definition: utypes.h:339
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:593
Basic definitions for ICU, for both C and C++ APIs.
friend class CollationElementIterator
Used to iterate over collation elements in a character source.
Definition: tblcoll.h:738
virtual UClassID getDynamicClassID() const =0
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
signed int int32_t
Define 64 bit limits.
Definition: pwin32.h:143
static UBool isIgnorable(int32_t order)
Checks if a comparison order is ignorable.
Definition: coleitr.h:391
int8_t UBool
The ICU boolean type.
Definition: umachine.h:208