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 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_idl.hxx" 26 27 /****************** I N C L U D E S **************************************/ 28 #include <ctype.h> 29 #include <string.h> 30 31 #ifndef _TABLE_HXX //autogen 32 #include <tools/table.hxx> 33 #endif 34 35 #include <char.hxx> 36 37 /****************** D A T E N ********************************************/ 38 static unsigned char EqualTab[ 256 ] = { 39 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 40 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 41 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 42 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 44 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 45 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 46 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 47 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 48 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 49 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 50 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 51 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 52 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 53 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 54 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 55 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 56 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 57 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 58 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 59 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 60 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 61 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 62 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 63 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 64 250, 251, 252, 253, 254, 255 }; 65 66 67 /************************************************************************* 68 |* 69 |* RscChar::GetTable() 70 |* 71 |* Beschreibung 72 |* Ersterstellung MM 08.08.91 73 |* Letzte Aenderung MM 08.08.91 74 |* 75 *************************************************************************/ 76 Table * pCharTable = NULL; 77 unsigned char * pChange = EqualTab; 78 char * SvChar::GetTable( CharSet nSource , CharSet nDest ) 79 { 80 if( nSource == nDest ) 81 return (char *)EqualTab; 82 83 if( !pCharTable ) 84 pCharTable = new Table(); 85 86 sal_uInt8 * pSet; 87 pSet = (sal_uInt8 *)pCharTable->Get( ((sal_uLong)nSource << 16) + (sal_uLong)nDest ); 88 89 if( !pSet ) 90 { 91 pSet = new sal_uInt8[ 256 ]; 92 memcpy( pSet, EqualTab, sizeof( EqualTab ) ); 93 for( sal_uInt16 i = 128; i < 256; i++ ) 94 { 95 char c = ByteString::Convert( pSet[i], nSource, nDest ); 96 if( c ) 97 pSet[ i ] = (sal_uInt8)c; 98 } 99 pCharTable->Insert( ((sal_uLong)nSource << 16) + (sal_uLong)nDest, pSet ); 100 } 101 102 return (char *)pSet; 103 }; 104