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