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

utf8transliterator.h

00001 /******************************************************************************
00002  *
00003  * $Id: utf8transliterator_8h-source.html,v 1.1 2003/02/28 21:22:20 mgruner Exp $
00004  *
00005  * Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
00006  *      CrossWire Bible Society
00007  *      P. O. Box 2528
00008  *      Tempe, AZ  85280-2528
00009  *
00010  * This program is free software; you can redistribute it and/or modify it
00011  * under the terms of the GNU General Public License as published by the
00012  * Free Software Foundation version 2.
00013  *
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * General Public License for more details.
00018  *
00019  */
00020 
00021 #ifndef UTF8TRANSLITERATOR_H
00022 #define UTF8TRANSLITERATOR_H
00023 
00024 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};
00025 #define NUMSCRIPTS 32
00026 #define NUMTARGETSCRIPTS 5
00027 
00028 #include <swfilter.h>
00029 #include <swmodule.h>
00030 
00031 //#include <unicode/utypes.h>
00032 //#include <unicode/ucnv.h>
00033 //#include <unicode/ustring.h>
00034 //#include <unicode/uchar.h>
00035 
00036 #include <unicode/unistr.h>
00037 
00038 //#ifdef _ICUSWORD_
00039 //#include <unicode/utrans.h>
00040 //#else
00041 #include <unicode/translit.h>
00042 //#endif
00043 
00044 #include <defs.h>
00045 #include <map>
00046 
00047 
00048 //class UnicodeString;
00049 
00050 SWORD_NAMESPACE_START
00051 
00052 struct SWTransData {
00053         UnicodeString resource;
00054         UTransDirection dir;
00055 };
00056 typedef std::map <const UnicodeString, SWTransData> SWTransMap;
00057 typedef std::pair<UnicodeString, SWTransData> SWTransPair;
00058 
00061 class SWDLLEXPORT UTF8Transliterator : public SWFilter {
00062 private:
00063 
00064         char option;
00065 
00066         static const char optionstring[NUMTARGETSCRIPTS][16];
00067 
00068         static const char optName[];
00069         static const char optTip[];
00070         static const char SW_RB_RULE_BASED_IDS[];
00071         static const char SW_RB_RULE[];
00072         static const char SW_RESDATA[];
00073         OptionsList options;
00074         static SWTransMap transMap;
00075         UErrorCode utf8status;
00076 
00077         void Load(UErrorCode &status);
00078         void registerTrans(const UnicodeString& ID, const UnicodeString& resource, UTransDirection dir, UErrorCode &status);
00079         bool checkTrans(const UnicodeString& ID, UErrorCode &status);
00080         Transliterator *createTrans(const UnicodeString& preID, const UnicodeString& ID, const UnicodeString& postID, UTransDirection dir, UErrorCode &status);
00081 
00082 public:
00083         UTF8Transliterator();
00084         virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
00085         virtual const char *getOptionName() { return optName; }
00086         virtual const char *getOptionTip() { return optTip; }
00087         virtual void setOptionValue(const char *ival);
00088         virtual const char *getOptionValue();
00089         virtual OptionsList getOptionValues() { return options; }
00090 };
00091 
00092 SWORD_NAMESPACE_END
00093 #endif

Generated on Fri Feb 28 22:01:39 2003 for The Sword Project by doxygen1.3-rc3