LCOV - code coverage report
Current view: top level - i18npool/inc - characterclassificationImpl.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 7 7 100.0 %
Date: 2015-06-13 12:38:46 Functions: 3 3 100.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             : #ifndef INCLUDED_I18NPOOL_INC_CHARACTERCLASSIFICATIONIMPL_HXX
      20             : #define INCLUDED_I18NPOOL_INC_CHARACTERCLASSIFICATIONIMPL_HXX
      21             : 
      22             : #include <com/sun/star/i18n/XCharacterClassification.hpp>
      23             : #include <cppuhelper/implbase2.hxx>
      24             : #include <vector>
      25             : #include <com/sun/star/i18n/KCharacterType.hpp>
      26             : #include <com/sun/star/lang/XServiceInfo.hpp>
      27             : #include <com/sun/star/uno/XComponentContext.hpp>
      28             : 
      29             : namespace com { namespace sun { namespace star { namespace i18n {
      30             : 
      31             : class CharacterClassificationImpl : public cppu::WeakImplHelper2
      32             : <
      33             :     XCharacterClassification,
      34             :     com::sun::star::lang::XServiceInfo
      35             : >
      36             : {
      37             : public:
      38             : 
      39             :     CharacterClassificationImpl( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext );
      40             :     virtual ~CharacterClassificationImpl();
      41             : 
      42             :     virtual OUString SAL_CALL toUpper( const OUString& Text,
      43             :         sal_Int32 nPos, sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale )
      44             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      45             :     virtual OUString SAL_CALL toLower( const OUString& Text,
      46             :         sal_Int32 nPos, sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale )
      47             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      48             :     virtual OUString SAL_CALL toTitle( const OUString& Text, sal_Int32 nPos,
      49             :         sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale )
      50             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      51             :     virtual sal_Int16 SAL_CALL getType( const OUString& Text, sal_Int32 nPos )
      52             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      53             :     virtual sal_Int16 SAL_CALL getCharacterDirection( const OUString& Text, sal_Int32 nPos )
      54             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      55             :     virtual sal_Int16 SAL_CALL getScript( const OUString& Text, sal_Int32 nPos )
      56             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      57             :     virtual sal_Int32 SAL_CALL getCharacterType( const OUString& text, sal_Int32 nPos,
      58             :         const com::sun::star::lang::Locale& rLocale )
      59             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      60             :     virtual sal_Int32 SAL_CALL getStringType( const OUString& text, sal_Int32 nPos,
      61             :         sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale )
      62             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      63             :     virtual ParseResult SAL_CALL parseAnyToken( const OUString& Text, sal_Int32 nPos,
      64             :         const com::sun::star::lang::Locale& rLocale, sal_Int32 nStartCharFlags,
      65             :         const OUString& userDefinedCharactersStart, sal_Int32 nContCharFlags,
      66             :         const OUString& userDefinedCharactersCont )
      67             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      68             :     virtual ParseResult SAL_CALL parsePredefinedToken( sal_Int32 nTokenType,
      69             :         const OUString& Text, sal_Int32 nPos, const com::sun::star::lang::Locale& rLocale,
      70             :         sal_Int32 nStartCharFlags, const OUString& userDefinedCharactersStart,
      71             :         sal_Int32 nContCharFlags, const OUString& userDefinedCharactersCont )
      72             :         throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      73             : 
      74             :     //XServiceInfo
      75             :     virtual OUString SAL_CALL getImplementationName()
      76             :                 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      77             :     virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
      78             :         throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      79             :     virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
      80             :         throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      81             : 
      82             : private:
      83       77327 :     struct lookupTableItem {
      84       77549 :         lookupTableItem(const com::sun::star::lang::Locale& rLocale, const OUString& rName,
      85             :         com::sun::star::uno::Reference < XCharacterClassification >& rxCI) :
      86       77549 :         aLocale(rLocale), aName(rName), xCI(rxCI) {};
      87             :         com::sun::star::lang::Locale aLocale;
      88             :         OUString aName;
      89             :         com::sun::star::uno::Reference < XCharacterClassification > xCI;
      90   853109376 :         bool SAL_CALL equals(const com::sun::star::lang::Locale& rLocale) {
      91  1706142387 :         return aLocale.Language == rLocale.Language &&
      92  1706142297 :             aLocale.Country == rLocale.Country &&
      93  1706142297 :             aLocale.Variant == rLocale.Variant;
      94             :         };
      95             :     };
      96             :     std::vector<lookupTableItem*> lookupTable;
      97             :     lookupTableItem *cachedItem;
      98             : 
      99             :     com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext;
     100             :     com::sun::star::uno::Reference < XCharacterClassification > xUCI;
     101             : 
     102             :     com::sun::star::uno::Reference < XCharacterClassification > SAL_CALL
     103             :     getLocaleSpecificCharacterClassification(const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException);
     104             :     bool SAL_CALL
     105             :     createLocaleSpecificCharacterClassification(const OUString& serviceName, const com::sun::star::lang::Locale& rLocale);
     106             : 
     107             : };
     108             : 
     109             : } } } }
     110             : 
     111             : #endif
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11