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 #include "i18nutil/i18nutildllapi.h" 31 32 namespace com { namespace sun { namespace star { namespace i18n { 33 34 #define MappingTypeLowerToUpper (1 << 0) // Upper to Lower mapping 35 #define MappingTypeUpperToLower (1 << 1) // Lower to Upper mapping 36 #define MappingTypeToUpper (1 << 2) // to Upper mapping 37 #define MappingTypeToLower (1 << 3) // to Lower mapping 38 #define MappingTypeToTitle (1 << 4) // to Title mapping 39 #define MappingTypeSimpleFolding (1 << 5) // Simple Case Folding 40 #define MappingTypeFullFolding (1 << 6) // Full Case Folding 41 #define MappingTypeMask (MappingTypeLowerToUpper|MappingTypeUpperToLower|\ 42 MappingTypeToUpper|MappingTypeToLower|MappingTypeToTitle|\ 43 MappingTypeSimpleFolding|MappingTypeFullFolding) 44 45 #define ValueTypeNotValue (1 << 7) // Value field is an address 46 47 #define CasedLetter (MappingTypeMask) // for final sigmar 48 49 struct Value 50 { 51 sal_uInt8 type; 52 sal_uInt16 value; // value or address, depend on the type 53 }; 54 55 struct Mapping 56 { 57 sal_uInt8 type; 58 sal_Int8 nmap; 59 #define NMAPPINGMAX 3 60 sal_Unicode map[NMAPPINGMAX]; 61 }; // for Unconditional mapping 62 63 struct MappingElement 64 { MappingElementcom::sun::star::i18n::MappingElement65 MappingElement() {element.nmap = current = 0;} 66 Mapping element; 67 sal_Int8 current; 68 }; 69 70 class I18NUTIL_DLLPUBLIC casefolding 71 { 72 public: 73 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); 74 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); 75 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); 76 77 }; 78 79 } } } } 80 81 #endif 82