LCOV - code coverage report
Current view: top level - i18npool/source/transliteration - fullwidthToHalfwidth.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 51 0.0 %
Date: 2014-04-14 Functions: 0 9 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             : 
      21             : // prevent internal compiler error with MSVC6SP3
      22             : #include <utility>
      23             : 
      24             : #include <i18nutil/widthfolding.hxx>
      25             : #define TRANSLITERATION_fullwidthToHalfwidth
      26             : #define TRANSLITERATION_fullwidthKatakanaToHalfwidthKatakana
      27             : #define TRANSLITERATION_fullwidthToHalfwidthLikeASC
      28             : #include <transliteration_OneToOne.hxx>
      29             : 
      30             : using namespace com::sun::star::uno;
      31             : using namespace com::sun::star::lang;
      32             : 
      33             : 
      34             : namespace com { namespace sun { namespace star { namespace i18n {
      35             : 
      36           0 : fullwidthToHalfwidth::fullwidthToHalfwidth()
      37             : {
      38           0 :     func = (TransFunc) 0;
      39           0 :     table = &widthfolding::getfull2halfTable();
      40           0 :     transliterationName = "fullwidthToHalfwidth";
      41           0 :     implementationName = "com.sun.star.i18n.Transliteration.FULLWIDTH_HALFWIDTH";
      42           0 : }
      43             : 
      44             : /**
      45             :  * Transliterate fullwidth to halfwidth.
      46             :  * The output is a reference of OUString. You MUST delete this object when you do not need to use it any more
      47             :  * The output string contains a transliterated string only, not whole string.
      48             :  */
      49             : OUString SAL_CALL
      50           0 : fullwidthToHalfwidth::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
      51             :   throw(RuntimeException, std::exception)
      52             : {
      53             :     // Decomposition: GA --> KA + voice-mark
      54           0 :     const OUString& newStr = widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, offset, useOffset);
      55             : 
      56             :     // One to One mapping
      57           0 :     useOffset = sal_False;
      58           0 :     const OUString &tmp = transliteration_OneToOne::transliterate( newStr, 0, newStr.getLength(), offset);
      59           0 :     useOffset = sal_True;
      60           0 :     return tmp;
      61             : }
      62             : 
      63             : sal_Unicode SAL_CALL
      64           0 : fullwidthToHalfwidth::transliterateChar2Char( sal_Unicode inChar)
      65             :   throw(RuntimeException, MultipleCharsOutputException, std::exception)
      66             : {
      67           0 :     sal_Unicode newChar = widthfolding::decompose_ja_voiced_sound_marksChar2Char (inChar);
      68           0 :     if (newChar == 0xFFFF)
      69           0 :         throw MultipleCharsOutputException();
      70           0 :     return transliteration_OneToOne::transliterateChar2Char(inChar);
      71             : }
      72             : 
      73           0 : fullwidthKatakanaToHalfwidthKatakana::fullwidthKatakanaToHalfwidthKatakana()
      74             : {
      75           0 :     func = (TransFunc) 0;
      76           0 :     table = &widthfolding::getfullKana2halfKanaTable();
      77           0 :     transliterationName = "fullwidthKatakanaToHalfwidthKatakana";
      78           0 :     implementationName = "com.sun.star.i18n.Transliteration.FULLWIDTHKATAKANA_HALFWIDTHKATAKANA";
      79           0 : }
      80             : 
      81             : /**
      82             :  * Transliterate fullwidth katakana to halfwidth katakana.
      83             :  */
      84             : OUString SAL_CALL
      85           0 : fullwidthKatakanaToHalfwidthKatakana::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
      86             :   throw(RuntimeException, std::exception)
      87             : {
      88             :     // Decomposition: GA --> KA + voice-mark
      89           0 :     const OUString& newStr = widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, offset, useOffset);
      90             : 
      91             :     // One to One mapping
      92           0 :     useOffset = sal_False;
      93           0 :     const OUString &tmp = transliteration_OneToOne::transliterate( newStr, 0, newStr.getLength(), offset);
      94           0 :     useOffset = sal_True;
      95           0 :     return tmp;
      96             : }
      97             : 
      98             : sal_Unicode SAL_CALL
      99           0 : fullwidthKatakanaToHalfwidthKatakana::transliterateChar2Char( sal_Unicode inChar )
     100             :   throw(RuntimeException, MultipleCharsOutputException, std::exception)
     101             : {
     102           0 :     sal_Unicode newChar = widthfolding::decompose_ja_voiced_sound_marksChar2Char (inChar);
     103           0 :     if (newChar == 0xFFFF)
     104           0 :         throw MultipleCharsOutputException();
     105           0 :     return transliteration_OneToOne::transliterateChar2Char(inChar);
     106             : }
     107             : 
     108           0 : fullwidthToHalfwidthLikeASC::fullwidthToHalfwidthLikeASC()
     109             : {
     110           0 :     func = (TransFunc) 0;
     111           0 :     table = &widthfolding::getfull2halfTableForASC();
     112           0 :     transliterationName = "fullwidthToHalfwidthLikeASC";
     113           0 :     implementationName = "com.sun.star.i18n.Transliteration.FULLWIDTH_HALFWIDTH_LIKE_ASC";
     114           0 : }
     115             : 
     116             : /**
     117             :  * Transliterate fullwidth to halfwidth like Excel's ASC function.
     118             :  */
     119             : OUString SAL_CALL
     120           0 : fullwidthToHalfwidthLikeASC::transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
     121             :   throw(RuntimeException, std::exception)
     122             : {
     123             :     // Decomposition: GA --> KA + voice-mark
     124           0 :     const OUString& newStr = widthfolding::decompose_ja_voiced_sound_marks (inStr, startPos, nCount, offset, useOffset);
     125             : 
     126             :     // One to One mapping
     127           0 :     useOffset = sal_False;
     128           0 :     const OUString &tmp = transliteration_OneToOne::transliterate( newStr, 0, newStr.getLength(), offset);
     129           0 :     useOffset = sal_True;
     130             : 
     131           0 :     return tmp;
     132             : }
     133             : 
     134             : sal_Unicode SAL_CALL
     135           0 : fullwidthToHalfwidthLikeASC::transliterateChar2Char( sal_Unicode inChar )
     136             :   throw(RuntimeException, MultipleCharsOutputException, std::exception)
     137             : {
     138           0 :     sal_Unicode newChar = widthfolding::decompose_ja_voiced_sound_marksChar2Char (inChar);
     139           0 :     if (newChar == 0xFFFF)
     140           0 :         throw MultipleCharsOutputException();
     141           0 :     return transliteration_OneToOne::transliterateChar2Char(inChar);
     142             : }
     143             : 
     144             : } } } }
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10