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 INCLUDED_I18NPOOL_INC_TRANSLITERATION_ONETOONE_HXX
20 #define INCLUDED_I18NPOOL_INC_TRANSLITERATION_ONETOONE_HXX
22 #include "transliteration_commonclass.hxx"
24 namespace i18nutil
{ class oneToOneMapping
; }
28 typedef sal_Unicode (*TransFunc
)(const sal_Unicode
);
30 class transliteration_OneToOne
: public transliteration_commonclass
34 transliterateImpl( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, css::uno::Sequence
< sal_Int32
>& offset
, bool useOffset
) override
;
37 transliterateChar2Char( sal_Unicode inChar
) override
;
39 // Methods which are shared.
40 sal_Int16 SAL_CALL
getType() override
;
43 foldingImpl( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, css::uno::Sequence
< sal_Int32
>& offset
, bool useOffset
) override
;
46 equals( const OUString
& str1
, sal_Int32 pos1
, sal_Int32 nCount1
, sal_Int32
& nMatch1
,
47 const OUString
& str2
, sal_Int32 pos2
, sal_Int32 nCount2
, sal_Int32
& nMatch2
) override
;
49 css::uno::Sequence
< OUString
> SAL_CALL
50 transliterateRange( const OUString
& str1
, const OUString
& str2
) override
;
54 i18nutil::oneToOneMapping
*table
;
57 #define TRANSLITERATION_ONETOONE( name ) \
58 class name : public transliteration_OneToOne \
63 transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) \
65 sal_Unicode SAL_CALL \
66 transliterateChar2Char( sal_Unicode inChar) \
70 TRANSLITERATION_ONETOONE( fullwidthToHalfwidth
)
71 TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana
)
72 TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC
)
74 class halfwidthToFullwidth
: public transliteration_OneToOne
77 halfwidthToFullwidth();
79 transliterateImpl( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, css::uno::Sequence
< sal_Int32
>& offset
, bool useOffset
) override
;
81 class halfwidthKatakanaToFullwidthKatakana
: public transliteration_OneToOne
84 halfwidthKatakanaToFullwidthKatakana();
86 transliterateImpl( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, css::uno::Sequence
< sal_Int32
>& offset
, bool useOffset
) override
;
88 class halfwidthToFullwidthLikeJIS
: public transliteration_OneToOne
91 halfwidthToFullwidthLikeJIS();
93 transliterateImpl( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, css::uno::Sequence
< sal_Int32
>& offset
, bool useOffset
) override
;
96 #undef TRANSLITERATION_ONETOONE
98 #define TRANSLITERATION_ONETOONE( name ) \
99 class name : public transliteration_OneToOne \
105 TRANSLITERATION_ONETOONE(hiraganaToKatakana
)
106 TRANSLITERATION_ONETOONE(katakanaToHiragana
)
107 TRANSLITERATION_ONETOONE(largeToSmall_ja_JP
)
108 TRANSLITERATION_ONETOONE(smallToLarge_ja_JP
)
110 #undef TRANSLITERATION_ONETOONE
114 #endif // INCLUDED_I18NPOOL_INC_TRANSLITERATION_ONETOONE_HXX
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */