Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _CPPUHELPER_IMPLBASE5_HXX_
29 : : #define _CPPUHELPER_IMPLBASE5_HXX_
30 : :
31 : : #include <cppuhelper/implbase_ex.hxx>
32 : : #include <rtl/instance.hxx>
33 : :
34 : : namespace cppu
35 : : {
36 : : /// @cond INTERNAL
37 : :
38 : : struct class_data5
39 : : {
40 : : sal_Int16 m_nTypes;
41 : : sal_Bool m_storedTypeRefs;
42 : : sal_Bool m_storedId;
43 : : sal_Int8 m_id[ 16 ];
44 : : type_entry m_typeEntries[ 5 + 1 ];
45 : : };
46 : :
47 : : template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Impl >
48 : : struct ImplClassData5
49 : : {
50 : 2525 : class_data* operator ()()
51 : : {
52 : : static class_data5 s_cd =
53 : : {
54 : : 5 +1, sal_False, sal_False,
55 : : { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
56 : : {
57 : : { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 },
58 : : { { Ifc2::static_type }, ((sal_IntPtr)(Ifc2 *) (Impl *) 16) - 16 },
59 : : { { Ifc3::static_type }, ((sal_IntPtr)(Ifc3 *) (Impl *) 16) - 16 },
60 : : { { Ifc4::static_type }, ((sal_IntPtr)(Ifc4 *) (Impl *) 16) - 16 },
61 : : { { Ifc5::static_type }, ((sal_IntPtr)(Ifc5 *) (Impl *) 16) - 16 },
62 : : { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
63 : : }
64 : : };
65 : 2525 : return reinterpret_cast< class_data * >(&s_cd);
66 : : }
67 : : };
68 : :
69 : : /// @endcond
70 : :
71 : : /** Implementation helper implementing interface com::sun::star::lang::XTypeProvider
72 : : and method XInterface::queryInterface(), but no reference counting.
73 : :
74 : : @derive
75 : : Inherit from this class giving your interface(s) to be implemented as template argument(s).
76 : : Your sub class defines method implementations for these interface(s) including acquire()/
77 : : release() and delegates incoming queryInterface() calls to this base class.
78 : : */
79 : : template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
80 : 482 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper5
81 : : : public com::sun::star::lang::XTypeProvider
82 : : , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
83 : : {
84 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, ImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
85 : : public:
86 : 256 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
87 : 256 : { return ImplHelper_query( rType, cd::get(), this ); }
88 : 0 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
89 : 0 : { return ImplHelper_getTypes( cd::get() ); }
90 : 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
91 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
92 : :
93 : : #if !defined _MSC_VER // public -> protected changes mangled names there
94 : : protected:
95 : : #endif
96 : 482 : ~ImplHelper5() throw () {}
97 : : };
98 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
99 : : com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
100 : : (supporting com::sun::star::uno::XWeak thru ::cppu::OWeakObject).
101 : :
102 : : @derive
103 : : Inherit from this class giving your interface(s) to be implemented as template argument(s).
104 : : Your sub class defines method implementations for these interface(s).
105 : : */
106 : : template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
107 [ - + ][ - + ]: 173283 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper5
108 : : : public OWeakObject
109 : : , public com::sun::star::lang::XTypeProvider
110 : : , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
111 : : {
112 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
113 : : public:
114 : 467396 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
115 : 467396 : { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
116 : 1821111 : virtual void SAL_CALL acquire() throw ()
117 : 1821111 : { OWeakObject::acquire(); }
118 : 1814784 : virtual void SAL_CALL release() throw ()
119 : 1814784 : { OWeakObject::release(); }
120 : 69 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
121 : 69 : { return WeakImplHelper_getTypes( cd::get() ); }
122 : 69 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
123 : 69 : { return ImplHelper_getImplementationId( cd::get() ); }
124 : : };
125 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
126 : : com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
127 : : (supporting com::sun::star::uno::XWeak thru ::cppu::OWeakAggObject).
128 : : In addition, it supports also aggregation meaning object of this class can be aggregated
129 : : (com::sun::star::uno::XAggregation thru ::cppu::OWeakAggObject).
130 : : If a delegator is set (this object is aggregated), then incoming queryInterface()
131 : : calls are delegated to the delegator object. If the delegator does not support the
132 : : demanded interface, it calls queryAggregation() on its aggregated objects.
133 : :
134 : : @derive
135 : : Inherit from this class giving your interface(s) to be implemented as template argument(s).
136 : : Your sub class defines method implementations for these interface(s).
137 : : */
138 : : template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
139 [ - + ]: 7076 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper5
140 : : : public OWeakAggObject
141 : : , public com::sun::star::lang::XTypeProvider
142 : : , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
143 : : {
144 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakAggImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
145 : : public:
146 : 94234 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
147 : 94234 : { return OWeakAggObject::queryInterface( rType ); }
148 : 96641 : virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
149 : 96641 : { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
150 : 386377 : virtual void SAL_CALL acquire() throw ()
151 : 386377 : { OWeakAggObject::acquire(); }
152 : 8401 : virtual void SAL_CALL release() throw ()
153 : 8401 : { OWeakAggObject::release(); }
154 : 0 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
155 : 0 : { return WeakAggImplHelper_getTypes( cd::get() ); }
156 : 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
157 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
158 : : };
159 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
160 : : com::sun::star::uno::XInterface inherting from a BaseClass.
161 : : All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
162 : : if a demanded interface is not supported by this class directly, the request is
163 : : delegated to the BaseClass.
164 : :
165 : : @attention
166 : : The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface
167 : : and com::sun::star::lang::XTypeProvider are implemented properly. The
168 : : BaseClass must have at least one ctor that can be called with six or
169 : : fewer arguments, of which none is of non-const reference type.
170 : :
171 : : @derive
172 : : Inherit from this class giving your additional interface(s) to be implemented as
173 : : template argument(s). Your sub class defines method implementations for these interface(s).
174 : : */
175 : : template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
176 [ - + ]: 26541 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper5
177 : : : public BaseClass
178 : : , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
179 : : {
180 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, ImplInheritanceHelper5<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
181 : : protected:
182 : : template< typename T1 >
183 : 0 : explicit ImplInheritanceHelper5(T1 const & arg1): BaseClass(arg1) {}
184 : : template< typename T1, typename T2 >
185 : : ImplInheritanceHelper5(T1 const & arg1, T2 const & arg2):
186 : : BaseClass(arg1, arg2) {}
187 : : template< typename T1, typename T2, typename T3 >
188 : : ImplInheritanceHelper5(
189 : : T1 const & arg1, T2 const & arg2, T3 const & arg3):
190 : : BaseClass(arg1, arg2, arg3) {}
191 : : template< typename T1, typename T2, typename T3, typename T4 >
192 : 12201 : ImplInheritanceHelper5(
193 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
194 : 12201 : BaseClass(arg1, arg2, arg3, arg4) {}
195 : : template<
196 : : typename T1, typename T2, typename T3, typename T4, typename T5 >
197 : : ImplInheritanceHelper5(
198 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
199 : : T5 const & arg5):
200 : : BaseClass(arg1, arg2, arg3, arg4, arg5) {}
201 : : template<
202 : : typename T1, typename T2, typename T3, typename T4, typename T5,
203 : : typename T6 >
204 : : ImplInheritanceHelper5(
205 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
206 : : T5 const & arg5, T6 const & arg6):
207 : : BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
208 : : public:
209 : 14571 : ImplInheritanceHelper5() {}
210 : 121623 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
211 : : {
212 [ + - ][ + - ]: 121623 : com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
213 [ + + ]: 121623 : if (aRet.hasValue())
214 : 52732 : return aRet;
215 [ + - ]: 121623 : return BaseClass::queryInterface( rType );
216 : : }
217 : 459307 : virtual void SAL_CALL acquire() throw ()
218 : 459307 : { BaseClass::acquire(); }
219 : 254862 : virtual void SAL_CALL release() throw ()
220 : 254862 : { BaseClass::release(); }
221 : 2 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
222 [ + - ][ + - ]: 2 : { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
223 : 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
224 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
225 : : };
226 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
227 : : com::sun::star::uno::XInterface inherting from a BaseClass.
228 : : All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
229 : : Upon queryAggregation(), if a demanded interface is not supported by this class directly,
230 : : the request is delegated to the BaseClass.
231 : :
232 : : @attention
233 : : The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface,
234 : : com::sun::star::uno::XAggregation and com::sun::star::lang::XTypeProvider
235 : : are implemented properly. The BaseClass must have at least one ctor
236 : : that can be called with six or fewer arguments, of which none is of
237 : : non-const reference type.
238 : :
239 : : @derive
240 : : Inherit from this class giving your additional interface(s) to be implemented as
241 : : template argument(s). Your sub class defines method implementations for these interface(s).
242 : : */
243 : : template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
244 [ - + ]: 12 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper5
245 : : : public BaseClass
246 : : , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
247 : : {
248 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, AggImplInheritanceHelper5<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
249 : : protected:
250 : : template< typename T1 >
251 : 12 : explicit AggImplInheritanceHelper5(T1 const & arg1): BaseClass(arg1) {}
252 : : template< typename T1, typename T2 >
253 : : AggImplInheritanceHelper5(T1 const & arg1, T2 const & arg2):
254 : : BaseClass(arg1, arg2) {}
255 : : template< typename T1, typename T2, typename T3 >
256 : : AggImplInheritanceHelper5(
257 : : T1 const & arg1, T2 const & arg2, T3 const & arg3):
258 : : BaseClass(arg1, arg2, arg3) {}
259 : : template< typename T1, typename T2, typename T3, typename T4 >
260 : : AggImplInheritanceHelper5(
261 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
262 : : BaseClass(arg1, arg2, arg3, arg4) {}
263 : : template<
264 : : typename T1, typename T2, typename T3, typename T4, typename T5 >
265 : : AggImplInheritanceHelper5(
266 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
267 : : T5 const & arg5):
268 : : BaseClass(arg1, arg2, arg3, arg4, arg5) {}
269 : : template<
270 : : typename T1, typename T2, typename T3, typename T4, typename T5,
271 : : typename T6 >
272 : : AggImplInheritanceHelper5(
273 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
274 : : T5 const & arg5, T6 const & arg6):
275 : : BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
276 : : public:
277 : : AggImplInheritanceHelper5() {}
278 : 1189 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
279 : 1189 : { return BaseClass::queryInterface( rType ); }
280 : 876 : virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
281 : : {
282 [ + - ][ + - ]: 876 : com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
283 [ + + ]: 876 : if (aRet.hasValue())
284 : 90 : return aRet;
285 [ + - ]: 876 : return BaseClass::queryAggregation( rType );
286 : : }
287 : 5981 : virtual void SAL_CALL acquire() throw ()
288 : 5981 : { BaseClass::acquire(); }
289 : 5981 : virtual void SAL_CALL release() throw ()
290 : 5981 : { BaseClass::release(); }
291 : 0 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
292 [ # # ][ # # ]: 0 : { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
293 : 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
294 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
295 : : };
296 : : }
297 : :
298 : : #endif
299 : :
300 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|