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 U_SHOW_CPLUSPLUS_API
00016
00017 #if !UCONFIG_NO_NORMALIZATION
00018
00019 #include "unicode/uobject.h"
00020 #include "unicode/unistr.h"
00021
00031 #ifndef CANITER_SKIP_ZEROES
00032 #define CANITER_SKIP_ZEROES TRUE
00033 #endif
00034
00035 U_NAMESPACE_BEGIN
00036
00037 class Hashtable;
00038 class Normalizer2;
00039 class Normalizer2Impl;
00040
00076 class U_COMMON_API CanonicalIterator U_FINAL : public UObject {
00077 public:
00084 CanonicalIterator(const UnicodeString &source, UErrorCode &status);
00085
00090 virtual ~CanonicalIterator();
00091
00097 UnicodeString getSource();
00098
00103 void reset();
00104
00112 UnicodeString next();
00113
00121 void setSource(const UnicodeString &newSource, UErrorCode &status);
00122
00123 #ifndef U_HIDE_INTERNAL_API
00124
00133 static void U_EXPORT2 permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status);
00134 #endif
00135
00141 static UClassID U_EXPORT2 getStaticClassID();
00142
00148 virtual UClassID getDynamicClassID() const;
00149
00150 private:
00151
00152
00153 CanonicalIterator();
00154
00155
00160 CanonicalIterator(const CanonicalIterator& other);
00161
00166 CanonicalIterator& operator=(const CanonicalIterator& other);
00167
00168
00169 UnicodeString source;
00170 UBool done;
00171
00172
00173
00174 UnicodeString **pieces;
00175 int32_t pieces_length;
00176 int32_t *pieces_lengths;
00177
00178
00179 int32_t *current;
00180 int32_t current_length;
00181
00182
00183 UnicodeString buffer;
00184
00185 const Normalizer2 &nfd;
00186 const Normalizer2Impl &nfcImpl;
00187
00188
00189 UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status);
00190
00191
00192 Hashtable *getEquivalents2(Hashtable *fillinResult, const char16_t *segment, int32_t segLen, UErrorCode &status);
00193
00194
00200
00201 Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const char16_t *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
00202
00203
00204 void cleanPieces();
00205
00206 };
00207
00208 U_NAMESPACE_END
00209
00210 #endif
00211
00212 #endif
00213
00214 #endif