caniter.h

Go to the documentation of this file.
00001 /*
00002  *******************************************************************************
00003  * Copyright (C) 1996-2006, 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 
00070 class U_COMMON_API CanonicalIterator : public UObject {
00071 public:
00078     CanonicalIterator(const UnicodeString &source, UErrorCode &status);
00079 
00084     virtual ~CanonicalIterator();
00085 
00091     UnicodeString getSource();
00092 
00097     void reset();
00098 
00106     UnicodeString next();
00107 
00115     void setSource(const UnicodeString &newSource, UErrorCode &status);
00116 
00126     static void U_EXPORT2 permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status);
00127 
00133     static UClassID U_EXPORT2 getStaticClassID();
00134 
00140     virtual UClassID getDynamicClassID() const;
00141 
00142 private:
00143     // ===================== PRIVATES ==============================
00144     // private default constructor
00145     CanonicalIterator();
00146 
00147 
00152     CanonicalIterator(const CanonicalIterator& other);
00153 
00158     CanonicalIterator& operator=(const CanonicalIterator& other);
00159 
00160     // fields
00161     UnicodeString source;
00162     UBool done;
00163 
00164     // 2 dimensional array holds the pieces of the string with
00165     // their different canonically equivalent representations
00166     UnicodeString **pieces;
00167     int32_t pieces_length;
00168     int32_t *pieces_lengths;
00169 
00170     // current is used in iterating to combine pieces
00171     int32_t *current;
00172     int32_t current_length;
00173 
00174     // transient fields
00175     UnicodeString buffer;
00176 
00177     // we have a segment, in NFD. Find all the strings that are canonically equivalent to it.
00178     UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment)
00179 
00180     //Set getEquivalents2(String segment);
00181     Hashtable *getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status);
00182     //Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status);
00183 
00189     //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer);
00190     Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
00191     //Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
00192 
00193     void cleanPieces();
00194 
00195 };
00196 
00197 U_NAMESPACE_END
00198 
00199 #endif /* #if !UCONFIG_NO_NORMALIZATION */
00200 
00201 #endif

Generated on Mon Aug 13 07:17:23 2007 for ICU 3.6 by  doxygen 1.5.2