LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/i18npool/inc - characterclassificationImpl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 7 100.0 %
Date: 2013-07-09 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 _I18N_CHARACTERCLASSIFICATIONIMPL_HXX_
      20             : #define _I18N_CHARACTERCLASSIFICATIONIMPL_HXX_
      21             : 
      22             : #include <com/sun/star/i18n/XCharacterClassification.hpp>
      23             : #include <cppuhelper/implbase2.hxx> // helper for implementations
      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);
      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);
      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);
      51             :     virtual sal_Int16 SAL_CALL getType( const OUString& Text, sal_Int32 nPos )
      52             :         throw(com::sun::star::uno::RuntimeException);
      53             :     virtual sal_Int16 SAL_CALL getCharacterDirection( const OUString& Text, sal_Int32 nPos )
      54             :         throw(com::sun::star::uno::RuntimeException);
      55             :     virtual sal_Int16 SAL_CALL getScript( const OUString& Text, sal_Int32 nPos )
      56             :         throw(com::sun::star::uno::RuntimeException);
      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);
      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);
      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);
      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);
      73             : 
      74             :     //XServiceInfo
      75             :     virtual OUString SAL_CALL getImplementationName(void)
      76             :                 throw( com::sun::star::uno::RuntimeException );
      77             :     virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
      78             :         throw( com::sun::star::uno::RuntimeException );
      79             :     virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void)
      80             :         throw( com::sun::star::uno::RuntimeException );
      81             : 
      82             : private:
      83       30349 :     struct lookupTableItem {
      84       30563 :         lookupTableItem(const com::sun::star::lang::Locale& rLocale, const OUString& rName,
      85             :         com::sun::star::uno::Reference < XCharacterClassification >& rxCI) :
      86       30563 :         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     1058100 :         sal_Bool SAL_CALL equals(const com::sun::star::lang::Locale& rLocale) {
      91     2086436 :         return aLocale.Language == rLocale.Language &&
      92     2086393 :             aLocale.Country == rLocale.Country &&
      93     2086393 :             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             :     sal_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.10