1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski #ifndef _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
24*b1cdbd2cSJim Jagielski #define _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
25*b1cdbd2cSJim Jagielski 
26*b1cdbd2cSJim Jagielski #include <transliteration_commonclass.hxx>
27*b1cdbd2cSJim Jagielski #include <i18nutil/oneToOneMapping.hxx>
28*b1cdbd2cSJim Jagielski 
29*b1cdbd2cSJim Jagielski namespace com { namespace sun { namespace star { namespace i18n {
30*b1cdbd2cSJim Jagielski 
31*b1cdbd2cSJim Jagielski typedef sal_Unicode (*TransFunc)(const sal_Unicode);
32*b1cdbd2cSJim Jagielski 
33*b1cdbd2cSJim Jagielski class transliteration_OneToOne : public transliteration_commonclass
34*b1cdbd2cSJim Jagielski {
35*b1cdbd2cSJim Jagielski public:
36*b1cdbd2cSJim Jagielski         rtl::OUString SAL_CALL
37*b1cdbd2cSJim Jagielski         transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset  )
38*b1cdbd2cSJim Jagielski         throw(com::sun::star::uno::RuntimeException);
39*b1cdbd2cSJim Jagielski 
40*b1cdbd2cSJim Jagielski         sal_Unicode SAL_CALL
41*b1cdbd2cSJim Jagielski         transliterateChar2Char( sal_Unicode inChar)
42*b1cdbd2cSJim Jagielski         throw(com::sun::star::uno::RuntimeException,
43*b1cdbd2cSJim Jagielski         com::sun::star::i18n::MultipleCharsOutputException);
44*b1cdbd2cSJim Jagielski 
45*b1cdbd2cSJim Jagielski         // Methods which are shared.
46*b1cdbd2cSJim Jagielski         sal_Int16 SAL_CALL getType() throw(com::sun::star::uno::RuntimeException);
47*b1cdbd2cSJim Jagielski 
48*b1cdbd2cSJim Jagielski         rtl::OUString SAL_CALL
49*b1cdbd2cSJim Jagielski         folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset)
50*b1cdbd2cSJim Jagielski         throw(com::sun::star::uno::RuntimeException);
51*b1cdbd2cSJim Jagielski 
52*b1cdbd2cSJim Jagielski         sal_Bool SAL_CALL
53*b1cdbd2cSJim Jagielski         equals( const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1,
54*b1cdbd2cSJim Jagielski             const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 )
55*b1cdbd2cSJim Jagielski         throw(com::sun::star::uno::RuntimeException);
56*b1cdbd2cSJim Jagielski 
57*b1cdbd2cSJim Jagielski         com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
58*b1cdbd2cSJim Jagielski         transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2 )
59*b1cdbd2cSJim Jagielski         throw(com::sun::star::uno::RuntimeException);
60*b1cdbd2cSJim Jagielski 
61*b1cdbd2cSJim Jagielski protected:
62*b1cdbd2cSJim Jagielski         TransFunc func;
63*b1cdbd2cSJim Jagielski         oneToOneMapping *table;
64*b1cdbd2cSJim Jagielski };
65*b1cdbd2cSJim Jagielski 
66*b1cdbd2cSJim Jagielski #define TRANSLITERATION_ONETOONE( name ) \
67*b1cdbd2cSJim Jagielski class name : public transliteration_OneToOne \
68*b1cdbd2cSJim Jagielski { \
69*b1cdbd2cSJim Jagielski public: \
70*b1cdbd2cSJim Jagielski     name (); \
71*b1cdbd2cSJim Jagielski     rtl::OUString SAL_CALL \
72*b1cdbd2cSJim Jagielski     transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) \
73*b1cdbd2cSJim Jagielski     throw(com::sun::star::uno::RuntimeException); \
74*b1cdbd2cSJim Jagielski     sal_Unicode SAL_CALL \
75*b1cdbd2cSJim Jagielski     transliterateChar2Char( sal_Unicode inChar) \
76*b1cdbd2cSJim Jagielski     throw(com::sun::star::uno::RuntimeException, \
77*b1cdbd2cSJim Jagielski         com::sun::star::i18n::MultipleCharsOutputException); \
78*b1cdbd2cSJim Jagielski };
79*b1cdbd2cSJim Jagielski 
80*b1cdbd2cSJim Jagielski #if defined( TRANSLITERATION_fullwidthToHalfwidth ) || defined( TRANSLITERATION_ALL )
81*b1cdbd2cSJim Jagielski TRANSLITERATION_ONETOONE( fullwidthToHalfwidth )
82*b1cdbd2cSJim Jagielski #endif
83*b1cdbd2cSJim Jagielski #if defined( TRANSLITERATION_halfwidthToFullwidth ) || defined( TRANSLITERATION_ALL )
84*b1cdbd2cSJim Jagielski TRANSLITERATION_ONETOONE(halfwidthToFullwidth)
85*b1cdbd2cSJim Jagielski #endif
86*b1cdbd2cSJim Jagielski #if defined( TRANSLITERATION_fullwidthKatakanaToHalfwidthKatakana ) || defined( TRANSLITERATION_ALL )
87*b1cdbd2cSJim Jagielski TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana )
88*b1cdbd2cSJim Jagielski #endif
89*b1cdbd2cSJim Jagielski #if defined( TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana ) || defined( TRANSLITERATION_ALL )
90*b1cdbd2cSJim Jagielski TRANSLITERATION_ONETOONE(halfwidthKatakanaToFullwidthKatakana)
91*b1cdbd2cSJim Jagielski #endif
92*b1cdbd2cSJim Jagielski #if defined( TRANSLITERATION_fullwidthToHalfwidthLikeASC ) || defined( TRANSLITERATION_ALL )
93*b1cdbd2cSJim Jagielski TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC )
94*b1cdbd2cSJim Jagielski #endif
95*b1cdbd2cSJim Jagielski #if defined( TRANSLITERATION_halfwidthToFullwidthLikeJIS ) || defined( TRANSLITERATION_ALL )
96*b1cdbd2cSJim Jagielski TRANSLITERATION_ONETOONE( halfwidthToFullwidthLikeJIS )
97*b1cdbd2cSJim Jagielski #endif
98*b1cdbd2cSJim Jagielski #undef TRANSLITERATION_ONETOONE
99*b1cdbd2cSJim Jagielski 
100*b1cdbd2cSJim Jagielski #define TRANSLITERATION_ONETOONE( name ) \
101*b1cdbd2cSJim Jagielski class name : public transliteration_OneToOne \
102*b1cdbd2cSJim Jagielski { \
103*b1cdbd2cSJim Jagielski public: \
104*b1cdbd2cSJim Jagielski     name (); \
105*b1cdbd2cSJim Jagielski };
106*b1cdbd2cSJim Jagielski 
107*b1cdbd2cSJim Jagielski #if defined( TRANSLITERATION_hiraganaToKatakana ) || defined( TRANSLITERATION_ALL )
108*b1cdbd2cSJim Jagielski TRANSLITERATION_ONETOONE(hiraganaToKatakana)
109*b1cdbd2cSJim Jagielski #endif
110*b1cdbd2cSJim Jagielski #if defined( TRANSLITERATION_katakanaToHiragana ) || defined( TRANSLITERATION_ALL )
111*b1cdbd2cSJim Jagielski TRANSLITERATION_ONETOONE(katakanaToHiragana)
112*b1cdbd2cSJim Jagielski #endif
113*b1cdbd2cSJim Jagielski #if defined( TRANSLITERATION_largeToSmall_ja_JP ) || defined( TRANSLITERATION_ALL )
114*b1cdbd2cSJim Jagielski TRANSLITERATION_ONETOONE(largeToSmall_ja_JP)
115*b1cdbd2cSJim Jagielski #endif
116*b1cdbd2cSJim Jagielski #if defined( TRANSLITERATION_smallToLarge_ja_JP ) || defined( TRANSLITERATION_ALL )
117*b1cdbd2cSJim Jagielski TRANSLITERATION_ONETOONE(smallToLarge_ja_JP)
118*b1cdbd2cSJim Jagielski #endif
119*b1cdbd2cSJim Jagielski #undef TRANSLITERATION_ONETOONE
120*b1cdbd2cSJim Jagielski 
121*b1cdbd2cSJim Jagielski } } } }
122*b1cdbd2cSJim Jagielski 
123*b1cdbd2cSJim Jagielski #endif // _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
124