xref: /AOO41X/main/cppuhelper/inc/cppuhelper/implbase_ex_post.hxx (revision 6da5f31158a7dd09f46f041b4f15bb7ae3eb92a4)
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_POST_HXX_
24 #define _CPPUHELPER_IMPLBASE_EX_POST_HXX_
25 
26 
27 /** @internal */
28 #define __DEF_CLASS_DATA_INIT_EX( N, class_cast ) \
29 { \
30 N +1, sal_False, sal_False, \
31 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, \
32 { \
33 __IFC_EX_TYPE_INIT##N( class_cast ), \
34 __IFC_EX_TYPE_INIT_NAME( class_cast, ::com::sun::star::lang::XTypeProvider ) \
35 } \
36 }
37 
38 /** @internal */
39 #define __DEF_IMPLHELPER_EX( N ) \
40 namespace cppu \
41 { \
42 struct class_data##N \
43 { \
44     sal_Int16 m_nTypes; \
45     sal_Bool m_storedTypeRefs; \
46     sal_Bool m_storedId; \
47     sal_Int8 m_id[ 16 ]; \
48     type_entry m_typeEntries[ N + 1 ]; \
49 }; \
50 template< __CLASS_IFC##N > \
51 class SAL_NO_VTABLE ImplHelper##N \
52     : public ::com::sun::star::lang::XTypeProvider \
53     , __PUBLIC_IFC##N \
54 { \
55     static class_data##N s_cd; \
56 public: \
57     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
58         { return ImplHelper_query( rType, (class_data *)&s_cd, this ); } \
59     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
60         { return ImplHelper_getTypes( (class_data *)&s_cd ); } \
61     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
62         { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
63 }; \
64 template< __CLASS_IFC##N > \
65 class_data##N ImplHelper##N< __IFC##N >::s_cd = \
66 __DEF_CLASS_DATA_INIT_EX( N, (ImplHelper##N< __IFC##N > *) ); \
67 template< __CLASS_IFC##N > \
68 class SAL_NO_VTABLE WeakImplHelper##N \
69     : public OWeakObject \
70     , public ::com::sun::star::lang::XTypeProvider \
71     , __PUBLIC_IFC##N \
72 { \
73     static class_data##N s_cd; \
74 public: \
75     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
76         { return WeakImplHelper_query( rType, (class_data *)&s_cd, this, (OWeakObject *)this ); } \
77     virtual void SAL_CALL acquire() throw () \
78         { OWeakObject::acquire(); } \
79     virtual void SAL_CALL release() throw () \
80         { OWeakObject::release(); } \
81     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
82         { return WeakImplHelper_getTypes( (class_data *)&s_cd ); } \
83     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
84         { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
85 }; \
86 template< __CLASS_IFC##N > \
87 class_data##N WeakImplHelper##N< __IFC##N >::s_cd = \
88 __DEF_CLASS_DATA_INIT_EX( N, (WeakImplHelper##N< __IFC##N > *) ); \
89 template< __CLASS_IFC##N > \
90 class SAL_NO_VTABLE WeakAggImplHelper##N \
91     : public OWeakAggObject \
92     , public ::com::sun::star::lang::XTypeProvider \
93     , __PUBLIC_IFC##N \
94 { \
95     static class_data##N s_cd; \
96 public: \
97     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
98         { return OWeakAggObject::queryInterface( rType ); } \
99     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
100         { return WeakAggImplHelper_queryAgg( rType, (class_data *)&s_cd, this, (OWeakAggObject *)this ); } \
101     virtual void SAL_CALL acquire() throw () \
102         { OWeakAggObject::acquire(); } \
103     virtual void SAL_CALL release() throw () \
104         { OWeakAggObject::release(); } \
105     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
106         { return WeakAggImplHelper_getTypes( (class_data *)&s_cd ); } \
107     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
108         { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
109 }; \
110 template< __CLASS_IFC##N > \
111 class_data##N WeakAggImplHelper##N< __IFC##N >::s_cd = \
112 __DEF_CLASS_DATA_INIT_EX( N, (WeakAggImplHelper##N< __IFC##N > *) ); \
113 template< class BaseClass, __CLASS_IFC##N > \
114 class SAL_NO_VTABLE ImplInheritanceHelper##N \
115     : public BaseClass \
116     , __PUBLIC_IFC##N \
117 { \
118     static class_data##N s_cd; \
119 public: \
120     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
121     { \
122         ::com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, (class_data *)&s_cd, this ) ); \
123         if (aRet.hasValue()) \
124             return aRet; \
125         return BaseClass::queryInterface( rType ); \
126     } \
127     virtual void SAL_CALL acquire() throw () \
128         { BaseClass::acquire(); } \
129     virtual void SAL_CALL release() throw () \
130         { BaseClass::release(); } \
131     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
132         { return ImplInhHelper_getTypes( (class_data *)&s_cd, BaseClass::getTypes() ); } \
133     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
134         { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
135 }; \
136 template< class BaseClass, __CLASS_IFC##N > \
137 class_data##N ImplInheritanceHelper##N< BaseClass, __IFC##N >::s_cd = \
138 __DEF_CLASS_DATA_INIT_EX( N, (ImplInheritanceHelper##N< BaseClass, __IFC##N > *) ); \
139 template< class BaseClass, __CLASS_IFC##N > \
140 class SAL_NO_VTABLE AggImplInheritanceHelper##N \
141     : public BaseClass \
142     , __PUBLIC_IFC##N \
143 { \
144     static class_data##N s_cd; \
145 public: \
146     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
147         { return BaseClass::queryInterface( rType ); } \
148     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
149     { \
150         ::com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, (class_data *)&s_cd, this ) ); \
151         if (aRet.hasValue()) \
152             return aRet; \
153         return BaseClass::queryAggregation( rType ); \
154     } \
155     virtual void SAL_CALL acquire() throw () \
156         { BaseClass::acquire(); } \
157     virtual void SAL_CALL release() throw () \
158         { BaseClass::release(); } \
159     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
160         { return ImplInhHelper_getTypes( (class_data *)&s_cd, BaseClass::getTypes() ); } \
161     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
162         { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
163 }; \
164 template< class BaseClass, __CLASS_IFC##N > \
165 class_data##N AggImplInheritanceHelper##N< BaseClass, __IFC##N >::s_cd = \
166 __DEF_CLASS_DATA_INIT_EX( N, (AggImplInheritanceHelper##N< BaseClass, __IFC##N > *) ); \
167 }
168 
169 /** @internal */
170 #define __DEF_COMPIMPLHELPER_EX( N ) \
171 namespace cppu \
172 { \
173 template< __CLASS_IFC##N > \
174 class SAL_NO_VTABLE WeakComponentImplHelper##N \
175     : public WeakComponentImplHelperBase \
176     , public ::com::sun::star::lang::XTypeProvider \
177     , __PUBLIC_IFC##N \
178 { \
179     static class_data##N s_cd; \
180 public: \
181     inline WeakComponentImplHelper##N( ::osl::Mutex & rMutex ) SAL_THROW( () ) \
182         : WeakComponentImplHelperBase( rMutex ) \
183         {} \
184     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
185         { return WeakComponentImplHelper_query( rType, (class_data *)&s_cd, this, (WeakComponentImplHelperBase *)this ); } \
186     virtual void SAL_CALL acquire() throw () \
187         { WeakComponentImplHelperBase::acquire(); } \
188     virtual void SAL_CALL release() throw () \
189         { WeakComponentImplHelperBase::release(); } \
190     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
191         { return WeakComponentImplHelper_getTypes( (class_data *)&s_cd ); } \
192     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
193         { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
194 }; \
195 template< __CLASS_IFC##N > \
196 class_data##N WeakComponentImplHelper##N< __IFC##N >::s_cd = \
197 __DEF_CLASS_DATA_INIT_EX( N, (WeakComponentImplHelper##N< __IFC##N > *) ); \
198 template< __CLASS_IFC##N > \
199 class SAL_NO_VTABLE WeakAggComponentImplHelper##N \
200     : public WeakAggComponentImplHelperBase \
201     , public ::com::sun::star::lang::XTypeProvider \
202     , __PUBLIC_IFC##N \
203 { \
204     static class_data##N s_cd; \
205 public: \
206     inline WeakAggComponentImplHelper##N( ::osl::Mutex & rMutex ) SAL_THROW( () ) \
207         : WeakAggComponentImplHelperBase( rMutex ) \
208         {} \
209     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
210         { return WeakAggComponentImplHelperBase::queryInterface( rType ); } \
211     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) \
212         { return WeakAggComponentImplHelper_queryAgg( rType, (class_data *)&s_cd, this, (WeakAggComponentImplHelperBase *)this ); } \
213     virtual void SAL_CALL acquire() throw () \
214         { WeakAggComponentImplHelperBase::acquire(); } \
215     virtual void SAL_CALL release() throw () \
216         { WeakAggComponentImplHelperBase::release(); } \
217     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) \
218         { return WeakAggComponentImplHelper_getTypes( (class_data *)&s_cd ); } \
219     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
220         { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
221 }; \
222 template< __CLASS_IFC##N > \
223 class_data##N WeakAggComponentImplHelper##N< __IFC##N >::s_cd = \
224 __DEF_CLASS_DATA_INIT_EX( N, (WeakAggComponentImplHelper##N< __IFC##N > *) ); \
225 }
226 
227 #endif
228