1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_CPPUHELPER_IMPLEMENTATIONENTRY_HXX
20 #define INCLUDED_CPPUHELPER_IMPLEMENTATIONENTRY_HXX
22 #include <cppuhelper/factory.hxx>
23 #include <cppuhelper/cppuhelperdllapi.h>
25 // MinGW wants it the one way around while MSVC wants it the other (cf.
26 // <sourceforge.net/support/tracker.php?aid=3514133> "Syntactic __cdecl
27 // incompatibility with MSVC"; and everywhere else, SAL_CALL is empty, so
30 #define MY_FN_PTR(name) SAL_CALL (* name)
32 #define MY_FN_PTR(name) (SAL_CALL * name)
37 /** One struct instance represents all data necessary for registering one service implementation.
40 struct ImplementationEntry
42 /** Function that creates an instance of the implementation
44 ComponentFactoryFunc create
;
46 /** Function that returns the implementation-name of the implementation
47 (same as XServiceInfo.getImplementationName() ).
49 rtl::OUString
MY_FN_PTR( getImplementationName
)();
51 /** Function that returns all supported servicenames of the implementation
52 ( same as XServiceInfo.getSupportedServiceNames() ).
54 com::sun::star::uno::Sequence
< rtl::OUString
> MY_FN_PTR( getSupportedServiceNames
) ();
56 /** Function that creates a SingleComponentFactory.
58 The pModCount parameter is a backwards-compatibility remainder of a
59 removed library unloading feature; always set to null.
61 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XSingleComponentFactory
>
62 MY_FN_PTR( createFactory
)(
63 ComponentFactoryFunc fptr
,
64 ::rtl::OUString
const & rImplementationName
,
65 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> const & rServiceNames
,
66 rtl_ModuleCount
* pModCount
);
68 /** Backwards-compatibility remainder of a removed library unloading
69 feature; always set to null.
71 rtl_ModuleCount
* moduleCounter
;
73 /** Must be set to 0 !
74 For future extensions.
79 /** Helper function for implementation of the component_writeInfo()-function.
81 @deprecated component_writeInfo should no longer be used in new components
83 @param pServiceManager The first parameter passed to component_writeInfo()-function
84 (This is an instance of the service manager, that creates the factory).
85 @param pRegistryKey The second parameter passed to the component_writeInfo()-function.
86 This is a reference to the registry key, into which the implementation
87 data shall be written to.
88 @param entries Each element of the entries-array must contains a function pointer
89 table for registering an implementation. The end of the array
90 must be marked with a 0 entry in the create-function.
91 @return sal_True, if all implementations could be registered, otherwise sal_False.
93 CPPUHELPER_DLLPUBLIC sal_Bool
component_writeInfoHelper(
94 void *pServiceManager
, void *pRegistryKey
, const struct ImplementationEntry entries
[] );
96 /** Helper function for implementation of the component_getFactory()-function,
97 that must be implemented by every shared library component.
99 @param pImplName The implementation-name to be instantiated ( This is the
100 first parameter passed to the component_getFactory
101 @param pServiceManager The second parameter passed to component_getFactory()-function
102 (This is a of the service manager, that creates the factory).
103 @param pRegistryKey The third parameter passed to the component_getFactory()-function.
104 This is a reference to the registry key, where the implementation
105 data has been written to.
106 @param entries Each element of the entries-array must contains a function pointer
107 table for creating a factor of the implementation. The end of the array
108 must be marked with a 0 entry in the create-function.
109 @return 0 if the helper failed to instantiate a factory, otherwise an acquired pointer
112 CPPUHELPER_DLLPUBLIC
void *component_getFactoryHelper(
113 const sal_Char
* pImplName
,
114 void * pServiceManager
,
116 const struct ImplementationEntry entries
[] );
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */