Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / i18npool / inc / transliteration_OneToOne.hxx
blob2ef7c973481c06a0aa13f7feac715da278fd35e7
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_ONETOONE_HXX
20 #define INCLUDED_I18NPOOL_INC_TRANSLITERATION_ONETOONE_HXX
22 #include <transliteration_commonclass.hxx>
23 #include <i18nutil/oneToOneMapping.hxx>
25 namespace com { namespace sun { namespace star { namespace i18n {
27 typedef sal_Unicode (*TransFunc)(const sal_Unicode);
29 class transliteration_OneToOne : public transliteration_commonclass
31 public:
32 OUString SAL_CALL
33 transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset )
34 throw(css::uno::RuntimeException, std::exception) override;
36 sal_Unicode SAL_CALL
37 transliterateChar2Char( sal_Unicode inChar)
38 throw(css::uno::RuntimeException,
39 css::i18n::MultipleCharsOutputException, std::exception) override;
41 // Methods which are shared.
42 sal_Int16 SAL_CALL getType() throw(css::uno::RuntimeException, std::exception) override;
44 OUString SAL_CALL
45 folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset)
46 throw(css::uno::RuntimeException, std::exception) override;
48 sal_Bool SAL_CALL
49 equals( const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1,
50 const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 )
51 throw(css::uno::RuntimeException, std::exception) override;
53 css::uno::Sequence< OUString > SAL_CALL
54 transliterateRange( const OUString& str1, const OUString& str2 )
55 throw(css::uno::RuntimeException, std::exception) override;
57 protected:
58 TransFunc func;
59 oneToOneMapping *table;
62 #define TRANSLITERATION_ONETOONE( name ) \
63 class name : public transliteration_OneToOne \
64 { \
65 public: \
66 name (); \
67 OUString SAL_CALL \
68 transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) \
69 throw(css::uno::RuntimeException, std::exception) override; \
70 sal_Unicode SAL_CALL \
71 transliterateChar2Char( sal_Unicode inChar) \
72 throw(css::uno::RuntimeException, \
73 css::i18n::MultipleCharsOutputException, std::exception) override; \
76 TRANSLITERATION_ONETOONE( fullwidthToHalfwidth )
77 TRANSLITERATION_ONETOONE(halfwidthToFullwidth)
78 TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana )
79 TRANSLITERATION_ONETOONE(halfwidthKatakanaToFullwidthKatakana)
80 TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC )
81 TRANSLITERATION_ONETOONE( halfwidthToFullwidthLikeJIS )
83 #undef TRANSLITERATION_ONETOONE
85 #define TRANSLITERATION_ONETOONE( name ) \
86 class name : public transliteration_OneToOne \
87 { \
88 public: \
89 name (); \
92 TRANSLITERATION_ONETOONE(hiraganaToKatakana)
93 TRANSLITERATION_ONETOONE(katakanaToHiragana)
94 TRANSLITERATION_ONETOONE(largeToSmall_ja_JP)
95 TRANSLITERATION_ONETOONE(smallToLarge_ja_JP)
97 #undef TRANSLITERATION_ONETOONE
99 } } } }
101 #endif // INCLUDED_I18NPOOL_INC_TRANSLITERATION_ONETOONE_HXX
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */