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 INCLUDED_I18NPOOL_INC_TRANSLITERATION_ONETOONE_HXX
20 : #define INCLUDED_I18NPOOL_INC_TRANSLITERATION_ONETOONE_HXX
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 56 : 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 22 : TRANSLITERATION_ONETOONE( fullwidthToHalfwidth )
77 0 : TRANSLITERATION_ONETOONE(halfwidthToFullwidth)
78 0 : TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana )
79 0 : TRANSLITERATION_ONETOONE(halfwidthKatakanaToFullwidthKatakana)
80 4 : TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC )
81 4 : TRANSLITERATION_ONETOONE( halfwidthToFullwidthLikeJIS )
82 :
83 : #undef TRANSLITERATION_ONETOONE
84 :
85 : #define TRANSLITERATION_ONETOONE( name ) \
86 : class name : public transliteration_OneToOne \
87 : { \
88 : public: \
89 : name (); \
90 : };
91 :
92 4 : TRANSLITERATION_ONETOONE(hiraganaToKatakana)
93 0 : TRANSLITERATION_ONETOONE(katakanaToHiragana)
94 0 : TRANSLITERATION_ONETOONE(largeToSmall_ja_JP)
95 0 : TRANSLITERATION_ONETOONE(smallToLarge_ja_JP)
96 :
97 : #undef TRANSLITERATION_ONETOONE
98 :
99 : } } } }
100 :
101 : #endif // INCLUDED_I18NPOOL_INC_TRANSLITERATION_ONETOONE_HXX
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|