Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

caniter.h

00001 /*
00002  *******************************************************************************
00003  * Copyright (C) 1996-2000, International Business Machines Corporation and    *
00004  * others. All Rights Reserved.                                                *
00005  *******************************************************************************
00006  *
00007  * $Source: /usr/cvs/icu/icu/source/i18n/unicode/caniter.h,v $ 
00008  * $Date: 2002/02/27 21:47:05 $ 
00009  * $Revision: 1.2 $
00010  *
00011  *****************************************************************************************
00012  */
00013 
00014 #ifndef CANITER_H
00015 #define CANITER_H
00016 
00017 #include "unicode/unistr.h"
00018 #include "unicode/uniset.h"
00019 #include "unicode/normlzr.h"
00020 #include "unicode/unicode.h"
00021 
00055 U_NAMESPACE_BEGIN
00056 
00057 class Hashtable;
00058 
00059 class U_I18N_API CanonicalIterator {
00060 public:
00064     CanonicalIterator(UnicodeString source, UErrorCode status);    
00065 
00069     ~CanonicalIterator();
00070 
00074     UnicodeString getSource();    
00075 
00079     void reset();    
00080 
00085     UnicodeString next();    
00086 
00091     void setSource(UnicodeString newSource, UErrorCode status);    
00092 
00099     static Hashtable *permute(UnicodeString &source, UErrorCode status);     
00100     
00101 private:
00102     // ===================== PRIVATES ==============================
00103     
00104     // fields
00105     UnicodeString source;
00106     UBool done;
00107 
00108     // 2 dimensional array holds the pieces of the string with
00109     // their different canonically equivalent representations
00110     UnicodeString **pieces;
00111     int32_t pieces_length;
00112     int32_t *pieces_lengths;
00113 
00114     // current is used in iterating to combine pieces
00115     int32_t *current;
00116     int32_t current_length;
00117     
00118     // transient fields
00119     UnicodeString buffer; // = new UnicodeString();    
00120     
00121     // we have a segment, in NFD. Find all the strings that are canonically equivalent to it.
00122     UnicodeString *getEquivalents(UnicodeString segment, int32_t &result_len, UErrorCode status); //private String[] getEquivalents(String segment)
00123     
00124     //Set getEquivalents2(String segment);
00125     Hashtable *getEquivalents2(UnicodeString segment, UErrorCode status);
00126     
00132     //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer);
00133     const Hashtable *extract(UChar32 comp, UnicodeString segment, int32_t segmentPos, UnicodeString buffer, UErrorCode status);
00134     
00135   
00136    // ================= BUILDER =========================
00137    // TODO: Flatten this data so it doesn't have to be reconstructed each time!
00138   
00139     static void initStaticData(UErrorCode status);
00140 
00141     void cleanPieces();
00142 
00143 public:
00144     // FOR TESTING   
00148     static UnicodeSet *getSafeStart(UErrorCode status);    
00152     static UnicodeSet *getStarts(UChar32 cp, UErrorCode status);     
00153 };
00154 U_NAMESPACE_END
00155 #endif
00156 
00157     

Generated on Mon Mar 4 21:43:53 2002 for ICU 2.0 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002