merged tag ooo/OOO330_m14
[LibreOffice.git] / i18npool / inc / transliteration_OneToOne.hxx
blobdbe37a1ebe05ebcf0b560941b5d39c1871236074
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
28 #define _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
30 #include <transliteration_commonclass.hxx>
31 #include <i18nutil/oneToOneMapping.hxx>
33 namespace com { namespace sun { namespace star { namespace i18n {
35 typedef sal_Unicode (*TransFunc)(const sal_Unicode);
37 class transliteration_OneToOne : public transliteration_commonclass
39 public:
40 rtl::OUString SAL_CALL
41 transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset )
42 throw(com::sun::star::uno::RuntimeException);
44 sal_Unicode SAL_CALL
45 transliterateChar2Char( sal_Unicode inChar)
46 throw(com::sun::star::uno::RuntimeException,
47 com::sun::star::i18n::MultipleCharsOutputException);
49 // Methods which are shared.
50 sal_Int16 SAL_CALL getType() throw(com::sun::star::uno::RuntimeException);
52 rtl::OUString SAL_CALL
53 folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset)
54 throw(com::sun::star::uno::RuntimeException);
56 sal_Bool SAL_CALL
57 equals( const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1,
58 const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 )
59 throw(com::sun::star::uno::RuntimeException);
61 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
62 transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2 )
63 throw(com::sun::star::uno::RuntimeException);
65 protected:
66 TransFunc func;
67 oneToOneMapping *table;
70 #define TRANSLITERATION_ONETOONE( name ) \
71 class name : public transliteration_OneToOne \
72 { \
73 public: \
74 name (); \
75 rtl::OUString SAL_CALL \
76 transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) \
77 throw(com::sun::star::uno::RuntimeException); \
78 sal_Unicode SAL_CALL \
79 transliterateChar2Char( sal_Unicode inChar) \
80 throw(com::sun::star::uno::RuntimeException, \
81 com::sun::star::i18n::MultipleCharsOutputException); \
84 #if defined( TRANSLITERATION_fullwidthToHalfwidth ) || defined( TRANSLITERATION_ALL )
85 TRANSLITERATION_ONETOONE( fullwidthToHalfwidth )
86 #endif
87 #if defined( TRANSLITERATION_halfwidthToFullwidth ) || defined( TRANSLITERATION_ALL )
88 TRANSLITERATION_ONETOONE(halfwidthToFullwidth)
89 #endif
90 #if defined( TRANSLITERATION_fullwidthKatakanaToHalfwidthKatakana ) || defined( TRANSLITERATION_ALL )
91 TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana )
92 #endif
93 #if defined( TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana ) || defined( TRANSLITERATION_ALL )
94 TRANSLITERATION_ONETOONE(halfwidthKatakanaToFullwidthKatakana)
95 #endif
96 #if defined( TRANSLITERATION_fullwidthToHalfwidthLikeASC ) || defined( TRANSLITERATION_ALL )
97 TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC )
98 #endif
99 #if defined( TRANSLITERATION_halfwidthToFullwidthLikeJIS ) || defined( TRANSLITERATION_ALL )
100 TRANSLITERATION_ONETOONE( halfwidthToFullwidthLikeJIS )
101 #endif
102 #undef TRANSLITERATION_ONETOONE
104 #define TRANSLITERATION_ONETOONE( name ) \
105 class name : public transliteration_OneToOne \
107 public: \
108 name (); \
111 #if defined( TRANSLITERATION_hiraganaToKatakana ) || defined( TRANSLITERATION_ALL )
112 TRANSLITERATION_ONETOONE(hiraganaToKatakana)
113 #endif
114 #if defined( TRANSLITERATION_katakanaToHiragana ) || defined( TRANSLITERATION_ALL )
115 TRANSLITERATION_ONETOONE(katakanaToHiragana)
116 #endif
117 #if defined( TRANSLITERATION_largeToSmall_ja_JP ) || defined( TRANSLITERATION_ALL )
118 TRANSLITERATION_ONETOONE(largeToSmall_ja_JP)
119 #endif
120 #if defined( TRANSLITERATION_smallToLarge_ja_JP ) || defined( TRANSLITERATION_ALL )
121 TRANSLITERATION_ONETOONE(smallToLarge_ja_JP)
122 #endif
123 #undef TRANSLITERATION_ONETOONE
125 } } } }
127 #endif // _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_