LCOV - code coverage report
Current view: top level - i18npool/source/transliteration - transliteration_OneToOne.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 17 27 63.0 %
Date: 2014-11-03 Functions: 1 6 16.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <transliteration_OneToOne.hxx>
      21             : 
      22             : using namespace com::sun::star::uno;
      23             : 
      24             : namespace com { namespace sun { namespace star { namespace i18n {
      25             : 
      26           0 : sal_Int16 SAL_CALL transliteration_OneToOne::getType() throw(RuntimeException, std::exception)
      27             : {
      28             :         // This type is also defined in com/sun/star/util/TransliterationType.hdl
      29           0 :         return TransliterationType::ONE_TO_ONE;
      30             : }
      31             : 
      32             : OUString SAL_CALL
      33           0 : transliteration_OneToOne::folding( const OUString& /*inStr*/, sal_Int32 /*startPos*/,
      34             :         sal_Int32 /*nCount*/, Sequence< sal_Int32 >& /*offset*/) throw(RuntimeException, std::exception)
      35             : {
      36           0 :         throw RuntimeException();
      37             : }
      38             : 
      39             : sal_Bool SAL_CALL
      40           0 : transliteration_OneToOne::equals( const OUString& /*str1*/, sal_Int32 /*pos1*/, sal_Int32 /*nCount1*/,
      41             :         sal_Int32& /*nMatch1*/, const OUString& /*str2*/, sal_Int32 /*pos2*/, sal_Int32 /*nCount2*/, sal_Int32& /*nMatch2*/ )
      42             :         throw(RuntimeException, std::exception)
      43             : {
      44           0 :     throw RuntimeException();
      45             : }
      46             : 
      47             : Sequence< OUString > SAL_CALL
      48           0 : transliteration_OneToOne::transliterateRange( const OUString& /*str1*/, const OUString& /*str2*/ )
      49             :         throw(RuntimeException, std::exception)
      50             : {
      51           0 :     throw RuntimeException();
      52             : }
      53             : 
      54             : OUString SAL_CALL
      55          28 : transliteration_OneToOne::transliterate( const OUString& inStr, sal_Int32 startPos,
      56             :     sal_Int32 nCount, Sequence< sal_Int32 >& offset)
      57             :     throw(RuntimeException, std::exception)
      58             : {
      59             :     // Create a string buffer which can hold nCount + 1 characters.
      60             :     // The reference count is 1 now.
      61          28 :     rtl_uString * newStr = rtl_uString_alloc(nCount);
      62          28 :     sal_Unicode * dst = newStr->buffer;
      63          28 :     const sal_Unicode * src = inStr.getStr() + startPos;
      64             : 
      65             :     // Allocate nCount length to offset argument.
      66          28 :     sal_Int32 *p = 0;
      67          28 :     sal_Int32 position = 0;
      68          28 :     if (useOffset) {
      69           2 :         offset.realloc( nCount );
      70           2 :         p = offset.getArray();
      71           2 :         position = startPos;
      72             :     }
      73             : 
      74             :     // Translation
      75         420 :     while (nCount -- > 0) {
      76         364 :     sal_Unicode c = *src++;
      77         364 :     *dst ++ = func ? func( c) : (*table)[ c ];
      78         364 :     if (useOffset)
      79          12 :         *p ++ = position ++;
      80             :     }
      81          28 :     *dst = (sal_Unicode) 0;
      82             : 
      83          28 :     return OUString(newStr, SAL_NO_ACQUIRE); // take ownership
      84             : }
      85             : 
      86             : sal_Unicode SAL_CALL
      87           0 : transliteration_OneToOne::transliterateChar2Char( sal_Unicode inChar) throw(RuntimeException, MultipleCharsOutputException, std::exception)
      88             : {
      89           0 :     return func ? func( inChar) : (*table)[ inChar ];
      90             : }
      91             : 
      92             : } } } }
      93             : 
      94             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10