1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski 
24*b1cdbd2cSJim Jagielski // MARKER(update_precomp.py): autogen include statement, do not remove
25*b1cdbd2cSJim Jagielski #include "precompiled_i18npool.hxx"
26*b1cdbd2cSJim Jagielski 
27*b1cdbd2cSJim Jagielski // prevent internal compiler error with MSVC6SP3
28*b1cdbd2cSJim Jagielski #include <utility>
29*b1cdbd2cSJim Jagielski 
30*b1cdbd2cSJim Jagielski #include <transliteration_OneToOne.hxx>
31*b1cdbd2cSJim Jagielski 
32*b1cdbd2cSJim Jagielski using namespace com::sun::star::uno;
33*b1cdbd2cSJim Jagielski using namespace rtl;
34*b1cdbd2cSJim Jagielski 
35*b1cdbd2cSJim Jagielski namespace com { namespace sun { namespace star { namespace i18n {
36*b1cdbd2cSJim Jagielski 
getType()37*b1cdbd2cSJim Jagielski sal_Int16 SAL_CALL transliteration_OneToOne::getType() throw(RuntimeException)
38*b1cdbd2cSJim Jagielski {
39*b1cdbd2cSJim Jagielski         // This type is also defined in com/sun/star/util/TransliterationType.hdl
40*b1cdbd2cSJim Jagielski         return TransliterationType::ONE_TO_ONE;
41*b1cdbd2cSJim Jagielski }
42*b1cdbd2cSJim Jagielski 
43*b1cdbd2cSJim Jagielski OUString SAL_CALL
folding(const OUString &,sal_Int32,sal_Int32,Sequence<sal_Int32> &)44*b1cdbd2cSJim Jagielski transliteration_OneToOne::folding( const OUString& /*inStr*/, sal_Int32 /*startPos*/,
45*b1cdbd2cSJim Jagielski         sal_Int32 /*nCount*/, Sequence< sal_Int32 >& /*offset*/) throw(RuntimeException)
46*b1cdbd2cSJim Jagielski {
47*b1cdbd2cSJim Jagielski         throw RuntimeException();
48*b1cdbd2cSJim Jagielski }
49*b1cdbd2cSJim Jagielski 
50*b1cdbd2cSJim Jagielski sal_Bool SAL_CALL
equals(const OUString &,sal_Int32,sal_Int32,sal_Int32 &,const OUString &,sal_Int32,sal_Int32,sal_Int32 &)51*b1cdbd2cSJim Jagielski transliteration_OneToOne::equals( const OUString& /*str1*/, sal_Int32 /*pos1*/, sal_Int32 /*nCount1*/,
52*b1cdbd2cSJim Jagielski         sal_Int32& /*nMatch1*/, const OUString& /*str2*/, sal_Int32 /*pos2*/, sal_Int32 /*nCount2*/, sal_Int32& /*nMatch2*/ )
53*b1cdbd2cSJim Jagielski         throw(RuntimeException)
54*b1cdbd2cSJim Jagielski {
55*b1cdbd2cSJim Jagielski     throw RuntimeException();
56*b1cdbd2cSJim Jagielski }
57*b1cdbd2cSJim Jagielski 
58*b1cdbd2cSJim Jagielski Sequence< OUString > SAL_CALL
transliterateRange(const OUString &,const OUString &)59*b1cdbd2cSJim Jagielski transliteration_OneToOne::transliterateRange( const OUString& /*str1*/, const OUString& /*str2*/ )
60*b1cdbd2cSJim Jagielski         throw(RuntimeException)
61*b1cdbd2cSJim Jagielski {
62*b1cdbd2cSJim Jagielski     throw RuntimeException();
63*b1cdbd2cSJim Jagielski }
64*b1cdbd2cSJim Jagielski 
65*b1cdbd2cSJim Jagielski OUString SAL_CALL
transliterate(const OUString & inStr,sal_Int32 startPos,sal_Int32 nCount,Sequence<sal_Int32> & offset)66*b1cdbd2cSJim Jagielski transliteration_OneToOne::transliterate( const OUString& inStr, sal_Int32 startPos,
67*b1cdbd2cSJim Jagielski     sal_Int32 nCount, Sequence< sal_Int32 >& offset)
68*b1cdbd2cSJim Jagielski     throw(RuntimeException)
69*b1cdbd2cSJim Jagielski {
70*b1cdbd2cSJim Jagielski     // Create a string buffer which can hold nCount + 1 characters.
71*b1cdbd2cSJim Jagielski     // The reference count is 0 now.
72*b1cdbd2cSJim Jagielski     rtl_uString * newStr = x_rtl_uString_new_WithLength( nCount ); // defined in x_rtl_ustring.h
73*b1cdbd2cSJim Jagielski     sal_Unicode * dst = newStr->buffer;
74*b1cdbd2cSJim Jagielski     const sal_Unicode * src = inStr.getStr() + startPos;
75*b1cdbd2cSJim Jagielski 
76*b1cdbd2cSJim Jagielski     // Allocate nCount length to offset argument.
77*b1cdbd2cSJim Jagielski     sal_Int32 *p = 0;
78*b1cdbd2cSJim Jagielski 	sal_Int32 position = 0;
79*b1cdbd2cSJim Jagielski     if (useOffset) {
80*b1cdbd2cSJim Jagielski         offset.realloc( nCount );
81*b1cdbd2cSJim Jagielski         p = offset.getArray();
82*b1cdbd2cSJim Jagielski         position = startPos;
83*b1cdbd2cSJim Jagielski     }
84*b1cdbd2cSJim Jagielski 
85*b1cdbd2cSJim Jagielski     // Translation
86*b1cdbd2cSJim Jagielski     while (nCount -- > 0) {
87*b1cdbd2cSJim Jagielski     sal_Unicode c = *src++;
88*b1cdbd2cSJim Jagielski     *dst ++ = func ? func( c) : (*table)[ c ];
89*b1cdbd2cSJim Jagielski     if (useOffset)
90*b1cdbd2cSJim Jagielski         *p ++ = position ++;
91*b1cdbd2cSJim Jagielski     }
92*b1cdbd2cSJim Jagielski     *dst = (sal_Unicode) 0;
93*b1cdbd2cSJim Jagielski 
94*b1cdbd2cSJim Jagielski     return OUString( newStr, SAL_NO_ACQUIRE ); // take over ownership of <newStr>
95*b1cdbd2cSJim Jagielski }
96*b1cdbd2cSJim Jagielski 
97*b1cdbd2cSJim Jagielski sal_Unicode SAL_CALL
transliterateChar2Char(sal_Unicode inChar)98*b1cdbd2cSJim Jagielski transliteration_OneToOne::transliterateChar2Char( sal_Unicode inChar) throw(RuntimeException, MultipleCharsOutputException)
99*b1cdbd2cSJim Jagielski {
100*b1cdbd2cSJim Jagielski     return func ? func( inChar) : (*table)[ inChar ];
101*b1cdbd2cSJim Jagielski }
102*b1cdbd2cSJim Jagielski 
103*b1cdbd2cSJim Jagielski } } } }
104*b1cdbd2cSJim Jagielski 
105