LCOV - code coverage report
Current view: top level - i18npool/source/indexentry - indexentrysupplier_ja_phonetic.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 22 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 7 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             : #include <indexentrysupplier_ja_phonetic.hxx>
      22             : #include <data/indexdata_alphanumeric.h>
      23             : #include <data/indexdata_ja_phonetic.h>
      24             : #include <string.h>
      25             : 
      26             : namespace com { namespace sun { namespace star { namespace i18n {
      27             : 
      28           0 : OUString SAL_CALL IndexEntrySupplier_ja_phonetic::getIndexCharacter( const OUString& rIndexEntry,
      29             :     const lang::Locale& /*rLocale*/, const OUString& /*rSortAlgorithm*/ )
      30             :     throw (com::sun::star::uno::RuntimeException, std::exception)
      31             : {
      32           0 :     sal_Unicode ch=rIndexEntry.toChar();
      33           0 :     sal_uInt16 first = idx[ ch >> 8 ];
      34           0 :     if (first == 0xFFFF) {
      35             :         // using alphanumeric index for non-define stirng
      36           0 :         return OUString(&idxStr[(ch & 0xFF00) ? 0 : ch], 1);
      37             :     } else {
      38           0 :         const sal_Unicode *idx2 = strstr(implementationName, "syllable") ? syllable : consonant;
      39           0 :         return OUString(&idx2[ first + (ch & 0xff) ], 1);
      40             :     }
      41             : }
      42             : 
      43           0 : OUString SAL_CALL IndexEntrySupplier_ja_phonetic::getIndexKey( const OUString& IndexEntry,
      44             :     const OUString& PhoneticEntry, const lang::Locale& rLocale )
      45             :     throw (com::sun::star::uno::RuntimeException, std::exception)
      46             : {
      47           0 :     return getIndexCharacter( PhoneticEntry.isEmpty() ? IndexEntry : PhoneticEntry , rLocale, OUString());
      48             : }
      49             : 
      50           0 : sal_Int16 SAL_CALL IndexEntrySupplier_ja_phonetic::compareIndexEntry(
      51             :     const OUString& IndexEntry1, const OUString& PhoneticEntry1, const lang::Locale& rLocale1,
      52             :     const OUString& IndexEntry2, const OUString& PhoneticEntry2, const lang::Locale& rLocale2 )
      53             :     throw (com::sun::star::uno::RuntimeException, std::exception)
      54             : {
      55             :     sal_Int16 result = sal::static_int_cast<sal_Int16>( collator->compareString(
      56             :         IndexEntrySupplier_ja_phonetic::getIndexKey(IndexEntry1, PhoneticEntry1, rLocale1),
      57           0 :         IndexEntrySupplier_ja_phonetic::getIndexKey(IndexEntry2, PhoneticEntry2, rLocale2)) );
      58             : 
      59           0 :     if (result == 0)
      60             :         return IndexEntrySupplier_Common::compareIndexEntry(
      61             :                     IndexEntry1, PhoneticEntry1, rLocale1,
      62           0 :                     IndexEntry2, PhoneticEntry2, rLocale2);
      63           0 :     return result;
      64             : }
      65             : 
      66             : static const sal_Char first[] = "ja_phonetic (alphanumeric first)";
      67           0 : sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable::loadAlgorithm(
      68             :     const com::sun::star::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/,
      69             :     sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException, std::exception)
      70             : {
      71           0 :     return collator->loadCollatorAlgorithm(first, rLocale, collatorOptions) == 0;
      72             : }
      73           0 : sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_consonant::loadAlgorithm(
      74             :     const com::sun::star::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/,
      75             :     sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException, std::exception)
      76             : {
      77           0 :     return collator->loadCollatorAlgorithm(first, rLocale, collatorOptions) == 0;
      78             : }
      79             : 
      80             : static const sal_Char last[] = "ja_phonetic (alphanumeric last)";
      81           0 : sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_syllable::loadAlgorithm(
      82             :     const com::sun::star::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/,
      83             :     sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException, std::exception)
      84             : {
      85           0 :     return collator->loadCollatorAlgorithm(last, rLocale, collatorOptions) == 0;
      86             : }
      87           0 : sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_consonant::loadAlgorithm(
      88             :     const com::sun::star::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/,
      89             :     sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException, std::exception)
      90             : {
      91           0 :     return collator->loadCollatorAlgorithm(last, rLocale, collatorOptions) == 0;
      92             : }
      93             : 
      94             : } } } }
      95             : 
      96             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11