Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / i18npool / inc / transliteration_OneToOne.hxx
blob18596822e393befa9531609684f9dfa946c229e2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
29 #define _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
31 #include <transliteration_commonclass.hxx>
32 #include <i18nutil/oneToOneMapping.hxx>
34 namespace com { namespace sun { namespace star { namespace i18n {
36 typedef sal_Unicode (*TransFunc)(const sal_Unicode);
38 class transliteration_OneToOne : public transliteration_commonclass
40 public:
41 rtl::OUString SAL_CALL
42 transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset )
43 throw(com::sun::star::uno::RuntimeException);
45 sal_Unicode SAL_CALL
46 transliterateChar2Char( sal_Unicode inChar)
47 throw(com::sun::star::uno::RuntimeException,
48 com::sun::star::i18n::MultipleCharsOutputException);
50 // Methods which are shared.
51 sal_Int16 SAL_CALL getType() throw(com::sun::star::uno::RuntimeException);
53 rtl::OUString SAL_CALL
54 folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset)
55 throw(com::sun::star::uno::RuntimeException);
57 sal_Bool SAL_CALL
58 equals( const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1,
59 const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 )
60 throw(com::sun::star::uno::RuntimeException);
62 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
63 transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2 )
64 throw(com::sun::star::uno::RuntimeException);
66 protected:
67 TransFunc func;
68 oneToOneMapping *table;
71 #define TRANSLITERATION_ONETOONE( name ) \
72 class name : public transliteration_OneToOne \
73 { \
74 public: \
75 name (); \
76 rtl::OUString SAL_CALL \
77 transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) \
78 throw(com::sun::star::uno::RuntimeException); \
79 sal_Unicode SAL_CALL \
80 transliterateChar2Char( sal_Unicode inChar) \
81 throw(com::sun::star::uno::RuntimeException, \
82 com::sun::star::i18n::MultipleCharsOutputException); \
85 #if defined( TRANSLITERATION_fullwidthToHalfwidth ) || defined( TRANSLITERATION_ALL )
86 TRANSLITERATION_ONETOONE( fullwidthToHalfwidth )
87 #endif
88 #if defined( TRANSLITERATION_halfwidthToFullwidth ) || defined( TRANSLITERATION_ALL )
89 TRANSLITERATION_ONETOONE(halfwidthToFullwidth)
90 #endif
91 #if defined( TRANSLITERATION_fullwidthKatakanaToHalfwidthKatakana ) || defined( TRANSLITERATION_ALL )
92 TRANSLITERATION_ONETOONE( fullwidthKatakanaToHalfwidthKatakana )
93 #endif
94 #if defined( TRANSLITERATION_halfwidthKatakanaToFullwidthKatakana ) || defined( TRANSLITERATION_ALL )
95 TRANSLITERATION_ONETOONE(halfwidthKatakanaToFullwidthKatakana)
96 #endif
97 #if defined( TRANSLITERATION_fullwidthToHalfwidthLikeASC ) || defined( TRANSLITERATION_ALL )
98 TRANSLITERATION_ONETOONE( fullwidthToHalfwidthLikeASC )
99 #endif
100 #if defined( TRANSLITERATION_halfwidthToFullwidthLikeJIS ) || defined( TRANSLITERATION_ALL )
101 TRANSLITERATION_ONETOONE( halfwidthToFullwidthLikeJIS )
102 #endif
103 #undef TRANSLITERATION_ONETOONE
105 #define TRANSLITERATION_ONETOONE( name ) \
106 class name : public transliteration_OneToOne \
108 public: \
109 name (); \
112 #if defined( TRANSLITERATION_hiraganaToKatakana ) || defined( TRANSLITERATION_ALL )
113 TRANSLITERATION_ONETOONE(hiraganaToKatakana)
114 #endif
115 #if defined( TRANSLITERATION_katakanaToHiragana ) || defined( TRANSLITERATION_ALL )
116 TRANSLITERATION_ONETOONE(katakanaToHiragana)
117 #endif
118 #if defined( TRANSLITERATION_largeToSmall_ja_JP ) || defined( TRANSLITERATION_ALL )
119 TRANSLITERATION_ONETOONE(largeToSmall_ja_JP)
120 #endif
121 #if defined( TRANSLITERATION_smallToLarge_ja_JP ) || defined( TRANSLITERATION_ALL )
122 TRANSLITERATION_ONETOONE(smallToLarge_ja_JP)
123 #endif
124 #undef TRANSLITERATION_ONETOONE
126 } } } }
128 #endif // _I18N_TRANSLITERATION_TRANSLITERATION_ONETOONE_H_
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */