00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef UTF8TRANSLITERATOR_H
00020 #define UTF8TRANSLITERATOR_H
00021
00022 enum scriptEnum {SE_OFF, SE_LATIN, SE_BASICLATIN, SE_BETA, SE_BGREEK, 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, SE_HAN, SE_KANJI};
00023 #define NUMSCRIPTS 32
00024 #define NUMTARGETSCRIPTS 5
00025
00026 #include <swfilter.h>
00027 #include <swmodule.h>
00028
00029
00030
00031
00032
00033
00034 #include <unicode/unistr.h>
00035 #include <unicode/translit.h>
00036
00037 #include <defs.h>
00038 #include <map>
00039
00040
00041
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