00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef CANITER_H
00011 #define CANITER_H
00012
00013 #include "unicode/utypes.h"
00014
00015 #if !UCONFIG_NO_NORMALIZATION
00016
00017 #include "unicode/uobject.h"
00018 #include "unicode/unistr.h"
00019
00029 #ifndef CANITER_SKIP_ZEROES
00030 #define CANITER_SKIP_ZEROES TRUE
00031 #endif
00032
00033 U_NAMESPACE_BEGIN
00034
00035 class Hashtable;
00036 class Normalizer2;
00037 class Normalizer2Impl;
00038
00074 class U_COMMON_API CanonicalIterator U_FINAL : public UObject {
00075 public:
00082 CanonicalIterator(const UnicodeString &source, UErrorCode &status);
00083
00088 virtual ~CanonicalIterator();
00089
00095 UnicodeString getSource();
00096
00101 void reset();
00102
00110 UnicodeString next();
00111
00119 void setSource(const UnicodeString &newSource, UErrorCode &status);
00120
00121 #ifndef U_HIDE_INTERNAL_API
00122
00131 static void U_EXPORT2 permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status);
00132 #endif
00133
00139 static UClassID U_EXPORT2 getStaticClassID();
00140
00146 virtual UClassID getDynamicClassID() const;
00147
00148 private:
00149
00150
00151 CanonicalIterator();
00152
00153
00158 CanonicalIterator(const CanonicalIterator& other);
00159
00164 CanonicalIterator& operator=(const CanonicalIterator& other);
00165
00166
00167 UnicodeString source;
00168 UBool done;
00169
00170
00171
00172 UnicodeString **pieces;
00173 int32_t pieces_length;
00174 int32_t *pieces_lengths;
00175
00176
00177 int32_t *current;
00178 int32_t current_length;
00179
00180
00181 UnicodeString buffer;
00182
00183 const Normalizer2 &nfd;
00184 const Normalizer2Impl &nfcImpl;
00185
00186
00187 UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status);
00188
00189
00190 Hashtable *getEquivalents2(Hashtable *fillinResult, const char16_t *segment, int32_t segLen, UErrorCode &status);
00191
00192
00198
00199 Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const char16_t *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
00200
00201
00202 void cleanPieces();
00203
00204 };
00205
00206 U_NAMESPACE_END
00207
00208 #endif
00209
00210 #endif