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 #ifndef _CPPUHELPER_IMPLEMENATIONENTRY_HXX_
24 #define _CPPUHELPER_IMPLEMENATIONENTRY_HXX_
25 
26 #include <cppuhelper/factory.hxx>
27 
28 namespace cppu
29 {
30 /** One struct instance represents all data necessary for registering one service implementation.
31 
32  */
33 struct ImplementationEntry
34 {
35 	/** Function, that creates an instance of the implemenation
36 	 */
37    	ComponentFactoryFunc create;
38 
39 	/** Function, that returns the implemenation-name of the implemenation
40 	   (same as XServiceInfo.getImplementationName() ).
41 	 */
42  	rtl::OUString ( SAL_CALL * getImplementationName )();
43 
44 	/** Function, that returns all supported servicenames of the implemenation
45 	   ( same as XServiceInfo.getSupportedServiceNames() ).
46 	*/
47  	com::sun::star::uno::Sequence< rtl::OUString > ( SAL_CALL * getSupportedServiceNames ) ();
48 
49 	/** Function, that creates a SingleComponentFactory.
50 	*/
51  	::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory >
52  	( SAL_CALL * createFactory )(
53  		ComponentFactoryFunc fptr,
54  		::rtl::OUString const & rImplementationName,
55  		::com::sun::star::uno::Sequence< ::rtl::OUString > const & rServiceNames,
56  		rtl_ModuleCount * pModCount );
57 
58 	/** The shared-library module-counter of the implemenation. Maybe 0. The module-counter
59 		is used during by the createFactory()-function.
60 	*/
61  	rtl_ModuleCount * moduleCounter;
62 
63 	/** Must be set to 0 !
64 		For future extensions.
65 	 */
66 	sal_Int32 nFlags;
67 };
68 
69 /** Helper function for implementation of the component_writeInfo()-function.
70 
71     @obsolete component_writeInfo should no longer be used in new components
72 
73 	@param pServiceManager The first parameter passed to component_writeInfo()-function
74 	                       (This is an instance of the service manager, that creates the factory).
75 	@param pRegistryKey    The second parameter passed to the component_writeInfo()-function.
76 	                       This is a reference to the registry key, into which the implementation
77 						   data shall be written to.
78 	@param entries         Each element of the entries-array must contains a function pointer
79 	                       table for registering an implemenation. The end of the array
80 	                       must be marked with a 0 entry in the create-function.
81 	@return sal_True, if all implementations could be registered, otherwise sal_False.
82  */
83 sal_Bool component_writeInfoHelper(
84 	void *pServiceManager, void *pRegistryKey , const struct ImplementationEntry entries[] );
85 
86 /** Helper function for implementation of the component_getFactory()-function,
87 	that must be implemented by every shared library component.
88 
89 	@param pImplName       The implementation-name to be instantiated ( This is the
90 	                       first parameter passed to the component_getFactory
91 	@param pServiceManager The second parameter passed to component_getFactory()-function
92 	                       (This is a of the service manager, that creates the factory).
93 	@param pRegistryKey    The third parameter passed to the component_getFactory()-function.
94 	                       This is a reference to the registry key, where the implementation
95 						   data has been written to.
96 	@param entries         Each element of the entries-array must contains a function pointer
97 	                       table for creating a factor of the implementation. The end of the array
98 	                       must be marked with a 0 entry in the create-function.
99     @return 0 if the helper failed to instantiate a factory, otherwise an acquired pointer
100 	        to a factory.
101  */
102 void *component_getFactoryHelper(
103 	const sal_Char * pImplName,
104 	void * pServiceManager,
105 	void * pRegistryKey,
106 	const struct ImplementationEntry entries[] );
107 
108 }
109 #endif
110