LCOV - code coverage report
Current view: top level - package/source/manifest - UnoRegister.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 16 16 100.0 %
Date: 2012-08-25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 26 46 56.5 %

           Branch data     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 <ManifestReader.hxx>
      21                 :            : #include <ManifestWriter.hxx>
      22                 :            : #include <cppuhelper/factory.hxx>
      23                 :            : #include <com/sun/star/registry/XRegistryKey.hpp>
      24                 :            : #include <osl/diagnose.h>
      25                 :            : #include <ZipPackage.hxx>
      26                 :            : 
      27                 :            : #include <zipfileaccess.hxx>
      28                 :            : 
      29                 :            : using namespace ::com::sun::star;
      30                 :            : using namespace ::com::sun::star::uno;
      31                 :            : using namespace ::com::sun::star::beans;
      32                 :            : using namespace ::com::sun::star::lang;
      33                 :            : using namespace ::com::sun::star::registry;
      34                 :            : using namespace ::com::sun::star::packages;
      35                 :            : using namespace ::com::sun::star::packages::manifest;
      36                 :            : 
      37                 :            : using rtl::OUString;
      38                 :            : 
      39                 :            : /**
      40                 :            :  * This function is called to get service factories for an implementation.
      41                 :            :  * @param pImplName name of implementation
      42                 :            :  * @param pServiceManager generic uno interface providing a service manager to instantiate components
      43                 :            :  * @param pRegistryKey registry data key to read and write component persistent data
      44                 :            :  * @return a component factory (generic uno interface)
      45                 :            :  */
      46                 :        504 : extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL package2_component_getFactory(
      47                 :            :     const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
      48                 :            : {
      49                 :        504 :     void * pRet = 0;
      50                 :            :     uno::Reference< XMultiServiceFactory > xSMgr(
      51         [ +  - ]:        504 :             reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
      52                 :        504 :     uno::Reference< XSingleServiceFactory > xFactory;
      53                 :            : 
      54 [ +  + ][ +  - ]:        504 :     if (ManifestReader::static_getImplementationName().compareToAscii( pImplName ) == 0)
      55 [ +  - ][ +  - ]:        170 :         xFactory = ManifestReader::createServiceFactory ( xSMgr );
      56 [ +  - ][ +  + ]:        334 :     else if (ManifestWriter::static_getImplementationName().compareToAscii( pImplName ) == 0)
      57 [ +  - ][ +  - ]:         31 :         xFactory = ManifestWriter::createServiceFactory ( xSMgr );
      58 [ +  - ][ +  + ]:        303 :     else if (ZipPackage::static_getImplementationName().compareToAscii( pImplName ) == 0)
      59 [ +  - ][ +  - ]:        187 :         xFactory = ZipPackage::createServiceFactory ( xSMgr );
      60 [ +  - ][ +  - ]:        116 :     else if ( OZipFileAccess::impl_staticGetImplementationName().compareToAscii( pImplName ) == 0 )
      61                 :            :         xFactory = ::cppu::createSingleFactory( xSMgr,
      62                 :            :                                            OZipFileAccess::impl_staticGetImplementationName(),
      63                 :            :                                            OZipFileAccess::impl_staticCreateSelfInstance,
      64 [ +  - ][ +  - ]:        116 :                                            OZipFileAccess::impl_staticGetSupportedServiceNames() );
         [ +  - ][ +  - ]
                 [ +  - ]
      65                 :            : 
      66         [ +  - ]:        504 :     if ( xFactory.is() )
      67                 :            :     {
      68         [ +  - ]:        504 :         xFactory->acquire();
      69         [ +  - ]:        504 :         pRet = xFactory.get();
      70                 :            :     }
      71                 :        504 :     return pRet;
      72                 :            : }
      73                 :            : 
      74                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10