xref: /trunk/main/configmgr/source/services.cxx (revision 9c15e1abd703a7953928d7a80655ae1a76a41f6d)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "precompiled_configmgr.hxx"
25 #include "sal/config.h"
26 
27 #include "com/sun/star/uno/Exception.hpp"
28 #include "com/sun/star/uno/Reference.hxx"
29 #include "com/sun/star/uno/XComponentContext.hpp"
30 #include "com/sun/star/uno/XInterface.hpp"
31 #include "cppuhelper/factory.hxx"
32 #include "cppuhelper/implementationentry.hxx"
33 #include "osl/diagnose.h"
34 #include "uno/lbnames.h"
35 #include "sal/types.h"
36 
37 #include "configurationprovider.hxx"
38 #include "configurationregistry.hxx"
39 #include "defaultprovider.hxx"
40 #include "update.hxx"
41 
42 namespace {
43 
44 namespace css = com::sun::star;
45 
46 css::uno::Reference< css::uno::XInterface > SAL_CALL dummy(
47     css::uno::Reference< css::uno::XComponentContext > const &)
48 {
49     OSL_ASSERT(false);
50     return css::uno::Reference< css::uno::XInterface >();
51 }
52 
53 static cppu::ImplementationEntry const services[] = {
54     { &dummy, &configmgr::configuration_provider::getImplementationName,
55       &configmgr::configuration_provider::getSupportedServiceNames,
56       &configmgr::configuration_provider::createFactory, 0, 0 },
57     { &configmgr::default_provider::create,
58       &configmgr::default_provider::getImplementationName,
59       &configmgr::default_provider::getSupportedServiceNames,
60       &cppu::createSingleComponentFactory, 0, 0 },
61     { &configmgr::configuration_registry::create,
62       &configmgr::configuration_registry::getImplementationName,
63       &configmgr::configuration_registry::getSupportedServiceNames,
64       &cppu::createSingleComponentFactory, 0, 0 },
65     { &configmgr::update::create, &configmgr::update::getImplementationName,
66       &configmgr::update::getSupportedServiceNames,
67       &cppu::createSingleComponentFactory, 0, 0 },
68     { 0, 0, 0, 0, 0, 0 }
69 };
70 
71 }
72 
73 extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
74     char const * pImplName, void * pServiceManager, void * pRegistryKey)
75 {
76     return cppu::component_getFactoryHelper(
77         pImplName, pServiceManager, pRegistryKey, services);
78 }
79 
80 extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
81 component_getImplementationEnvironment(
82     char const ** ppEnvTypeName, uno_Environment **)
83 {
84     *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
85 }
86