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 .
21 #include "transliteration_commonclass.hxx"
23 namespace i18nutil
{ class oneToOneMapping
; }
27 typedef sal_Unicode (*TransFunc
)(const sal_Unicode
);
29 class transliteration_OneToOne
: public transliteration_commonclass
33 transliterateImpl( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, css::uno::Sequence
< sal_Int32
>* pOffset
) override
;
36 transliterateChar2Char( sal_Unicode inChar
) override
;
38 // Methods which are shared.
39 sal_Int16 SAL_CALL
getType() override
;
42 foldingImpl( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, css::uno::Sequence
< sal_Int32
>* pOffset
) override
;
45 equals( const OUString
& str1
, sal_Int32 pos1
, sal_Int32 nCount1
, sal_Int32
& nMatch1
,
46 const OUString
& str2
, sal_Int32 pos2
, sal_Int32 nCount2
, sal_Int32
& nMatch2
) override
;
48 css::uno::Sequence
< OUString
> SAL_CALL
49 transliterateRange( const OUString
& str1
, const OUString
& str2
) override
;
53 i18nutil::oneToOneMapping
*table
;
56 #define TRANSLITERATION_ONETOONE( name ) \
57 class name final : public transliteration_OneToOne \
62 transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) \
64 sal_Unicode SAL_CALL \
65 transliterateChar2Char( sal_Unicode inChar) \
69 TRANSLITERATION_ONETOONE( fullwidthToHalfwidth
)
70 TRANSLITERATION_ONETOONE( FULLWIDTHKATAKANA_HALFWIDTHKATAKANA
)
71 TRANSLITERATION_ONETOONE( FULLWIDTH_HALFWIDTH_LIKE_ASC
)
73 class halfwidthToFullwidth final
: public transliteration_OneToOne
76 halfwidthToFullwidth();
78 transliterateImpl( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, css::uno::Sequence
< sal_Int32
>* pOffset
) override
;
80 class HALFWIDTHKATAKANA_FULLWIDTHKATAKANA final
: public transliteration_OneToOne
83 HALFWIDTHKATAKANA_FULLWIDTHKATAKANA();
85 transliterateImpl( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, css::uno::Sequence
< sal_Int32
>* pOffset
) override
;
87 class HALFWIDTH_FULLWIDTH_LIKE_JIS final
: public transliteration_OneToOne
90 HALFWIDTH_FULLWIDTH_LIKE_JIS();
92 transliterateImpl( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
, css::uno::Sequence
< sal_Int32
>* pOffset
) override
;
95 #undef TRANSLITERATION_ONETOONE
97 #define TRANSLITERATION_ONETOONE( name ) \
98 class name final : public transliteration_OneToOne \
104 TRANSLITERATION_ONETOONE(hiraganaToKatakana
)
105 TRANSLITERATION_ONETOONE(katakanaToHiragana
)
106 TRANSLITERATION_ONETOONE(largeToSmall_ja_JP
)
107 TRANSLITERATION_ONETOONE(smallToLarge_ja_JP
)
109 #undef TRANSLITERATION_ONETOONE
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */