Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_
20 : #define _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_
21 :
22 : #include <transliteration_commonclass.hxx>
23 : #include <i18nutil/oneToOneMapping.hxx>
24 :
25 : typedef sal_Unicode (*TransFunc)(const sal_Unicode);
26 :
27 : typedef struct {
28 : sal_Unicode previousChar;
29 : sal_Unicode currentChar;
30 : sal_Unicode replaceChar;
31 : sal_Bool two2one;
32 : } Mapping;
33 :
34 : namespace com { namespace sun { namespace star { namespace i18n {
35 :
36 0 : class transliteration_Ignore : public transliteration_commonclass
37 : {
38 : public:
39 : virtual OUString SAL_CALL
40 : folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset)
41 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
42 :
43 : // This method is shared.
44 : sal_Bool SAL_CALL
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 )
47 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
48 :
49 : // This method is implemented in sub class if needed. Otherwise, the method implemented in this class will be used.
50 : com::sun::star::uno::Sequence< OUString > SAL_CALL
51 : transliterateRange( const OUString& str1, const OUString& str2 )
52 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
53 :
54 :
55 : // Methods which are shared.
56 : sal_Int16 SAL_CALL getType( ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
57 :
58 : OUString SAL_CALL
59 : transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset )
60 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
61 :
62 : virtual sal_Unicode SAL_CALL
63 : transliterateChar2Char( sal_Unicode inChar)
64 : throw(com::sun::star::uno::RuntimeException,
65 : com::sun::star::i18n::MultipleCharsOutputException, std::exception) SAL_OVERRIDE;
66 :
67 : com::sun::star::uno::Sequence< OUString > SAL_CALL
68 : transliterateRange( const OUString& str1, const OUString& str2, XTransliteration& t1, XTransliteration& t2 )
69 : throw(com::sun::star::uno::RuntimeException);
70 :
71 : protected:
72 : TransFunc func;
73 : oneToOneMapping *table;
74 : const Mapping *map;
75 : };
76 :
77 : #define TRANSLITERATION_IGNORE( name ) \
78 : class ignore##name : public transliteration_Ignore {\
79 : public:\
80 : ignore##name ();\
81 : };
82 :
83 : #if defined( TRANSLITERATION_BaFa_ja_JP ) || defined( TRANSLITERATION_ALL )
84 0 : TRANSLITERATION_IGNORE(BaFa_ja_JP)
85 : #endif
86 : #if defined( TRANSLITERATION_HyuByu_ja_JP ) || defined( TRANSLITERATION_ALL )
87 0 : TRANSLITERATION_IGNORE(HyuByu_ja_JP)
88 : #endif
89 : #if defined( TRANSLITERATION_SeZe_ja_JP ) || defined( TRANSLITERATION_ALL )
90 0 : TRANSLITERATION_IGNORE(SeZe_ja_JP)
91 : #endif
92 : #if defined( TRANSLITERATION_TiJi_ja_JP ) || defined( TRANSLITERATION_ALL )
93 0 : TRANSLITERATION_IGNORE(TiJi_ja_JP)
94 : #endif
95 : #if defined( TRANSLITERATION_MiddleDot_ja_JP ) || defined( TRANSLITERATION_ALL )
96 0 : TRANSLITERATION_IGNORE(MiddleDot_ja_JP)
97 : #endif
98 : #if defined( TRANSLITERATION_MinusSign_ja_JP ) || defined( TRANSLITERATION_ALL )
99 0 : TRANSLITERATION_IGNORE(MinusSign_ja_JP)
100 : #endif
101 : #if defined( TRANSLITERATION_Separator_ja_JP ) || defined( TRANSLITERATION_ALL )
102 0 : TRANSLITERATION_IGNORE(Separator_ja_JP)
103 : #endif
104 : #if defined( TRANSLITERATION_Space_ja_JP ) || defined( TRANSLITERATION_ALL )
105 0 : TRANSLITERATION_IGNORE(Space_ja_JP)
106 : #endif
107 : #if defined( TRANSLITERATION_TraditionalKana_ja_JP ) || defined( TRANSLITERATION_ALL )
108 0 : TRANSLITERATION_IGNORE(TraditionalKana_ja_JP)
109 : #endif
110 : #if defined( TRANSLITERATION_TraditionalKanji_ja_JP ) || defined( TRANSLITERATION_ALL )
111 0 : TRANSLITERATION_IGNORE(TraditionalKanji_ja_JP)
112 : #endif
113 : #if defined( TRANSLITERATION_ZiZu_ja_JP ) || defined( TRANSLITERATION_ALL )
114 0 : TRANSLITERATION_IGNORE(ZiZu_ja_JP)
115 : #endif
116 :
117 : #if defined( TRANSLITERATION_Diacritics_CTL ) || defined( TRANSLITERATION_ALL )
118 0 : TRANSLITERATION_IGNORE(Diacritics_CTL)
119 : #endif
120 :
121 : #if defined( TRANSLITERATION_Kashida_CTL ) || defined( TRANSLITERATION_ALL )
122 0 : TRANSLITERATION_IGNORE(Kashida_CTL)
123 : #endif
124 :
125 : #undef TRANSLITERATION_IGNORE
126 :
127 : #define TRANSLITERATION_IGNORE( name ) \
128 : class ignore##name : public transliteration_Ignore {\
129 : public:\
130 : ignore##name () {\
131 : func = (TransFunc) 0;\
132 : table = 0;\
133 : map = 0;\
134 : transliterationName = "ignore"#name;\
135 : implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\
136 : };\
137 : OUString SAL_CALL folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
138 : com::sun::star::uno::Sequence< sal_Int32 >& offset) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; \
139 : };
140 :
141 : #if defined( TRANSLITERATION_KiKuFollowedBySa_ja_JP ) || defined( TRANSLITERATION_ALL )
142 0 : TRANSLITERATION_IGNORE(KiKuFollowedBySa_ja_JP)
143 : #endif
144 : #if defined( TRANSLITERATION_IandEfollowedByYa_ja_JP ) || defined( TRANSLITERATION_ALL )
145 0 : TRANSLITERATION_IGNORE(IandEfollowedByYa_ja_JP)
146 : #endif
147 : #if defined( TRANSLITERATION_IterationMark_ja_JP ) || defined( TRANSLITERATION_ALL )
148 0 : TRANSLITERATION_IGNORE(IterationMark_ja_JP)
149 : #endif
150 : #if defined( TRANSLITERATION_ProlongedSoundMark_ja_JP ) || defined( TRANSLITERATION_ALL )
151 0 : TRANSLITERATION_IGNORE(ProlongedSoundMark_ja_JP)
152 : #endif
153 : #undef TRANSLITERATION_IGNORE
154 :
155 : #define TRANSLITERATION_IGNORE( name ) \
156 : class ignore##name : public transliteration_Ignore {\
157 : public:\
158 : ignore##name () {\
159 : func = (TransFunc) 0;\
160 : table = 0;\
161 : map = 0;\
162 : transliterationName = "ignore"#name;\
163 : implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\
164 : };\
165 : OUString SAL_CALL folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
166 : com::sun::star::uno::Sequence< sal_Int32 >& offset) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; \
167 : using transliteration_Ignore::transliterateRange;\
168 : com::sun::star::uno::Sequence< OUString > SAL_CALL transliterateRange( const OUString& str1, \
169 : const OUString& str2 ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; \
170 : sal_Unicode SAL_CALL \
171 : transliterateChar2Char( sal_Unicode inChar) \
172 : throw(com::sun::star::uno::RuntimeException,\
173 : com::sun::star::i18n::MultipleCharsOutputException, std::exception) SAL_OVERRIDE;\
174 : };
175 :
176 : #if defined( TRANSLITERATION_Kana ) || defined( TRANSLITERATION_ALL )
177 0 : TRANSLITERATION_IGNORE(Kana)
178 : #endif
179 : #if defined( TRANSLITERATION_Width ) || defined( TRANSLITERATION_ALL )
180 0 : TRANSLITERATION_IGNORE(Width)
181 : #endif
182 : #if defined( TRANSLITERATION_Size_ja_JP ) || defined( TRANSLITERATION_ALL )
183 0 : TRANSLITERATION_IGNORE(Size_ja_JP)
184 : #endif
185 : #undef TRANSLITERATION_IGNORE
186 :
187 : } } } }
188 :
189 : #endif // _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_
190 :
191 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|