1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: transliteration_OneToOne.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
31 #define _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
33 #include <transliteration_commonclass.hxx>
34 #include <i18nutil/oneToOneMapping.hxx>
36 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
38 typedef sal_Unicode (*TransFunc
)(const sal_Unicode
);
40 class transliteration_OneToOne
: public transliteration_commonclass
43 rtl::OUString SAL_CALL
44 transliterate( const rtl::OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, com::sun::star::uno::Sequence
< sal_Int32
>& offset
)
45 throw(com::sun::star::uno::RuntimeException
);
48 transliterateChar2Char( sal_Unicode inChar
)
49 throw(com::sun::star::uno::RuntimeException
,
50 com::sun::star::i18n::MultipleCharsOutputException
);
52 // Methods which are shared.
53 sal_Int16 SAL_CALL
getType() throw(com::sun::star::uno::RuntimeException
);
55 rtl::OUString SAL_CALL
56 folding( const rtl::OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, com::sun::star::uno::Sequence
< sal_Int32
>& offset
)
57 throw(com::sun::star::uno::RuntimeException
);
60 equals( const rtl::OUString
& str1
, sal_Int32 pos1
, sal_Int32 nCount1
, sal_Int32
& nMatch1
,
61 const rtl::OUString
& str2
, sal_Int32 pos2
, sal_Int32 nCount2
, sal_Int32
& nMatch2
)
62 throw(com::sun::star::uno::RuntimeException
);
64 com::sun::star::uno::Sequence
< rtl::OUString
> SAL_CALL
65 transliterateRange( const rtl::OUString
& str1
, const rtl::OUString
& str2
)
66 throw(com::sun::star::uno::RuntimeException
);
70 oneToOneMapping
*table
;
73 #define TRANSLITERATION_ONETOONE( name ) \
74 class name : public transliteration_OneToOne \
78 rtl::OUString SAL_CALL \
79 transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) \
80 throw(com::sun::star::uno::RuntimeException); \
81 sal_Unicode SAL_CALL \
82 transliterateChar2Char( sal_Unicode inChar) \
83 throw(com::sun::star::uno::RuntimeException, \
84 com::sun::star::i18n::MultipleCharsOutputException); \
87 #if defined( TRANSLITERATION_fullwidthToHalfwidth ) || defined( TRANSLITERATION_ALL )
88 TRANSLITERATION_ONETOONE( fullwidthToHalfwidth
)
90 #if defined( TRANSLITERATION_halfwidthToFullwidth ) || defined( TRANSLITERATION_ALL )
91 TRANSLITERATION_ONETOONE(halfwidthToFullwidth
)
93 #if defined( TRANSLITERATION_fullwidthKatakanaToHalfwidthKatakana ) || defined( TRANSLITERATION_ALL )
94 TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana
)
96 #if defined( TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana ) || defined( TRANSLITERATION_ALL )
97 TRANSLITERATION_ONETOONE(halfwidthKatakanaToFullwidthKatakana
)
99 #if defined( TRANSLITERATION_fullwidthToHalfwidthLikeASC ) || defined( TRANSLITERATION_ALL )
100 TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC
)
102 #if defined( TRANSLITERATION_halfwidthToFullwidthLikeJIS ) || defined( TRANSLITERATION_ALL )
103 TRANSLITERATION_ONETOONE( halfwidthToFullwidthLikeJIS
)
105 #undef TRANSLITERATION_ONETOONE
107 #define TRANSLITERATION_ONETOONE( name ) \
108 class name : public transliteration_OneToOne \
114 #if defined( TRANSLITERATION_hiraganaToKatakana ) || defined( TRANSLITERATION_ALL )
115 TRANSLITERATION_ONETOONE(hiraganaToKatakana
)
117 #if defined( TRANSLITERATION_katakanaToHiragana ) || defined( TRANSLITERATION_ALL )
118 TRANSLITERATION_ONETOONE(katakanaToHiragana
)
120 #if defined( TRANSLITERATION_largeToSmall_ja_JP ) || defined( TRANSLITERATION_ALL )
121 TRANSLITERATION_ONETOONE(largeToSmall_ja_JP
)
123 #if defined( TRANSLITERATION_smallToLarge_ja_JP ) || defined( TRANSLITERATION_ALL )
124 TRANSLITERATION_ONETOONE(smallToLarge_ja_JP
)
126 #undef TRANSLITERATION_ONETOONE
130 #endif // _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_