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#pragma once
20
22#include <unicode/translit.h>
23#include <memory>
24
25namespace i18nutil { class oneToOneMapping; }
26
28
29namespace i18npool {
30
32{
33public:
34 virtual OUString
35 foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) 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 >* pOffset ) 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
67protected:
69 i18nutil::oneToOneMapping *table;
70 const Mapping *map;
71};
72
73#define TRANSLITERATION_IGNORE( name ) \
74class ignore##name final : public transliteration_Ignore {\
75public:\
76 ignore##name ();\
77};
78
79TRANSLITERATION_IGNORE(BaFa_ja_JP)
80TRANSLITERATION_IGNORE(HyuByu_ja_JP)
81TRANSLITERATION_IGNORE(SeZe_ja_JP)
82TRANSLITERATION_IGNORE(TiJi_ja_JP)
83TRANSLITERATION_IGNORE(MiddleDot_ja_JP)
84TRANSLITERATION_IGNORE(MinusSign_ja_JP)
85TRANSLITERATION_IGNORE(Separator_ja_JP)
86TRANSLITERATION_IGNORE(Space_ja_JP)
87TRANSLITERATION_IGNORE(TraditionalKana_ja_JP)
88TRANSLITERATION_IGNORE(TraditionalKanji_ja_JP)
89TRANSLITERATION_IGNORE(ZiZu_ja_JP)
90TRANSLITERATION_IGNORE(Kashida_CTL)
91
93{
94 std::unique_ptr<icu::Transliterator> m_transliterator;
95
96public:
98
99 OUString
100 foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence<sal_Int32>* pOffset) 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 ) \
109class ignore##name final : public transliteration_Ignore {\
110public:\
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 >* pOffset) override; \
120};
121
122TRANSLITERATION_IGNORE(KiKuFollowedBySa_ja_JP)
123TRANSLITERATION_IGNORE(IandEfollowedByYa_ja_JP)
124TRANSLITERATION_IGNORE(IterationMark_ja_JP)
125TRANSLITERATION_IGNORE(ProlongedSoundMark_ja_JP)
126
127#undef TRANSLITERATION_IGNORE
128
129#define TRANSLITERATION_IGNORE( name ) \
130class ignore##name final : public transliteration_Ignore {\
131public:\
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 >* pOffset) 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
151TRANSLITERATION_IGNORE(Size_ja_JP)
152
153#undef TRANSLITERATION_IGNORE
154
155}
156
157/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< icu::Transliterator > m_transliterator
OUString transliterateImpl(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > *pOffset) override
css::uno::Sequence< OUString > SAL_CALL transliterateRange(const OUString &str1, const OUString &str2) override
virtual sal_Unicode SAL_CALL transliterateChar2Char(sal_Unicode inChar) 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
virtual OUString foldingImpl(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > *pOffset) override
sal_Int16 SAL_CALL getType() override
int nCount
Constant values shared between i18npool and, for example, the number formatter.
sal_Unicode(* TransFunc)(const sal_Unicode)
sal_Unicode(* TransFunc)(const sal_Unicode)
#define TRANSLITERATION_IGNORE(name)
unsigned char sal_Bool
sal_uInt16 sal_Unicode