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