ICU 49.1.1
49.1.1
|
00001 /* 00002 ******************************************************************************* 00003 * Copyright (C) 1996-2011, 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 00119 #ifndef U_HIDE_INTERNAL_API 00120 00129 static void U_EXPORT2 permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status); 00130 #endif /* U_HIDE_INTERNAL_API */ 00131 00137 static UClassID U_EXPORT2 getStaticClassID(); 00138 00144 virtual UClassID getDynamicClassID() const; 00145 00146 private: 00147 // ===================== PRIVATES ============================== 00148 // private default constructor 00149 CanonicalIterator(); 00150 00151 00156 CanonicalIterator(const CanonicalIterator& other); 00157 00162 CanonicalIterator& operator=(const CanonicalIterator& other); 00163 00164 // fields 00165 UnicodeString source; 00166 UBool done; 00167 00168 // 2 dimensional array holds the pieces of the string with 00169 // their different canonically equivalent representations 00170 UnicodeString **pieces; 00171 int32_t pieces_length; 00172 int32_t *pieces_lengths; 00173 00174 // current is used in iterating to combine pieces 00175 int32_t *current; 00176 int32_t current_length; 00177 00178 // transient fields 00179 UnicodeString buffer; 00180 00181 const Normalizer2 &nfd; 00182 const Normalizer2Impl &nfcImpl; 00183 00184 // we have a segment, in NFD. Find all the strings that are canonically equivalent to it. 00185 UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment) 00186 00187 //Set getEquivalents2(String segment); 00188 Hashtable *getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status); 00189 //Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status); 00190 00196 //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer); 00197 Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); 00198 //Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); 00199 00200 void cleanPieces(); 00201 00202 }; 00203 00204 U_NAMESPACE_END 00205 00206 #endif /* #if !UCONFIG_NO_NORMALIZATION */ 00207 00208 #endif