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 SAL_THROW( (::com::sun::star::uno::RuntimeException) ); 111 /** ImplHelper 112 @internal 113 */ 114 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Any SAL_CALL ImplHelper_queryNoXInterface( 115 ::com::sun::star::uno::Type const & rType, 116 class_data * cd, 117 void * that ) 118 SAL_THROW( (::com::sun::star::uno::RuntimeException) ); 119 /** ImplHelper 120 @internal 121 */ 122 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL ImplHelper_getTypes( 123 class_data * cd ) 124 SAL_THROW( (::com::sun::star::uno::RuntimeException) ); 125 /** ImplHelper 126 @internal 127 */ 128 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL ImplInhHelper_getTypes( 129 class_data * cd, 130 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > const & rAddTypes ) 131 SAL_THROW( (::com::sun::star::uno::RuntimeException) ); 132 /** ImplHelper 133 @internal 134 */ 135 CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL ImplHelper_getImplementationId( 136 class_data * cd ) 137 SAL_THROW( (::com::sun::star::uno::RuntimeException) ); 138 139 /** WeakImplHelper 140 @internal 141 */ 142 CPPUHELPER_DLLPUBLIC 143 ::com::sun::star::uno::Any SAL_CALL WeakImplHelper_query( 144 ::com::sun::star::uno::Type const & rType, 145 class_data * cd, 146 void * that, 147 ::cppu::OWeakObject * pBase ) 148 SAL_THROW( (::com::sun::star::uno::RuntimeException) ); 149 /** WeakImplHelper 150 @internal 151 */ 152 CPPUHELPER_DLLPUBLIC 153 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL WeakImplHelper_getTypes( 154 class_data * cd ) 155 SAL_THROW( (::com::sun::star::uno::RuntimeException) ); 156 157 /** WeakAggImplHelper 158 @internal 159 */ 160 CPPUHELPER_DLLPUBLIC 161 ::com::sun::star::uno::Any SAL_CALL WeakAggImplHelper_queryAgg( 162 ::com::sun::star::uno::Type const & rType, 163 class_data * cd, 164 void * that, 165 ::cppu::OWeakAggObject * pBase ) 166 SAL_THROW( (::com::sun::star::uno::RuntimeException) ); 167 /** WeakAggImplHelper 168 @internal 169 */ 170 CPPUHELPER_DLLPUBLIC 171 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL WeakAggImplHelper_getTypes( 172 class_data * cd ) 173 SAL_THROW( (::com::sun::star::uno::RuntimeException) ); 174 175 } 176 177 #endif 178