LCOV - code coverage report
Current view: top level - i18npool/source/transliteration - transliteration_commonclass.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 56 0.0 %
Date: 2014-04-14 Functions: 0 14 0.0 %
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_commonclass.hxx>
      21             : #include <com/sun/star/i18n/CollatorOptions.hpp>
      22             : #include <cppuhelper/supportsservice.hxx>
      23             : 
      24             : using namespace ::com::sun::star::uno;
      25             : using namespace ::com::sun::star::lang;
      26             : using namespace ::rtl;
      27             : 
      28             : namespace com { namespace sun { namespace star { namespace i18n {
      29             : 
      30           0 : transliteration_commonclass::transliteration_commonclass()
      31             : {
      32           0 :     transliterationName = "";
      33           0 :     implementationName = "";
      34           0 :     useOffset = sal_True;
      35           0 : }
      36             : 
      37           0 : OUString SAL_CALL transliteration_commonclass::getName() throw(RuntimeException, std::exception)
      38             : {
      39           0 :     return OUString::createFromAscii(transliterationName);
      40             : }
      41             : 
      42           0 : void SAL_CALL transliteration_commonclass::loadModule( TransliterationModules /*modName*/, const Locale& rLocale )
      43             : throw(RuntimeException, std::exception)
      44             : {
      45           0 :     aLocale = rLocale;
      46           0 : }
      47             : 
      48             : 
      49             : void SAL_CALL
      50           0 : transliteration_commonclass::loadModuleNew( const Sequence < TransliterationModulesNew >& /*modName*/, const Locale& /*rLocale*/ )
      51             : throw(RuntimeException, std::exception)
      52             : {
      53           0 :     throw RuntimeException();
      54             : }
      55             : 
      56             : 
      57             : void SAL_CALL
      58           0 : transliteration_commonclass::loadModuleByImplName( const OUString& /*implName*/, const Locale& /*rLocale*/ )
      59             : throw(RuntimeException, std::exception)
      60             : {
      61           0 :     throw RuntimeException();
      62             : }
      63             : 
      64             : void SAL_CALL
      65           0 : transliteration_commonclass::loadModulesByImplNames(const Sequence< OUString >& /*modNamelist*/, const Locale& /*rLocale*/)
      66             : throw(RuntimeException, std::exception)
      67             : {
      68           0 :     throw RuntimeException();
      69             : }
      70             : 
      71             : Sequence< OUString > SAL_CALL
      72           0 : transliteration_commonclass::getAvailableModules( const Locale& /*rLocale*/, sal_Int16 /*sType*/ )
      73             : throw(RuntimeException, std::exception)
      74             : {
      75           0 :     throw RuntimeException();
      76             : }
      77             : 
      78             : sal_Int32 SAL_CALL
      79           0 : transliteration_commonclass::compareSubstring(
      80             :         const OUString& str1, sal_Int32 off1, sal_Int32 len1,
      81             :         const OUString& str2, sal_Int32 off2, sal_Int32 len2)
      82             : throw(RuntimeException, std::exception)
      83             : {
      84           0 :     const sal_Unicode* unistr1 = NULL;
      85           0 :     const sal_Unicode* unistr2 = NULL;
      86             :     sal_uInt32 strlen1;
      87             :     sal_uInt32 strlen2;
      88             : 
      89           0 :     Sequence <sal_Int32> offset1(2*len1);
      90           0 :     Sequence <sal_Int32> offset2(2*len2);
      91             : 
      92           0 :     OUString in_str1 = this->transliterate(str1, off1, len1, offset1);
      93           0 :     OUString in_str2 = this->transliterate(str2, off2, len2, offset2);
      94           0 :     strlen1 = in_str1.getLength();
      95           0 :     strlen2 = in_str2.getLength();
      96           0 :     unistr1 = in_str1.getStr();
      97           0 :     unistr2 = in_str2.getStr();
      98             : 
      99           0 :     while (strlen1 && strlen2)
     100             :     {
     101           0 :         sal_uInt32 ret = *unistr1 - *unistr2;
     102           0 :         if (ret)
     103           0 :             return ret;
     104             : 
     105           0 :         unistr1++;
     106           0 :         unistr2++;
     107           0 :         strlen1--;
     108           0 :         strlen2--;
     109             :     }
     110           0 :     return strlen1 - strlen2;
     111             : }
     112             : 
     113             : sal_Int32 SAL_CALL
     114           0 : transliteration_commonclass::compareString( const OUString& str1, const OUString& str2 ) throw ( RuntimeException, std::exception)
     115             : {
     116           0 :     return( this->compareSubstring(str1, 0, str1.getLength(), str2, 0, str2.getLength()));
     117             : }
     118             : 
     119             : OUString SAL_CALL
     120           0 : transliteration_commonclass::transliterateString2String( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount ) throw(RuntimeException, std::exception)
     121             : {
     122           0 :     Sequence < sal_Int32 > dummy_offset;
     123           0 :     useOffset = sal_False;
     124           0 :     OUString tmpStr = transliterate(inStr, startPos, nCount, dummy_offset);
     125           0 :     useOffset = sal_True;
     126           0 :     return tmpStr;
     127             : }
     128             : 
     129             : OUString SAL_CALL
     130           0 : transliteration_commonclass::transliterateChar2String( sal_Unicode inChar ) throw(RuntimeException, std::exception)
     131             : {
     132           0 :     return transliteration_commonclass::transliterateString2String(OUString(&inChar, 1), 0, 1);
     133             : }
     134             : 
     135           0 : OUString SAL_CALL transliteration_commonclass::getImplementationName() throw( RuntimeException, std::exception )
     136             : {
     137           0 :     return OUString::createFromAscii(implementationName);
     138             : }
     139             : 
     140           0 : sal_Bool SAL_CALL transliteration_commonclass::supportsService(const OUString& rServiceName) throw( RuntimeException, std::exception )
     141             : {
     142           0 :     return cppu::supportsService(this, rServiceName);
     143             : }
     144             : 
     145           0 : Sequence< OUString > SAL_CALL transliteration_commonclass::getSupportedServiceNames() throw( RuntimeException, std::exception )
     146             : {
     147           0 :     Sequence< OUString > aRet(1);
     148           0 :     aRet[0] = "com.sun.star.i18n.Transliteration.l10n";
     149           0 :     return aRet;
     150             : }
     151             : 
     152             : } } } }
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10