Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / i18npool / inc / transliteration_Ignore.hxx
blobf8b9a554f4b2f612b4ab9f40d7bb3b06eaa8a030
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_IGNORE_HXX
20 #define INCLUDED_I18NPOOL_INC_TRANSLITERATION_IGNORE_HXX
22 #include "transliteration_commonclass.hxx"
23 #include <unicode/translit.h>
25 namespace i18nutil { class oneToOneMapping; }
27 typedef sal_Unicode (*TransFunc)(const sal_Unicode);
29 namespace i18npool {
31 class transliteration_Ignore : public transliteration_commonclass
33 public:
34 virtual OUString
35 foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
37 // This method is shared.
38 sal_Bool SAL_CALL
39 equals( const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1,
40 const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) override;
42 // This method is implemented in sub class if needed. Otherwise, the method implemented in this class will be used.
43 css::uno::Sequence< OUString > SAL_CALL
44 transliterateRange( const OUString& str1, const OUString& str2 ) override;
47 // Methods which are shared.
48 sal_Int16 SAL_CALL getType( ) override;
50 OUString
51 transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
53 virtual sal_Unicode SAL_CALL
54 transliterateChar2Char( sal_Unicode inChar) override;
56 /// @throws css::uno::RuntimeException
57 static css::uno::Sequence< OUString >
58 transliterateRange( const OUString& str1, const OUString& str2, XTransliteration& t1, XTransliteration& t2 );
60 struct Mapping {
61 sal_Unicode previousChar;
62 sal_Unicode currentChar;
63 sal_Unicode replaceChar;
64 bool two2one;
67 protected:
68 TransFunc func;
69 i18nutil::oneToOneMapping *table;
70 const Mapping *map;
73 #define TRANSLITERATION_IGNORE( name ) \
74 class ignore##name : public transliteration_Ignore {\
75 public:\
76 ignore##name ();\
79 TRANSLITERATION_IGNORE(BaFa_ja_JP)
80 TRANSLITERATION_IGNORE(HyuByu_ja_JP)
81 TRANSLITERATION_IGNORE(SeZe_ja_JP)
82 TRANSLITERATION_IGNORE(TiJi_ja_JP)
83 TRANSLITERATION_IGNORE(MiddleDot_ja_JP)
84 TRANSLITERATION_IGNORE(MinusSign_ja_JP)
85 TRANSLITERATION_IGNORE(Separator_ja_JP)
86 TRANSLITERATION_IGNORE(Space_ja_JP)
87 TRANSLITERATION_IGNORE(TraditionalKana_ja_JP)
88 TRANSLITERATION_IGNORE(TraditionalKanji_ja_JP)
89 TRANSLITERATION_IGNORE(ZiZu_ja_JP)
90 TRANSLITERATION_IGNORE(Kashida_CTL)
92 class ignoreDiacritics_CTL : public transliteration_Ignore
94 icu::Transliterator* m_transliterator;
96 public:
97 ignoreDiacritics_CTL();
99 OUString
100 foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence<sal_Int32>& rOffset, bool useOffset) override;
102 sal_Unicode SAL_CALL
103 transliterateChar2Char(sal_Unicode nInChar) override;
106 #undef TRANSLITERATION_IGNORE
108 #define TRANSLITERATION_IGNORE( name ) \
109 class ignore##name : public transliteration_Ignore {\
110 public:\
111 ignore##name () {\
112 func = nullptr;\
113 table = nullptr;\
114 map = nullptr;\
115 transliterationName = "ignore"#name;\
116 implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\
118 OUString foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
119 css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override; \
122 TRANSLITERATION_IGNORE(KiKuFollowedBySa_ja_JP)
123 TRANSLITERATION_IGNORE(IandEfollowedByYa_ja_JP)
124 TRANSLITERATION_IGNORE(IterationMark_ja_JP)
125 TRANSLITERATION_IGNORE(ProlongedSoundMark_ja_JP)
127 #undef TRANSLITERATION_IGNORE
129 #define TRANSLITERATION_IGNORE( name ) \
130 class ignore##name : public transliteration_Ignore {\
131 public:\
132 ignore##name () {\
133 func = nullptr;\
134 table = nullptr;\
135 map = nullptr;\
136 transliterationName = "ignore"#name;\
137 implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\
139 OUString foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
140 css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override; \
141 using transliteration_Ignore::transliterateRange;\
142 css::uno::Sequence< OUString > SAL_CALL transliterateRange( const OUString& str1, \
143 const OUString& str2 ) override; \
144 sal_Unicode SAL_CALL \
145 transliterateChar2Char( sal_Unicode inChar) \
146 override;\
149 TRANSLITERATION_IGNORE(Kana)
150 TRANSLITERATION_IGNORE(Width)
151 TRANSLITERATION_IGNORE(Size_ja_JP)
153 #undef TRANSLITERATION_IGNORE
157 #endif // INCLUDED_I18NPOOL_INC_TRANSLITERATION_IGNORE_HXX
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */