1*584b9f7cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*584b9f7cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*584b9f7cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*584b9f7cSAndrew Rist  * distributed with this work for additional information
6*584b9f7cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*584b9f7cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*584b9f7cSAndrew Rist  * "License"); you may not use this file except in compliance
9*584b9f7cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*584b9f7cSAndrew Rist  *
11*584b9f7cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*584b9f7cSAndrew Rist  *
13*584b9f7cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*584b9f7cSAndrew Rist  * software distributed under the License is distributed on an
15*584b9f7cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*584b9f7cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*584b9f7cSAndrew Rist  * specific language governing permissions and limitations
18*584b9f7cSAndrew Rist  * under the License.
19*584b9f7cSAndrew Rist  *
20*584b9f7cSAndrew Rist  *************************************************************/
21*584b9f7cSAndrew Rist 
22*584b9f7cSAndrew Rist 
23cdf0e10cSrcweir #ifndef INCLUDED_I18NUTIL_CASEFOLDING_HXX
24cdf0e10cSrcweir #define INCLUDED_I18NUTIL_CASEFOLDING_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <sal/types.h>
27cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModules.hpp>
28cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp>
29cdf0e10cSrcweir #include <com/sun/star/uno/RuntimeException.hpp>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace i18n {
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #define MappingTypeLowerToUpper     (1 << 0)  // Upper to Lower mapping
34cdf0e10cSrcweir #define MappingTypeUpperToLower     (1 << 1)  // Lower to Upper mapping
35cdf0e10cSrcweir #define MappingTypeToUpper          (1 << 2)  // to Upper mapping
36cdf0e10cSrcweir #define MappingTypeToLower          (1 << 3)  // to Lower mapping
37cdf0e10cSrcweir #define MappingTypeToTitle          (1 << 4)  // to Title mapping
38cdf0e10cSrcweir #define MappingTypeSimpleFolding    (1 << 5)  // Simple Case Folding
39cdf0e10cSrcweir #define MappingTypeFullFolding      (1 << 6)  // Full Case Folding
40cdf0e10cSrcweir #define MappingTypeMask (MappingTypeLowerToUpper|MappingTypeUpperToLower|\
41cdf0e10cSrcweir             MappingTypeToUpper|MappingTypeToLower|MappingTypeToTitle|\
42cdf0e10cSrcweir             MappingTypeSimpleFolding|MappingTypeFullFolding)
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #define ValueTypeNotValue           (1 << 7)  // Value field is an address
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #define CasedLetter     (MappingTypeMask)  // for final sigmar
47cdf0e10cSrcweir 
48cdf0e10cSrcweir struct Value
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 	sal_uInt8   type;
51cdf0e10cSrcweir 	sal_uInt16  value;  // value or address, depend on the type
52cdf0e10cSrcweir };
53cdf0e10cSrcweir 
54cdf0e10cSrcweir struct Mapping
55cdf0e10cSrcweir {
56cdf0e10cSrcweir 	sal_uInt8   type;
57cdf0e10cSrcweir 	sal_Int8    nmap;
58cdf0e10cSrcweir #define NMAPPINGMAX 3
59cdf0e10cSrcweir 	sal_Unicode map[NMAPPINGMAX];
60cdf0e10cSrcweir };      // for Unconditional mapping
61cdf0e10cSrcweir 
62cdf0e10cSrcweir struct MappingElement
63cdf0e10cSrcweir {
MappingElementcom::sun::star::i18n::MappingElement64cdf0e10cSrcweir 	MappingElement() {element.nmap = current = 0;}
65cdf0e10cSrcweir 	Mapping element;
66cdf0e10cSrcweir 	sal_Int8 current;
67cdf0e10cSrcweir };
68cdf0e10cSrcweir 
69cdf0e10cSrcweir class casefolding
70cdf0e10cSrcweir {
71cdf0e10cSrcweir public:
72cdf0e10cSrcweir 	static Mapping& getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, com::sun::star::lang::Locale& aLocale, sal_uInt8 nMappingType) throw (com::sun::star::uno::RuntimeException);
73cdf0e10cSrcweir 	static Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, com::sun::star::lang::Locale& aLocale, sal_uInt8 nMappingType) throw (com::sun::star::uno::RuntimeException);
74cdf0e10cSrcweir 	static sal_Unicode getNextChar(const sal_Unicode *str, sal_Int32& idx, sal_Int32 len, MappingElement& e, com::sun::star::lang::Locale& aLocale,sal_uInt8 nMappingtype, TransliterationModules moduleLoaded) throw (com::sun::star::uno::RuntimeException);
75cdf0e10cSrcweir 
76cdf0e10cSrcweir };
77cdf0e10cSrcweir 
78cdf0e10cSrcweir } } } }
79cdf0e10cSrcweir 
80cdf0e10cSrcweir #endif
81