1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
20 #define _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
22 #include <transliteration_commonclass.hxx>
23 #include <i18nutil/oneToOneMapping.hxx>
25 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
27 typedef sal_Unicode (*TransFunc
)(const sal_Unicode
);
29 class transliteration_OneToOne
: public transliteration_commonclass
33 transliterate( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, com::sun::star::uno::Sequence
< sal_Int32
>& offset
)
34 throw(com::sun::star::uno::RuntimeException
);
37 transliterateChar2Char( sal_Unicode inChar
)
38 throw(com::sun::star::uno::RuntimeException
,
39 com::sun::star::i18n::MultipleCharsOutputException
);
41 // Methods which are shared.
42 sal_Int16 SAL_CALL
getType() throw(com::sun::star::uno::RuntimeException
);
45 folding( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, com::sun::star::uno::Sequence
< sal_Int32
>& offset
)
46 throw(com::sun::star::uno::RuntimeException
);
49 equals( const OUString
& str1
, sal_Int32 pos1
, sal_Int32 nCount1
, sal_Int32
& nMatch1
,
50 const OUString
& str2
, sal_Int32 pos2
, sal_Int32 nCount2
, sal_Int32
& nMatch2
)
51 throw(com::sun::star::uno::RuntimeException
);
53 com::sun::star::uno::Sequence
< OUString
> SAL_CALL
54 transliterateRange( const OUString
& str1
, const OUString
& str2
)
55 throw(com::sun::star::uno::RuntimeException
);
59 oneToOneMapping
*table
;
62 #define TRANSLITERATION_ONETOONE( name ) \
63 class name : public transliteration_OneToOne \
68 transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) \
69 throw(com::sun::star::uno::RuntimeException); \
70 sal_Unicode SAL_CALL \
71 transliterateChar2Char( sal_Unicode inChar) \
72 throw(com::sun::star::uno::RuntimeException, \
73 com::sun::star::i18n::MultipleCharsOutputException); \
76 #if defined( TRANSLITERATION_fullwidthToHalfwidth ) || defined( TRANSLITERATION_ALL )
77 TRANSLITERATION_ONETOONE( fullwidthToHalfwidth
)
79 #if defined( TRANSLITERATION_halfwidthToFullwidth ) || defined( TRANSLITERATION_ALL )
80 TRANSLITERATION_ONETOONE(halfwidthToFullwidth
)
82 #if defined( TRANSLITERATION_fullwidthKatakanaToHalfwidthKatakana ) || defined( TRANSLITERATION_ALL )
83 TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana
)
85 #if defined( TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana ) || defined( TRANSLITERATION_ALL )
86 TRANSLITERATION_ONETOONE(halfwidthKatakanaToFullwidthKatakana
)
88 #if defined( TRANSLITERATION_fullwidthToHalfwidthLikeASC ) || defined( TRANSLITERATION_ALL )
89 TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC
)
91 #if defined( TRANSLITERATION_halfwidthToFullwidthLikeJIS ) || defined( TRANSLITERATION_ALL )
92 TRANSLITERATION_ONETOONE( halfwidthToFullwidthLikeJIS
)
94 #undef TRANSLITERATION_ONETOONE
96 #define TRANSLITERATION_ONETOONE( name ) \
97 class name : public transliteration_OneToOne \
103 #if defined( TRANSLITERATION_hiraganaToKatakana ) || defined( TRANSLITERATION_ALL )
104 TRANSLITERATION_ONETOONE(hiraganaToKatakana
)
106 #if defined( TRANSLITERATION_katakanaToHiragana ) || defined( TRANSLITERATION_ALL )
107 TRANSLITERATION_ONETOONE(katakanaToHiragana
)
109 #if defined( TRANSLITERATION_largeToSmall_ja_JP ) || defined( TRANSLITERATION_ALL )
110 TRANSLITERATION_ONETOONE(largeToSmall_ja_JP
)
112 #if defined( TRANSLITERATION_smallToLarge_ja_JP ) || defined( TRANSLITERATION_ALL )
113 TRANSLITERATION_ONETOONE(smallToLarge_ja_JP
)
115 #undef TRANSLITERATION_ONETOONE
119 #endif // _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */