Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

utf8transliterator.h

00001 /*
00002  *
00003  * Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
00004  *      CrossWire Bible Society
00005  *      P. O. Box 2528
00006  *      Tempe, AZ  85280-2528
00007  *
00008  * This program is free software; you can redistribute it and/or modify it
00009  * under the terms of the GNU General Public License as published by the
00010  * Free Software Foundation version 2.
00011  *
00012  * This program is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * General Public License for more details.
00016  *
00017  */
00018 
00019 #ifndef UTF8TRANSLITERATOR_H
00020 #define UTF8TRANSLITERATOR_H
00021 
00022 enum scriptEnum {SE_OFF, SE_LATIN, /*one-way (to) transliterators*/ SE_BASICLATIN, SE_BETA, SE_BGREEK, /*two-way transliterators*/ SE_GREEK, SE_HEBREW, SE_CYRILLIC, SE_ARABIC, SE_SYRIAC, SE_KATAKANA, SE_HIRAGANA, SE_JAMO, SE_HANGUL, SE_DEVANAGARI, SE_TAMIL, SE_BENGALI, SE_GURMUKHI, SE_GUJARATI, SE_ORIYA, SE_TELUGU, SE_KANNADA, SE_MALAYALAM, SE_THAI, SE_GEORGIAN, SE_ARMENIAN, SE_ETHIOPIC, SE_GOTHIC, SE_UGARITIC, SE_COPTIC, /*one-way (from) transliterators*/ SE_HAN, SE_KANJI};
00023 #define NUMSCRIPTS 32
00024 #define NUMTARGETSCRIPTS 5
00025 
00026 #include <swfilter.h>
00027 #include <swmodule.h>
00028 
00029 //#include <unicode/utypes.h>
00030 //#include <unicode/ucnv.h>
00031 //#include <unicode/ustring.h>
00032 //#include <unicode/uchar.h>
00033 
00034 #include <unicode/unistr.h>
00035 #include <unicode/translit.h>
00036 
00037 #include <defs.h>
00038 #include <map>
00039 
00040 
00041 //class UnicodeString;
00042 
00043 SWORD_NAMESPACE_START
00044 
00045 struct SWTransData {
00046         UnicodeString resource;
00047         UTransDirection dir;
00048 };
00049 typedef std::map <const UnicodeString, SWTransData> SWTransMap;
00050 typedef std::pair<UnicodeString, SWTransData> SWTransPair;
00051 
00054 class SWDLLEXPORT UTF8Transliterator : public SWFilter
00055 {
00056 private:
00057 
00058   char option;
00059 
00060   static const char optionstring[NUMTARGETSCRIPTS][16];
00061 
00062   static const char optName[];
00063   static const char optTip[];
00064   static const char SW_RB_RULE_BASED_IDS[];
00065   static const char SW_RB_RULE[];
00066   static const char SW_RESDATA[];
00067   OptionsList options;
00068   static SWTransMap transMap;
00069   UErrorCode utf8status;
00070   
00071   void Load(UErrorCode &status);
00072   void  registerTrans(const UnicodeString& ID, const UnicodeString& resource,
00073                 UTransDirection dir, UErrorCode &status );
00074   bool checkTrans(const UnicodeString& ID, UErrorCode &status );
00075   Transliterator * createTrans(const UnicodeString& preID, const UnicodeString& ID, 
00076         const UnicodeString& postID, UTransDirection dir, UErrorCode &status );
00077   
00078  public:
00079   UTF8Transliterator ();
00080   virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
00081   virtual const char *getOptionName ()
00082     {
00083       return optName;
00084     }
00085   virtual const char *getOptionTip ()
00086     {
00087       return optTip;
00088     }
00089   virtual void setOptionValue (const char *ival);
00090   virtual const char *getOptionValue ();
00091   virtual OptionsList getOptionValues ()
00092     {
00093       return options;
00094     }
00095 };
00096 
00097 SWORD_NAMESPACE_END
00098 #endif

Generated on Thu Oct 31 12:11:28 2002 for The Sword Project by doxygen1.2.17