LibreOffice Module i18npool (master)  1
transliteration_OneToOne.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 
23 namespace i18nutil { class oneToOneMapping; }
24 
25 namespace i18npool {
26 
27 typedef sal_Unicode (*TransFunc)(const sal_Unicode);
28 
30 {
31 public:
32  OUString
33  transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override;
34 
35  sal_Unicode SAL_CALL
36  transliterateChar2Char( sal_Unicode inChar) override;
37 
38  // Methods which are shared.
39  sal_Int16 SAL_CALL getType() override;
40 
41  OUString
42  foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override;
43 
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 ) override;
47 
48  css::uno::Sequence< OUString > SAL_CALL
49  transliterateRange( const OUString& str1, const OUString& str2 ) override;
50 
51 protected:
53  i18nutil::oneToOneMapping *table;
54 };
55 
56 #define TRANSLITERATION_ONETOONE( name ) \
57 class name final : public transliteration_OneToOne \
58 { \
59 public: \
60  name (); \
61  OUString \
62  transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) \
63  override; \
64  sal_Unicode SAL_CALL \
65  transliterateChar2Char( sal_Unicode inChar) \
66  override; \
67 };
68 
69 TRANSLITERATION_ONETOONE( fullwidthToHalfwidth )
70 TRANSLITERATION_ONETOONE( FULLWIDTHKATAKANA_HALFWIDTHKATAKANA )
71 TRANSLITERATION_ONETOONE( FULLWIDTH_HALFWIDTH_LIKE_ASC )
72 
74 {
75 public:
77  OUString
78  transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override;
79 };
81 {
82 public:
84  OUString
85  transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override;
86 };
88 {
89 public:
91  OUString
92  transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) override;
93 };
94 
95 #undef TRANSLITERATION_ONETOONE
96 
97 #define TRANSLITERATION_ONETOONE( name ) \
98 class name final : public transliteration_OneToOne \
99 { \
100 public: \
101  name (); \
102 };
103 
104 TRANSLITERATION_ONETOONE(hiraganaToKatakana)
105 TRANSLITERATION_ONETOONE(katakanaToHiragana)
106 TRANSLITERATION_ONETOONE(largeToSmall_ja_JP)
107 TRANSLITERATION_ONETOONE(smallToLarge_ja_JP)
108 
109 #undef TRANSLITERATION_ONETOONE
110 
111 }
112 
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString transliterateImpl(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > *pOffset) 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
sal_Unicode(* TransFunc)(const sal_Unicode)
css::uno::Sequence< OUString > SAL_CALL transliterateRange(const OUString &str1, const OUString &str2) override
sal_uInt16 sal_Unicode
int nCount
unsigned char sal_Bool
Constant values shared between i18npool and, for example, the number formatter.
#define TRANSLITERATION_ONETOONE(name)
OUString transliterateImpl(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > *pOffset) override
OUString transliterateImpl(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > *pOffset) override
sal_Unicode SAL_CALL transliterateChar2Char(sal_Unicode inChar) override
OUString foldingImpl(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > *pOffset) override