Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

caniter.h

00001 /*
00002  *******************************************************************************
00003  * Copyright (C) 1996-2003, 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 
00022 #ifndef CANITER_SKIP_ZEROES
00023 #define CANITER_SKIP_ZEROES TRUE
00024 #endif
00025 
00026 U_NAMESPACE_BEGIN
00027 
00028 class Hashtable;
00029 
00065 class U_COMMON_API CanonicalIterator : public UObject {
00066 public:
00073     CanonicalIterator(const UnicodeString &source, UErrorCode &status);    
00074 
00079     ~CanonicalIterator();
00080 
00086     UnicodeString getSource();    
00087 
00092     void reset();    
00093 
00101     UnicodeString next();    
00102 
00110     void setSource(const UnicodeString &newSource, UErrorCode &status);    
00111 
00121     static void permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status);     
00122     
00128     static UClassID getStaticClassID();
00129 
00135     virtual UClassID getDynamicClassID() const;
00136 
00137 private:
00138     // ===================== PRIVATES ==============================
00139     // private default constructor
00140     CanonicalIterator(); 
00141        
00142 
00147     CanonicalIterator(const CanonicalIterator& other);
00148 
00153     CanonicalIterator& operator=(const CanonicalIterator& other);
00154 
00155     // fields
00156     UnicodeString source;
00157     UBool done;
00158 
00159     // 2 dimensional array holds the pieces of the string with
00160     // their different canonically equivalent representations
00161     UnicodeString **pieces;
00162     int32_t pieces_length;
00163     int32_t *pieces_lengths;
00164 
00165     // current is used in iterating to combine pieces
00166     int32_t *current;
00167     int32_t current_length;
00168     
00169     // transient fields
00170     UnicodeString buffer;
00171     
00172     // we have a segment, in NFD. Find all the strings that are canonically equivalent to it.
00173     UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment)
00174     
00175     //Set getEquivalents2(String segment);
00176     Hashtable *getEquivalents2(const UChar *segment, int32_t segLen, UErrorCode &status);
00177     //Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status);
00178     
00184     //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer);
00185     Hashtable *extract(UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
00186     //Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status);
00187 
00188     void cleanPieces();
00189 
00190 };
00191 
00192 U_NAMESPACE_END
00193 
00194 #endif /* #if !UCONFIG_NO_NORMALIZATION */
00195 
00196 #endif

Generated on Tue Oct 26 18:11:08 2004 for ICU 2.8 by  doxygen 1.3.9.1