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_ONETOONE_H_
20 : #define _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
21 :
22 : #include <transliteration_commonclass.hxx>
23 : #include <i18nutil/oneToOneMapping.hxx>
24 :
25 : namespace com { namespace sun { namespace star { namespace i18n {
26 :
27 : typedef sal_Unicode (*TransFunc)(const sal_Unicode);
28 :
29 0 : class transliteration_OneToOne : public transliteration_commonclass
30 : {
31 : public:
32 : OUString SAL_CALL
33 : transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset )
34 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
35 :
36 : sal_Unicode SAL_CALL
37 : transliterateChar2Char( sal_Unicode inChar)
38 : throw(com::sun::star::uno::RuntimeException,
39 : com::sun::star::i18n::MultipleCharsOutputException, std::exception) SAL_OVERRIDE;
40 :
41 : // Methods which are shared.
42 : sal_Int16 SAL_CALL getType() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
43 :
44 : OUString SAL_CALL
45 : folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset)
46 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
47 :
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(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
52 :
53 : com::sun::star::uno::Sequence< OUString > SAL_CALL
54 : transliterateRange( const OUString& str1, const OUString& str2 )
55 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
56 :
57 : protected:
58 : TransFunc func;
59 : oneToOneMapping *table;
60 : };
61 :
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, com::sun::star::uno::Sequence< sal_Int32 >& offset ) \
69 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; \
70 : sal_Unicode SAL_CALL \
71 : transliterateChar2Char( sal_Unicode inChar) \
72 : throw(com::sun::star::uno::RuntimeException, \
73 : com::sun::star::i18n::MultipleCharsOutputException, std::exception) SAL_OVERRIDE; \
74 : };
75 :
76 : #if defined( TRANSLITERATION_fullwidthToHalfwidth ) || defined( TRANSLITERATION_ALL )
77 0 : TRANSLITERATION_ONETOONE( fullwidthToHalfwidth )
78 : #endif
79 : #if defined( TRANSLITERATION_halfwidthToFullwidth ) || defined( TRANSLITERATION_ALL )
80 0 : TRANSLITERATION_ONETOONE(halfwidthToFullwidth)
81 : #endif
82 : #if defined( TRANSLITERATION_fullwidthKatakanaToHalfwidthKatakana ) || defined( TRANSLITERATION_ALL )
83 0 : TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana )
84 : #endif
85 : #if defined( TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana ) || defined( TRANSLITERATION_ALL )
86 0 : TRANSLITERATION_ONETOONE(halfwidthKatakanaToFullwidthKatakana)
87 : #endif
88 : #if defined( TRANSLITERATION_fullwidthToHalfwidthLikeASC ) || defined( TRANSLITERATION_ALL )
89 0 : TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC )
90 : #endif
91 : #if defined( TRANSLITERATION_halfwidthToFullwidthLikeJIS ) || defined( TRANSLITERATION_ALL )
92 0 : TRANSLITERATION_ONETOONE( halfwidthToFullwidthLikeJIS )
93 : #endif
94 : #undef TRANSLITERATION_ONETOONE
95 :
96 : #define TRANSLITERATION_ONETOONE( name ) \
97 : class name : public transliteration_OneToOne \
98 : { \
99 : public: \
100 : name (); \
101 : };
102 :
103 : #if defined( TRANSLITERATION_hiraganaToKatakana ) || defined( TRANSLITERATION_ALL )
104 0 : TRANSLITERATION_ONETOONE(hiraganaToKatakana)
105 : #endif
106 : #if defined( TRANSLITERATION_katakanaToHiragana ) || defined( TRANSLITERATION_ALL )
107 0 : TRANSLITERATION_ONETOONE(katakanaToHiragana)
108 : #endif
109 : #if defined( TRANSLITERATION_largeToSmall_ja_JP ) || defined( TRANSLITERATION_ALL )
110 0 : TRANSLITERATION_ONETOONE(largeToSmall_ja_JP)
111 : #endif
112 : #if defined( TRANSLITERATION_smallToLarge_ja_JP ) || defined( TRANSLITERATION_ALL )
113 0 : TRANSLITERATION_ONETOONE(smallToLarge_ja_JP)
114 : #endif
115 : #undef TRANSLITERATION_ONETOONE
116 :
117 : } } } }
118 :
119 : #endif // _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
120 :
121 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|