ICU 4.8.1.1
4.8.1.1
|
00001 /* 00002 ******************************************************************************* 00003 * Copyright (C) 1996-2010, International Business Machines Corporation and * 00004 * others. All Rights Reserved. * 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 00128 static void U_EXPORT2 permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status); 00129 00135 static UClassID U_EXPORT2 getStaticClassID(); 00136 00142 virtual UClassID getDynamicClassID() const; 00143 00144 private: 00145 // ===================== PRIVATES ============================== 00146 // private default constructor 00147 CanonicalIterator(); 00148 00149 00154 CanonicalIterator(const CanonicalIterator& other); 00155 00160 CanonicalIterator& operator=(const CanonicalIterator& other); 00161 00162 // fields 00163 UnicodeString source; 00164 UBool done; 00165 00166 // 2 dimensional array holds the pieces of the string with 00167 // their different canonically equivalent representations 00168 UnicodeString **pieces; 00169 int32_t pieces_length; 00170 int32_t *pieces_lengths; 00171 00172 // current is used in iterating to combine pieces 00173 int32_t *current; 00174 int32_t current_length; 00175 00176 // transient fields 00177 UnicodeString buffer; 00178 00179 const Normalizer2 &nfd; 00180 const Normalizer2Impl &nfcImpl; 00181 00182 // we have a segment, in NFD. Find all the strings that are canonically equivalent to it. 00183 UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment) 00184 00185 //Set getEquivalents2(String segment); 00186 Hashtable *getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status); 00187 //Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status); 00188 00194 //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer); 00195 Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); 00196 //Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); 00197 00198 void cleanPieces(); 00199 00200 }; 00201 00202 U_NAMESPACE_END 00203 00204 #endif /* #if !UCONFIG_NO_NORMALIZATION */ 00205 00206 #endif