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_IMPLBASE_EX_HXX_ 24 #define _CPPUHELPER_IMPLBASE_EX_HXX_ 25 26 #include <cppuhelper/weak.hxx> 27 #include <cppuhelper/weakagg.hxx> 28 #include <com/sun/star/lang/XTypeProvider.hpp> 29 30 #include "cppuhelper/cppuhelperdllapi.h" 31 32 // Despite the fact that the following include is not used in this header, it has to remain, 33 // because it is expected by files including cppuhelper/implbaseN.hxx. 34 // So maybe we can omit it some time in the future... 35 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 36 37 /* If you need to define implementation helper classes that deal with more than 38 12 interfaces, then use macros as follows, e.g. for 3 interfaces: 39 40 #include <cppuhelper/implbase_ex_pre.hxx> 41 #define __IFC_EX_TYPE_INIT3( class_cast ) \ 42 __IFC_EX_TYPE_INIT( class_cast, 1 ), __IFC_EX_TYPE_INIT( class_cast, 2 ), \ 43 __IFC_EX_TYPE_INIT( class_cast, 3 ) 44 #include <cppuhelper/implbase_ex_post.hxx> 45 __DEF_IMPLHELPER_EX( 3 ) 46 */ 47 48 49 namespace cppu 50 { 51 52 /** function pointer signature for getCppuType 53 @internal 54 */ 55 typedef ::com::sun::star::uno::Type const & (SAL_CALL * fptr_getCppuType)( void * ) SAL_THROW( () ); 56 57 /** single type + object offset 58 @internal 59 */ 60 struct type_entry 61 { 62 /** the type_entry is initialized with function pointer to ::getCppuType() function first, 63 but holds an unacquired typelib_TypeDescriptionReference * after initialization, 64 thus reusing the memory. Flag class_data::m_storedTypeRefs 65 */ 66 union 67 { 68 fptr_getCppuType getCppuType; 69 typelib_TypeDescriptionReference * typeRef; 70 } m_type; 71 /** offset for interface pointer 72 */ 73 sal_IntPtr m_offset; 74 }; 75 76 /** identical dummy struct for casting class_dataN to class_data 77 @internal 78 */ 79 struct class_data 80 { 81 /** number of supported types in m_typeEntries 82 */ 83 sal_Int16 m_nTypes; 84 85 /** determines whether m_typeEntries is initialized and carries unacquired type refs 86 */ 87 sal_Bool m_storedTypeRefs; 88 89 /** determines whether an implementation id was created in m_id 90 */ 91 sal_Bool m_createdId; 92 93 /** implementation id 94 */ 95 sal_Int8 m_id[ 16 ]; 96 97 /** type, object offset 98 */ 99 type_entry m_typeEntries[ 1 ]; 100 }; 101 102 /** ImplHelper 103 @internal 104 */ 105 CPPUHELPER_DLLPUBLIC 106 ::com::sun::star::uno::Any SAL_CALL ImplHelper_query( 107 ::com::sun::star::uno::Type const & rType, 108 class_data * cd, 109 void * that ); 110 /** ImplHelper 111 @internal 112 */ 113 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Any SAL_CALL ImplHelper_queryNoXInterface( 114 ::com::sun::star::uno::Type const & rType, 115 class_data * cd, 116 void * that ); 117 /** ImplHelper 118 @internal 119 */ 120 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL ImplHelper_getTypes( 121 class_data * cd ); 122 /** ImplHelper 123 @internal 124 */ 125 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL ImplInhHelper_getTypes( 126 class_data * cd, 127 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > const & rAddTypes ); 128 /** ImplHelper 129 @internal 130 */ 131 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL ImplHelper_getImplementationId( 132 class_data * cd ); 133 134 /** WeakImplHelper 135 @internal 136 */ 137 CPPUHELPER_DLLPUBLIC 138 ::com::sun::star::uno::Any SAL_CALL WeakImplHelper_query( 139 ::com::sun::star::uno::Type const & rType, 140 class_data * cd, 141 void * that, 142 ::cppu::OWeakObject * pBase ); 143 /** WeakImplHelper 144 @internal 145 */ 146 CPPUHELPER_DLLPUBLIC 147 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL WeakImplHelper_getTypes( 148 class_data * cd ); 149 150 /** WeakAggImplHelper 151 @internal 152 */ 153 CPPUHELPER_DLLPUBLIC 154 ::com::sun::star::uno::Any SAL_CALL WeakAggImplHelper_queryAgg( 155 ::com::sun::star::uno::Type const & rType, 156 class_data * cd, 157 void * that, 158 ::cppu::OWeakAggObject * pBase ); 159 /** WeakAggImplHelper 160 @internal 161 */ 162 CPPUHELPER_DLLPUBLIC 163 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL WeakAggImplHelper_getTypes( 164 class_data * cd ); 165 166 } 167 168 #endif 169