00001
00002
00003
00004
00005
00006
00007
00008 #ifndef CANITER_H
00009 #define CANITER_H
00010
00011 #include "unicode/utypes.h"
00012
00013 #if !UCONFIG_NO_NORMALIZATION
00014
00015 #include "unicode/uobject.h"
00016 #include "unicode/unistr.h"
00017
00027 #ifndef CANITER_SKIP_ZEROES
00028 #define CANITER_SKIP_ZEROES TRUE
00029 #endif
00030
00031 U_NAMESPACE_BEGIN
00032
00033 class Hashtable;
00034 class Normalizer2;
00035 class Normalizer2Impl;
00036
00072 class U_COMMON_API CanonicalIterator : public UObject {
00073 public:
00080 CanonicalIterator(const UnicodeString &source, UErrorCode &status);
00081
00086 virtual ~CanonicalIterator();
00087
00093 UnicodeString getSource();
00094
00099 void reset();
00100
00108 UnicodeString next();
00109
00117 void setSource(const UnicodeString &newSource, UErrorCode &status);
00118
00119 #ifndef U_HIDE_INTERNAL_API
00120
00129 static void U_EXPORT2 permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status);
00130 #endif
00131
00137 static UClassID U_EXPORT2 getStaticClassID();
00138
00144 virtual UClassID getDynamicClassID() const;
00145
00146 private:
00147
00148
00149 CanonicalIterator();
00150
00151
00156 CanonicalIterator(const CanonicalIterator& other);
00157
00162 CanonicalIterator& operator=(const CanonicalIterator& other);
00163
00164
00165 UnicodeString source;
00166 UBool done;
00167
00168
00169
00170 UnicodeString **pieces;
00171 int32_t pieces_length;
00172 int32_t *pieces_lengths;
00173
00174
00175 int32_t *current;
00176 int32_t current_length;
00177
00178
00179 UnicodeString buffer;
00180
00181 const Normalizer2 &nfd;
00182 const Normalizer2Impl &nfcImpl;
00183
00184
00185 UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status);
00186
00187
00188 Hashtable *getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status);
00189
00190
00196
00197 Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
00198
00199
00200 void cleanPieces();
00201
00202 };
00203
00204 U_NAMESPACE_END
00205
00206 #endif
00207
00208 #endif