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_IMPLBASE2_HXX_
29 : : #define _CPPUHELPER_IMPLBASE2_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_data2
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[ 2 + 1 ];
45 : : };
46 : :
47 : : template< typename Ifc1, typename Ifc2, typename Impl > struct ImplClassData2
48 : : {
49 : 11876 : class_data* operator ()()
50 : : {
51 : : static class_data2 s_cd =
52 : : {
53 : : 2 +1, sal_False, sal_False,
54 : : { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
55 : : {
56 : : { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 },
57 : : { { Ifc2::static_type }, ((sal_IntPtr)(Ifc2 *) (Impl *) 16) - 16 },
58 : : { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
59 : : }
60 : : };
61 : 11876 : return reinterpret_cast< class_data * >(&s_cd);
62 : : }
63 : : };
64 : :
65 : : /// @endcond
66 : :
67 : : /** Implementation helper implementing interface com::sun::star::lang::XTypeProvider
68 : : and queryInterface(), but no reference counting.
69 : :
70 : : @derive
71 : : Inherit from this class giving your interface(s) to be implemented as template argument(s).
72 : : Your base class defines method implementations, acquire(), release() and delegates incoming
73 : : queryInterface() calls to this base class.
74 : : */
75 : : template< class Ifc1, class Ifc2 >
76 : 6025 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper2
77 : : : public com::sun::star::lang::XTypeProvider
78 : : , public Ifc1, public Ifc2
79 : : {
80 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplHelper2<Ifc1, Ifc2> > > {};
81 : : public:
82 : 29124 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
83 : 29124 : { return ImplHelper_query( rType, cd::get(), this ); }
84 : 148 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
85 : 148 : { return ImplHelper_getTypes( cd::get() ); }
86 : 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
87 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
88 : :
89 : : #if !defined _MSC_VER // public -> protected changes mangled names there
90 : : protected:
91 : : #endif
92 : 5878 : ~ImplHelper2() throw () {}
93 : : };
94 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
95 : : com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
96 : : (supporting com::sun::star::uno::XWeak thru ::cppu::OWeakObject).
97 : :
98 : : @derive
99 : : Inherit from this class giving your interface(s) to be implemented as template argument(s).
100 : : Your sub class defines method implementations for these interface(s).
101 : : */
102 : : template< class Ifc1, class Ifc2 >
103 [ - + ][ - + ]: 1884450 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper2
[ - + ][ - + ]
[ # # ][ # # ]
[ # # ][ - + ]
[ - + ][ # # ]
[ # # ][ # # ]
[ - + ][ # # ]
[ # # # # ]
[ # # ]
[ - + # # ]
[ # # ]
104 : : : public OWeakObject
105 : : , public com::sun::star::lang::XTypeProvider
106 : : , public Ifc1, public Ifc2
107 : : {
108 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakImplHelper2<Ifc1, Ifc2> > > {};
109 : : public:
110 : 1750641 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
111 : 1750641 : { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
112 : 14099103 : virtual void SAL_CALL acquire() throw ()
113 : 14099103 : { OWeakObject::acquire(); }
114 : 14080303 : virtual void SAL_CALL release() throw ()
115 : 14080303 : { OWeakObject::release(); }
116 : 60 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
117 : 60 : { return WeakImplHelper_getTypes( cd::get() ); }
118 : 56 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
119 : 56 : { return ImplHelper_getImplementationId( cd::get() ); }
120 : : };
121 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
122 : : com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
123 : : (supporting com::sun::star::uno::XWeak thru ::cppu::OWeakAggObject).
124 : : In addition, it supports also aggregation meaning object of this class can be aggregated
125 : : (com::sun::star::uno::XAggregation thru ::cppu::OWeakAggObject).
126 : : If a delegator is set (this object is aggregated), then incoming queryInterface()
127 : : calls are delegated to the delegator object. If the delegator does not support the
128 : : demanded interface, it calls queryAggregation() on its aggregated objects.
129 : :
130 : : @derive
131 : : Inherit from this class giving your interface(s) to be implemented as template argument(s).
132 : : Your sub class defines method implementations for these interface(s).
133 : : */
134 : : template< class Ifc1, class Ifc2 >
135 [ - + ][ # # ]: 5974 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper2
136 : : : public OWeakAggObject
137 : : , public com::sun::star::lang::XTypeProvider
138 : : , public Ifc1, public Ifc2
139 : : {
140 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggImplHelper2<Ifc1, Ifc2> > > {};
141 : : public:
142 : 14533 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
143 : 14533 : { return OWeakAggObject::queryInterface( rType ); }
144 : 22243 : virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
145 : 22243 : { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
146 : 71602 : virtual void SAL_CALL acquire() throw ()
147 : 71602 : { OWeakAggObject::acquire(); }
148 : 70636 : virtual void SAL_CALL release() throw ()
149 : 70636 : { OWeakAggObject::release(); }
150 : 1378 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
151 : 1378 : { return WeakAggImplHelper_getTypes( cd::get() ); }
152 : 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
153 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
154 : : };
155 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
156 : : com::sun::star::uno::XInterface inherting from a BaseClass.
157 : : All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
158 : : if a demanded interface is not supported by this class directly, the request is
159 : : delegated to the BaseClass.
160 : :
161 : : @attention
162 : : The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface
163 : : and com::sun::star::lang::XTypeProvider are implemented properly. The
164 : : BaseClass must have at least one ctor that can be called with six or
165 : : fewer arguments, of which none is of non-const reference type.
166 : :
167 : : @derive
168 : : Inherit from this class giving your additional interface(s) to be implemented as
169 : : template argument(s). Your sub class defines method implementations for these interface(s).
170 : : */
171 : : template< class BaseClass, class Ifc1, class Ifc2 >
172 [ - + ][ - + ]: 77533 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper2
[ - + ]
173 : : : public BaseClass
174 : : , public Ifc1, public Ifc2
175 : : {
176 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
177 : : protected:
178 : : template< typename T1 >
179 : 106 : explicit ImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
180 : : template< typename T1, typename T2 >
181 : 0 : ImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
182 : 0 : BaseClass(arg1, arg2) {}
183 : : template< typename T1, typename T2, typename T3 >
184 : 0 : ImplInheritanceHelper2(
185 : : T1 const & arg1, T2 const & arg2, T3 const & arg3):
186 : 0 : BaseClass(arg1, arg2, arg3) {}
187 : : template< typename T1, typename T2, typename T3, typename T4 >
188 : 12249 : ImplInheritanceHelper2(
189 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
190 : 12249 : BaseClass(arg1, arg2, arg3, arg4) {}
191 : : template<
192 : : typename T1, typename T2, typename T3, typename T4, typename T5 >
193 : 0 : ImplInheritanceHelper2(
194 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
195 : : T5 const & arg5):
196 : 0 : BaseClass(arg1, arg2, arg3, arg4, arg5) {}
197 : : template<
198 : : typename T1, typename T2, typename T3, typename T4, typename T5,
199 : : typename T6 >
200 : : ImplInheritanceHelper2(
201 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
202 : : T5 const & arg5, T6 const & arg6):
203 : : BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
204 : : public:
205 : 68298 : ImplInheritanceHelper2() {}
206 : 229636 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
207 : : {
208 [ + - ][ + - ]: 229636 : com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
[ + - ][ + - ]
209 [ + + ][ + + ]: 229636 : if (aRet.hasValue())
210 : 85847 : return aRet;
211 [ + - ][ + - ]: 229636 : return BaseClass::queryInterface( rType );
212 : : }
213 : 1128872 : virtual void SAL_CALL acquire() throw ()
214 : 1128872 : { BaseClass::acquire(); }
215 : 920848 : virtual void SAL_CALL release() throw ()
216 : 920848 : { BaseClass::release(); }
217 : 0 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
218 [ # # ][ # # ]: 0 : { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
[ # # ][ # # ]
219 : 366 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
220 : 366 : { return ImplHelper_getImplementationId( cd::get() ); }
221 : : };
222 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
223 : : com::sun::star::uno::XInterface inherting from a BaseClass.
224 : : All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
225 : : Upon queryAggregation(), if a demanded interface is not supported by this class directly,
226 : : the request is delegated to the BaseClass.
227 : :
228 : : @attention
229 : : The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface,
230 : : com::sun::star::uno::XAggregation and com::sun::star::lang::XTypeProvider
231 : : are implemented properly. The BaseClass must have at least one ctor
232 : : that can be called with six or fewer arguments, of which none is of
233 : : non-const reference type.
234 : :
235 : : @derive
236 : : Inherit from this class giving your additional interface(s) to be implemented as
237 : : template argument(s). Your sub class defines method implementations for these interface(s).
238 : : */
239 : : template< class BaseClass, class Ifc1, class Ifc2 >
240 [ - + ]: 245 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper2
241 : : : public BaseClass
242 : : , public Ifc1, public Ifc2
243 : : {
244 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, AggImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
245 : : protected:
246 : : template< typename T1 >
247 : 253 : explicit AggImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
248 : : template< typename T1, typename T2 >
249 : : AggImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
250 : : BaseClass(arg1, arg2) {}
251 : : template< typename T1, typename T2, typename T3 >
252 : : AggImplInheritanceHelper2(
253 : : T1 const & arg1, T2 const & arg2, T3 const & arg3):
254 : : BaseClass(arg1, arg2, arg3) {}
255 : : template< typename T1, typename T2, typename T3, typename T4 >
256 : : AggImplInheritanceHelper2(
257 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
258 : : BaseClass(arg1, arg2, arg3, arg4) {}
259 : : template<
260 : : typename T1, typename T2, typename T3, typename T4, typename T5 >
261 : : AggImplInheritanceHelper2(
262 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
263 : : T5 const & arg5):
264 : : BaseClass(arg1, arg2, arg3, arg4, arg5) {}
265 : : template<
266 : : typename T1, typename T2, typename T3, typename T4, typename T5,
267 : : typename T6 >
268 : : AggImplInheritanceHelper2(
269 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
270 : : T5 const & arg5, T6 const & arg6):
271 : : BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
272 : : public:
273 : : AggImplInheritanceHelper2() {}
274 : 2323 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
275 : 2323 : { return BaseClass::queryInterface( rType ); }
276 : 2345 : virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
277 : : {
278 [ + - ][ + - ]: 2345 : com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
[ # # ][ # # ]
279 [ + + ][ # # ]: 2345 : if (aRet.hasValue())
280 : 438 : return aRet;
281 [ + - ][ # # ]: 2345 : return BaseClass::queryAggregation( rType );
282 : : }
283 : 4000 : virtual void SAL_CALL acquire() throw ()
284 : 4000 : { BaseClass::acquire(); }
285 : 3944 : virtual void SAL_CALL release() throw ()
286 : 3944 : { BaseClass::release(); }
287 : 0 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
288 [ # # ][ # # ]: 0 : { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
[ # # ][ # # ]
289 : 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
290 : 0 : { return ImplHelper_getImplementationId( cd::get() ); }
291 : : };
292 : : }
293 : :
294 : : #endif
295 : :
296 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|