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