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