LCOV - code coverage report
Current view: top level - unoxml/source/service - services.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 19 19 100.0 %
Date: 2015-06-13 12:38:46 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             : 
      36             : using namespace ::DOM;
      37             : using namespace ::XPath;
      38             : using namespace css::uno;
      39             : using namespace css::lang;
      40             : using namespace css::registry;
      41             : 
      42             : extern "C"
      43             : {
      44             : 
      45         398 : SAL_DLLPUBLIC_EXPORT void* SAL_CALL unoxml_component_getFactory(const sal_Char *pImplementationName, void *pServiceManager, void * /*pRegistryKey*/)
      46             : {
      47         398 :     void* pReturn = NULL ;
      48         398 :     if  ( pImplementationName && pServiceManager )
      49             :     {
      50             :         // Define variables which are used in following macros.
      51         398 :         Reference< XSingleServiceFactory > xFactory;
      52             :         Reference< XMultiServiceFactory >  xServiceManager(
      53         796 :             static_cast< XMultiServiceFactory* >(pServiceManager));
      54             : 
      55         398 :         if (CDocumentBuilder::_getImplementationName().equalsAscii( pImplementationName )  )
      56             :         {
      57         328 :             xFactory = Reference< XSingleServiceFactory >(
      58             :                 cppu::createOneInstanceFactory(
      59             :                     xServiceManager, CDocumentBuilder::_getImplementationName(),
      60         164 :                     CDocumentBuilder::_getInstance, CDocumentBuilder::_getSupportedServiceNames()));
      61             :         }
      62         234 :         else if (CSAXDocumentBuilder::_getImplementationName().equalsAscii( pImplementationName ) )
      63             :         {
      64         144 :             xFactory = Reference< XSingleServiceFactory >(
      65             :                 cppu::createSingleFactory(
      66             :                     xServiceManager, CSAXDocumentBuilder::_getImplementationName(),
      67          72 :                     CSAXDocumentBuilder::_getInstance, CSAXDocumentBuilder::_getSupportedServiceNames()));
      68             :         }
      69         162 :         else if (CXPathAPI::_getImplementationName().equalsAscii( pImplementationName ) )
      70             :         {
      71         324 :             xFactory = Reference< XSingleServiceFactory >(
      72             :                 cppu::createSingleFactory(
      73             :                     xServiceManager, CXPathAPI::_getImplementationName(),
      74         162 :                     CXPathAPI::_getInstance, CXPathAPI::_getSupportedServiceNames()));
      75             :         }
      76             : 
      77             :         // Factory is valid - service was found.
      78         398 :         if ( xFactory.is() )
      79             :         {
      80         398 :             xFactory->acquire();
      81         398 :             pReturn = xFactory.get();
      82         398 :         }
      83             :     }
      84             : 
      85             :     // Return with result of this operation.
      86         398 :     return pReturn ;
      87             : }
      88             : 
      89             : } // extern "C"
      90             : 
      91             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11