Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / i18npool / inc / transliteration_OneToOne.hxx
blobfc45755c9f13c06ed11a60bafbad2e39362143c3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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; }
26 namespace i18npool {
28 typedef sal_Unicode (*TransFunc)(const sal_Unicode);
30 class transliteration_OneToOne : public transliteration_commonclass
32 public:
33 OUString
34 transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
36 sal_Unicode SAL_CALL
37 transliterateChar2Char( sal_Unicode inChar) override;
39 // Methods which are shared.
40 sal_Int16 SAL_CALL getType() override;
42 OUString
43 foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
45 sal_Bool SAL_CALL
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;
52 protected:
53 TransFunc func;
54 i18nutil::oneToOneMapping *table;
57 #define TRANSLITERATION_ONETOONE( name ) \
58 class name : public transliteration_OneToOne \
59 { \
60 public: \
61 name (); \
62 OUString \
63 transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) \
64 override; \
65 sal_Unicode SAL_CALL \
66 transliterateChar2Char( sal_Unicode inChar) \
67 override; \
70 TRANSLITERATION_ONETOONE( fullwidthToHalfwidth )
71 TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana )
72 TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC )
74 class halfwidthToFullwidth : public transliteration_OneToOne
76 public:
77 halfwidthToFullwidth();
78 OUString
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
83 public:
84 halfwidthKatakanaToFullwidthKatakana();
85 OUString
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
90 public:
91 halfwidthToFullwidthLikeJIS();
92 OUString
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 \
101 public: \
102 name (); \
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: */