LCOV - code coverage report
Current view: top level - libreoffice/oox/source/core - fasttokenhandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 17 31 54.8 %
Date: 2012-12-27 Functions: 8 13 61.5 %
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             : #include "oox/core/fasttokenhandler.hxx"
      21             : 
      22             : #include <com/sun/star/uno/XComponentContext.hpp>
      23             : #include "oox/helper/helper.hxx"
      24             : #include "oox/token/tokenmap.hxx"
      25             : 
      26             : namespace oox {
      27             : namespace core {
      28             : 
      29             : // ============================================================================
      30             : 
      31             : using namespace ::com::sun::star::uno;
      32             : 
      33             : using ::rtl::OUString;
      34             : 
      35             : // ============================================================================
      36             : 
      37          14 : OUString SAL_CALL FastTokenHandler_getImplementationName()
      38             : {
      39          14 :     return CREATE_OUSTRING( "com.sun.star.comp.oox.core.FastTokenHandler" );
      40             : }
      41             : 
      42           2 : Sequence< OUString > SAL_CALL FastTokenHandler_getSupportedServiceNames()
      43             : {
      44           2 :     Sequence< OUString > aServiceNames( 1 );
      45           2 :     aServiceNames[ 0 ] = CREATE_OUSTRING( "com.sun.star.xml.sax.FastTokenHandler" );
      46           2 :     return aServiceNames;
      47             : }
      48             : 
      49         151 : Reference< XInterface > SAL_CALL FastTokenHandler_createInstance( const Reference< XComponentContext >& /*rxContext*/ ) throw (Exception)
      50             : {
      51         151 :     return static_cast< ::cppu::OWeakObject* >( new FastTokenHandler );
      52             : }
      53             : 
      54             : // ============================================================================
      55             : 
      56         415 : FastTokenHandler::FastTokenHandler() :
      57         415 :     mrTokenMap( StaticTokenMap::get() )
      58             : {
      59         415 : }
      60             : 
      61         830 : FastTokenHandler::~FastTokenHandler()
      62             : {
      63         830 : }
      64             : 
      65             : // XServiceInfo
      66             : 
      67           0 : OUString SAL_CALL FastTokenHandler::getImplementationName() throw (RuntimeException)
      68             : {
      69           0 :     return FastTokenHandler_getImplementationName();
      70             : }
      71             : 
      72           0 : sal_Bool SAL_CALL FastTokenHandler::supportsService( const OUString& rServiceName ) throw (RuntimeException)
      73             : {
      74           0 :     Sequence< OUString > aServiceNames = FastTokenHandler_getSupportedServiceNames();
      75           0 :     for( sal_Int32 nIndex = 0, nLength = aServiceNames.getLength(); nIndex < nLength; ++nIndex )
      76           0 :         if( aServiceNames[ nIndex ] == rServiceName )
      77           0 :             return sal_True;
      78           0 :     return sal_False;
      79             : }
      80             : 
      81           0 : Sequence< OUString > SAL_CALL FastTokenHandler::getSupportedServiceNames() throw (RuntimeException)
      82             : {
      83           0 :     return FastTokenHandler_getSupportedServiceNames();
      84             : }
      85             : 
      86             : // XFastTokenHandler
      87             : 
      88           0 : sal_Int32 FastTokenHandler::getToken( const OUString& rIdentifier ) throw( RuntimeException )
      89             : {
      90           0 :     return mrTokenMap.getTokenFromUnicode( rIdentifier );
      91             : }
      92             : 
      93           0 : OUString FastTokenHandler::getIdentifier( sal_Int32 nToken ) throw( RuntimeException )
      94             : {
      95           0 :     return mrTokenMap.getUnicodeTokenName( nToken );
      96             : }
      97             : 
      98       25848 : Sequence< sal_Int8 > FastTokenHandler::getUTF8Identifier( sal_Int32 nToken ) throw( RuntimeException )
      99             : {
     100       25848 :     return mrTokenMap.getUtf8TokenName( nToken );
     101             : }
     102             : 
     103       31553 : sal_Int32 FastTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& rIdentifier ) throw( RuntimeException )
     104             : {
     105       31553 :     return mrTokenMap.getTokenFromUtf8( rIdentifier );
     106             : }
     107             : 
     108             : // ============================================================================
     109             : 
     110             : } // namespace core
     111             : } // namespace oox
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10