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 <cppuhelper/implementationentry.hxx>
21 :
22 : #include <osl/diagnose.h>
23 :
24 : using namespace ::com::sun::star::uno;
25 : using namespace ::com::sun::star::lang;
26 : using namespace ::com::sun::star::registry;
27 :
28 : using rtl::OUString;
29 :
30 : namespace cppu {
31 :
32 0 : sal_Bool component_writeInfoHelper(
33 : SAL_UNUSED_PARAMETER void *, void * pRegistryKey,
34 : ImplementationEntry const * entries)
35 : {
36 0 : bool bRet = false;
37 : try
38 : {
39 0 : if( pRegistryKey )
40 : {
41 0 : for( sal_Int32 i = 0; entries[i].create ; i ++ )
42 : {
43 0 : OUString sKey = "/" + entries[i].getImplementationName() + "/UNO/SERVICES";
44 : Reference< XRegistryKey > xNewKey(
45 0 : static_cast< XRegistryKey * >( pRegistryKey )->createKey( sKey ) );
46 :
47 0 : Sequence< OUString > seq = entries[i].getSupportedServiceNames();
48 0 : const OUString *pArray = seq.getConstArray();
49 0 : for ( sal_Int32 nPos = 0 ; nPos < seq.getLength(); nPos ++ )
50 0 : xNewKey->createKey( pArray[nPos] );
51 0 : }
52 0 : bRet = true;
53 : }
54 : }
55 0 : catch ( InvalidRegistryException & )
56 : {
57 : OSL_FAIL( "### InvalidRegistryException!" );
58 : }
59 0 : return bRet;
60 : }
61 :
62 :
63 1959 : void * component_getFactoryHelper(
64 : char const * pImplName, SAL_UNUSED_PARAMETER void *,
65 : SAL_UNUSED_PARAMETER void *, ImplementationEntry const * entries)
66 : {
67 :
68 1959 : void * pRet = 0;
69 1959 : Reference< XSingleComponentFactory > xFactory;
70 :
71 10819 : for( sal_Int32 i = 0 ; entries[i].create ; i ++ )
72 : {
73 8860 : OUString implName = entries[i].getImplementationName();
74 8860 : if( implName.equalsAscii( pImplName ) )
75 : {
76 9795 : xFactory = entries[i].createFactory(
77 1959 : entries[i].create,
78 : implName,
79 1959 : entries[i].getSupportedServiceNames(),
80 3918 : entries[i].moduleCounter );
81 : }
82 8860 : }
83 :
84 1959 : if( xFactory.is() )
85 : {
86 1959 : xFactory->acquire();
87 1959 : pRet = xFactory.get();
88 : }
89 1959 : return pRet;
90 : }
91 :
92 : }
93 :
94 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|