ICU 4.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
caniter.h
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  * Copyright (C) 1996-2006, International Business Machines Corporation and *
4  * others. All Rights Reserved. *
5  *******************************************************************************
6  */
7 
8 #ifndef CANITER_H
9 #define CANITER_H
10 
11 #include "unicode/utypes.h"
12 
13 #if !UCONFIG_NO_NORMALIZATION
14 
15 #include "unicode/uobject.h"
16 #include "unicode/unistr.h"
17 
27 #ifndef CANITER_SKIP_ZEROES
28 #define CANITER_SKIP_ZEROES TRUE
29 #endif
30 
32 
33 class Hashtable;
34 
71 public:
78  CanonicalIterator(const UnicodeString &source, UErrorCode &status);
79 
84  virtual ~CanonicalIterator();
85 
91  UnicodeString getSource();
92 
97  void reset();
98 
106  UnicodeString next();
107 
115  void setSource(const UnicodeString &newSource, UErrorCode &status);
116 
126  static void U_EXPORT2 permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status);
127 
133  static UClassID U_EXPORT2 getStaticClassID();
134 
140  virtual UClassID getDynamicClassID() const;
141 
142 private:
143  // ===================== PRIVATES ==============================
144  // private default constructor
146 
147 
152  CanonicalIterator(const CanonicalIterator& other);
153 
158  CanonicalIterator& operator=(const CanonicalIterator& other);
159 
160  // fields
161  UnicodeString source;
162  UBool done;
163 
164  // 2 dimensional array holds the pieces of the string with
165  // their different canonically equivalent representations
166  UnicodeString **pieces;
167  int32_t pieces_length;
168  int32_t *pieces_lengths;
169 
170  // current is used in iterating to combine pieces
171  int32_t *current;
172  int32_t current_length;
173 
174  // transient fields
175  UnicodeString buffer;
176 
177  // we have a segment, in NFD. Find all the strings that are canonically equivalent to it.
178  UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment)
179 
180  //Set getEquivalents2(String segment);
181  Hashtable *getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status);
182  //Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status);
183 
189  //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer);
190  Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
191  //Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
192 
193  void cleanPieces();
194 
195 };
196 
198 
199 #endif /* #if !UCONFIG_NO_NORMALIZATION */
200 
201 #endif
C++ API: Unicode String.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:183
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:319
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.
uint16_t UChar
Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
Definition: umachine.h:299
#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
This class allows one to iterate through all the strings that are canonically equivalent to a given s...
Definition: caniter.h:70
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.
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
Definition: utypes.h:474
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
int8_t UBool
The ICU boolean type.
Definition: umachine.h:208