LCOV - code coverage report
Current view: top level - unoxml/source/service - services.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 19 22 86.4 %
Date: 2014-11-03 Functions: 1 1 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             : 
      20             : #include <osl/mutex.hxx>
      21             : #include <rtl/ustring.hxx>
      22             : #include <com/sun/star/uno/Reference.h>
      23             : #include <com/sun/star/uno/Reference.hxx>
      24             : #include <cppuhelper/interfacecontainer.h>
      25             : #include <cppuhelper/factory.hxx>
      26             : #include <com/sun/star/lang/XServiceInfo.hpp>
      27             : #include <com/sun/star/uno/Exception.hpp>
      28             : #include <com/sun/star/lang/XComponent.hpp>
      29             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      30             : #include <com/sun/star/registry/XRegistryKey.hpp>
      31             : 
      32             : #include "../dom/documentbuilder.hxx"
      33             : #include "../dom/saxbuilder.hxx"
      34             : #include "../xpath/xpathapi.hxx"
      35             : #include "../events/testlistener.hxx"
      36             : 
      37             : using namespace ::DOM;
      38             : using namespace ::DOM::events;
      39             : using namespace ::XPath;
      40             : using namespace css::uno;
      41             : using namespace css::lang;
      42             : using namespace css::registry;
      43             : 
      44             : extern "C"
      45             : {
      46             : 
      47         578 : SAL_DLLPUBLIC_EXPORT void* SAL_CALL unoxml_component_getFactory(const sal_Char *pImplementationName, void *pServiceManager, void * /*pRegistryKey*/)
      48             : {
      49         578 :     void* pReturn = NULL ;
      50         578 :     if  ( pImplementationName && pServiceManager )
      51             :     {
      52             :         // Define variables which are used in following macros.
      53         578 :         Reference< XSingleServiceFactory > xFactory;
      54             :         Reference< XMultiServiceFactory >  xServiceManager(
      55        1156 :             reinterpret_cast< XMultiServiceFactory* >(pServiceManager));
      56             : 
      57         578 :         if (CDocumentBuilder::_getImplementationName().equalsAscii( pImplementationName )  )
      58             :         {
      59         464 :             xFactory = Reference< XSingleServiceFactory >(
      60             :                 cppu::createOneInstanceFactory(
      61             :                     xServiceManager, CDocumentBuilder::_getImplementationName(),
      62         232 :                     CDocumentBuilder::_getInstance, CDocumentBuilder::_getSupportedServiceNames()));
      63             :         }
      64         346 :         else if (CSAXDocumentBuilder::_getImplementationName().equalsAscii( pImplementationName ) )
      65             :         {
      66         236 :             xFactory = Reference< XSingleServiceFactory >(
      67             :                 cppu::createSingleFactory(
      68             :                     xServiceManager, CSAXDocumentBuilder::_getImplementationName(),
      69         118 :                     CSAXDocumentBuilder::_getInstance, CSAXDocumentBuilder::_getSupportedServiceNames()));
      70             :         }
      71         228 :         else if (CXPathAPI::_getImplementationName().equalsAscii( pImplementationName ) )
      72             :         {
      73         456 :             xFactory = Reference< XSingleServiceFactory >(
      74             :                 cppu::createSingleFactory(
      75             :                     xServiceManager, CXPathAPI::_getImplementationName(),
      76         228 :                     CXPathAPI::_getInstance, CXPathAPI::_getSupportedServiceNames()));
      77             :         }
      78           0 :         else if (CTestListener::_getImplementationName().equalsAscii( pImplementationName ) )
      79             :         {
      80           0 :             xFactory = Reference< XSingleServiceFactory >(
      81             :                 cppu::createSingleFactory(
      82             :                     xServiceManager, CTestListener::_getImplementationName(),
      83           0 :                     CTestListener::_getInstance, CTestListener::_getSupportedServiceNames()));
      84             :         }
      85             : 
      86             :         // Factory is valid - service was found.
      87         578 :         if ( xFactory.is() )
      88             :         {
      89         578 :             xFactory->acquire();
      90         578 :             pReturn = xFactory.get();
      91         578 :         }
      92             :     }
      93             : 
      94             :     // Return with result of this operation.
      95         578 :     return pReturn ;
      96             : }
      97             : 
      98             : } // extern "C"
      99             : 
     100             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10