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

Generated by: LCOV version 1.10