LibreOffice Module i18npool (master)  1
transliteration_Ignore.hxx
Go to the documentation of this file.
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 INCLUDED_I18NPOOL_INC_TRANSLITERATION_IGNORE_HXX
20 #define INCLUDED_I18NPOOL_INC_TRANSLITERATION_IGNORE_HXX
21 
23 #include <unicode/translit.h>
24 
25 namespace i18nutil { class oneToOneMapping; }
26 
27 typedef sal_Unicode (*TransFunc)(const sal_Unicode);
28 
29 namespace i18npool {
30 
32 {
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;
36 
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;
41 
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;
45 
46 
47  // Methods which are shared.
48  sal_Int16 SAL_CALL getType( ) override;
49 
50  OUString
51  transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
52 
53  virtual sal_Unicode SAL_CALL
54  transliterateChar2Char( sal_Unicode inChar) override;
55 
57  static css::uno::Sequence< OUString >
58  transliterateRange( const OUString& str1, const OUString& str2, XTransliteration& t1, XTransliteration& t2 );
59 
60  struct Mapping {
64  bool two2one;
65  };
66 
67 protected:
69  i18nutil::oneToOneMapping *table;
70  const Mapping *map;
71 };
72 
73 #define TRANSLITERATION_IGNORE( name ) \
74 class ignore##name final : public transliteration_Ignore {\
75 public:\
76  ignore##name ();\
77 };
78 
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)
91 
93 {
94  icu::Transliterator* m_transliterator;
95 
96 public:
98 
99  OUString
100  foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence<sal_Int32>& rOffset, bool useOffset) override;
101 
102  sal_Unicode SAL_CALL
103  transliterateChar2Char(sal_Unicode nInChar) override;
104 };
105 
106 #undef TRANSLITERATION_IGNORE
107 
108 #define TRANSLITERATION_IGNORE( name ) \
109 class ignore##name final : 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;\
117  };\
118  OUString foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
119  css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override; \
120 };
121 
122 TRANSLITERATION_IGNORE(KiKuFollowedBySa_ja_JP)
123 TRANSLITERATION_IGNORE(IandEfollowedByYa_ja_JP)
124 TRANSLITERATION_IGNORE(IterationMark_ja_JP)
125 TRANSLITERATION_IGNORE(ProlongedSoundMark_ja_JP)
126 
127 #undef TRANSLITERATION_IGNORE
128 
129 #define TRANSLITERATION_IGNORE( name ) \
130 class ignore##name final : 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;\
138  };\
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;\
147 };
148 
151 TRANSLITERATION_IGNORE(Size_ja_JP)
152 
153 #undef TRANSLITERATION_IGNORE
154 
155 }
156 
157 #endif // INCLUDED_I18NPOOL_INC_TRANSLITERATION_IGNORE_HXX
158 
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Unicode(* TransFunc)(const sal_Unicode)
sal_Int16 SAL_CALL getType() override
sal_uInt16 sal_Unicode
#define TRANSLITERATION_IGNORE(name)
int nCount
virtual sal_Unicode SAL_CALL transliterateChar2Char(sal_Unicode inChar) override
OUString transliterateImpl(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > &offset, bool useOffset) override
sal_Bool SAL_CALL equals(const OUString &str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32 &nMatch1, const OUString &str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32 &nMatch2) override
unsigned char sal_Bool
Constant values shared between i18npool and, for example, the number formatter.
css::uno::Sequence< OUString > SAL_CALL transliterateRange(const OUString &str1, const OUString &str2) override
sal_Unicode(* TransFunc)(const sal_Unicode)
virtual OUString foldingImpl(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > &offset, bool useOffset) override