ICU 4.4.2 4.4.2
|
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 00071 class U_COMMON_API CanonicalIterator : public UObject { 00072 public: 00079 CanonicalIterator(const UnicodeString &source, UErrorCode &status); 00080 00085 virtual ~CanonicalIterator(); 00086 00092 UnicodeString getSource(); 00093 00098 void reset(); 00099 00107 UnicodeString next(); 00108 00116 void setSource(const UnicodeString &newSource, UErrorCode &status); 00117 00127 static void U_EXPORT2 permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status); 00128 00134 static UClassID U_EXPORT2 getStaticClassID(); 00135 00141 virtual UClassID getDynamicClassID() const; 00142 00143 private: 00144 // ===================== PRIVATES ============================== 00145 // private default constructor 00146 CanonicalIterator(); 00147 00148 00153 CanonicalIterator(const CanonicalIterator& other); 00154 00159 CanonicalIterator& operator=(const CanonicalIterator& other); 00160 00161 // fields 00162 UnicodeString source; 00163 UBool done; 00164 00165 // 2 dimensional array holds the pieces of the string with 00166 // their different canonically equivalent representations 00167 UnicodeString **pieces; 00168 int32_t pieces_length; 00169 int32_t *pieces_lengths; 00170 00171 // current is used in iterating to combine pieces 00172 int32_t *current; 00173 int32_t current_length; 00174 00175 // transient fields 00176 UnicodeString buffer; 00177 00178 const Normalizer2 &nfd; 00179 00180 // we have a segment, in NFD. Find all the strings that are canonically equivalent to it. 00181 UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment) 00182 00183 //Set getEquivalents2(String segment); 00184 Hashtable *getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status); 00185 //Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status); 00186 00192 //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer); 00193 Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); 00194 //Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); 00195 00196 void cleanPieces(); 00197 00198 }; 00199 00200 U_NAMESPACE_END 00201 00202 #endif /* #if !UCONFIG_NO_NORMALIZATION */ 00203 00204 #endif