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_IMPLBASE1_HXX_
29 : : #define _CPPUHELPER_IMPLBASE1_HXX_
30 : :
31 : : #include <cppuhelper/implbase_ex.hxx>
32 : : #include <rtl/instance.hxx>
33 : : #include <com/sun/star/uno/XComponentContext.hpp>
34 : :
35 : : namespace cppu
36 : : {
37 : : /// @cond INTERNAL
38 : :
39 : : struct class_data1
40 : : {
41 : : sal_Int16 m_nTypes;
42 : : sal_Bool m_storedTypeRefs;
43 : : sal_Bool m_storedId;
44 : : sal_Int8 m_id[ 16 ];
45 : : type_entry m_typeEntries[ 1 + 1 ];
46 : : };
47 : :
48 : : template< typename Ifc1, typename Impl > struct ImplClassData1
49 : : {
50 : 12468 : class_data* operator ()()
51 : : {
52 : : static class_data1 s_cd =
53 : : {
54 : : 1 +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 : : { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
59 : : }
60 : : };
61 : 12468 : 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 method XInterface::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 sub class defines method implementations for these interface(s) including acquire()/
73 : : release() and delegates incoming queryInterface() calls to this base class.
74 : : */
75 : : template< class Ifc1 >
76 : 45449 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper1
77 : : : public com::sun::star::lang::XTypeProvider
78 : : , public Ifc1
79 : : {
80 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData1 < Ifc1, ImplHelper1<Ifc1> > > {};
81 : : public:
82 : 696415 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
83 : 696415 : { return ImplHelper_query( rType, cd::get(), this ); }
84 : 92 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
85 : 92 : { return ImplHelper_getTypes( cd::get() ); }
86 : 8 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
87 : 8 : { return ImplHelper_getImplementationId( cd::get() ); }
88 : :
89 : : #if !defined _MSC_VER // public -> protected changes mangled names there
90 : : protected:
91 : : #endif
92 : 43189 : ~ImplHelper1() 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 : : These classes are used when you implement your UNO component.
103 : : WeakImplHelper1 till WeakImplHelper12 can be used when you want
104 : : to implement 1 till 12 interfaces in your component.
105 : : */
106 : : template< class Ifc1 >
107 [ - + ][ - + ]: 4687469 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper1
[ - + ][ - + ]
[ - + ][ - + ]
[ # # ][ - + ]
[ # # ][ - + ]
[ - + ][ - + ]
[ # # ][ # # ]
[ - + ]
[ # # # # ]
[ # # ][ - + ]
[ # # ]
[ # # - + ]
[ # # ][ # # ]
[ # # ]
[ # # # # ]
[ # # - + ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
108 : : : public OWeakObject
109 : : , public com::sun::star::lang::XTypeProvider
110 : : , public Ifc1
111 : : {
112 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakImplHelper1< Ifc1 > > > {};
113 : : public:
114 : 740021 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
115 : 740021 : { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
116 : 12233975 : virtual void SAL_CALL acquire() throw ()
117 : 12233975 : { OWeakObject::acquire(); }
118 : 12154007 : virtual void SAL_CALL release() throw ()
119 : 12154007 : { OWeakObject::release(); }
120 : 768 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
121 : 768 : { return WeakImplHelper_getTypes( cd::get() ); }
122 : 776 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
123 : 776 : { 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 >
139 [ - + ]: 159222 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper1
140 : : : public OWeakAggObject
141 : : , public com::sun::star::lang::XTypeProvider
142 : : , public Ifc1
143 : : {
144 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggImplHelper1< Ifc1 > > > {};
145 : : public:
146 : 497 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
147 : 497 : { return OWeakAggObject::queryInterface( rType ); }
148 : 317 : virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
149 : 317 : { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
150 : 3573 : virtual void SAL_CALL acquire() throw ()
151 : 3573 : { OWeakAggObject::acquire(); }
152 : 3563 : virtual void SAL_CALL release() throw ()
153 : 3563 : { 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 >
176 [ - + ][ - + ]: 462268 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper1
[ - + ][ # # ]
177 : : : public BaseClass
178 : : , public Ifc1
179 : : {
180 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, ImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
181 : : protected:
182 : : #if (defined __SUNPRO_CC && __SUNPRO_CC <= 0x550)
183 : : // Hack, to get comphelper::service_decl to work for non-trivial impl classes
184 : : ImplInheritanceHelper1( com::sun::star::uno::Sequence<com::sun::star::uno::Any> const& args,
185 : : com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const& xContext ) : BaseClass(args,xContext) {}
186 : : #endif
187 : : template< typename T1 >
188 : 869 : explicit ImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
189 : : template< typename T1, typename T2 >
190 : 3513 : ImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
191 : 3513 : BaseClass(arg1, arg2) {}
192 : : template< typename T1, typename T2, typename T3 >
193 : 8 : ImplInheritanceHelper1(
194 : : T1 const & arg1, T2 const & arg2, T3 const & arg3):
195 [ # # ]: 8 : BaseClass(arg1, arg2, arg3) {}
196 : : template< typename T1, typename T2, typename T3, typename T4 >
197 : 178946 : ImplInheritanceHelper1(
198 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
199 : 178946 : BaseClass(arg1, arg2, arg3, arg4) {}
200 : : template<
201 : : typename T1, typename T2, typename T3, typename T4, typename T5 >
202 : 0 : ImplInheritanceHelper1(
203 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
204 : : T5 const & arg5):
205 : 0 : BaseClass(arg1, arg2, arg3, arg4, arg5) {}
206 : : template<
207 : : typename T1, typename T2, typename T3, typename T4, typename T5,
208 : : typename T6 >
209 : 0 : ImplInheritanceHelper1(
210 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
211 : : T5 const & arg5, T6 const & arg6):
212 [ # # ][ # # ]: 0 : BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
213 : : public:
214 : 279520 : ImplInheritanceHelper1() {}
215 : 1916191 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
216 : : {
217 [ + - ][ + - ]: 1916191 : com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
218 [ + + ][ + + ]: 1916191 : if (aRet.hasValue())
[ + + ][ - + ]
219 : 817610 : return aRet;
220 [ + - ][ + - ]: 1916191 : return BaseClass::queryInterface( rType );
[ + - ][ + - ]
221 : : }
222 : 8664865 : virtual void SAL_CALL acquire() throw ()
223 : 8664865 : { BaseClass::acquire(); }
224 : 8664230 : virtual void SAL_CALL release() throw ()
225 : 8664230 : { BaseClass::release(); }
226 : 12 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
227 [ + - ][ + - ]: 12 : { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
[ # # ][ # # ]
[ + - ][ + - ]
[ # # ][ # # ]
228 : 12 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
229 : 12 : { return ImplHelper_getImplementationId( cd::get() ); }
230 : : };
231 : : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
232 : : com::sun::star::uno::XInterface inherting from a BaseClass.
233 : : All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
234 : : Upon queryAggregation(), if a demanded interface is not supported by this class directly,
235 : : the request is delegated to the BaseClass.
236 : :
237 : : @attention
238 : : The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface,
239 : : com::sun::star::uno::XAggregation and com::sun::star::lang::XTypeProvider
240 : : are implemented properly. The BaseClass must have at least one ctor
241 : : that can be called with six or fewer arguments, of which none is of
242 : : non-const reference type.
243 : :
244 : : @derive
245 : : Inherit from this class giving your additional interface(s) to be implemented as
246 : : template argument(s). Your sub class defines method implementations for these interface(s).
247 : : */
248 : : template< class BaseClass, class Ifc1 >
249 [ - + ][ - + ]: 5322 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper1
250 : : : public BaseClass
251 : : , public Ifc1
252 : : {
253 : : struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, AggImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
254 : : protected:
255 : : template< typename T1 >
256 : 5322 : explicit AggImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
257 : : template< typename T1, typename T2 >
258 : : AggImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
259 : : BaseClass(arg1, arg2) {}
260 : : template< typename T1, typename T2, typename T3 >
261 : : AggImplInheritanceHelper1(
262 : : T1 const & arg1, T2 const & arg2, T3 const & arg3):
263 : : BaseClass(arg1, arg2, arg3) {}
264 : : template< typename T1, typename T2, typename T3, typename T4 >
265 : : AggImplInheritanceHelper1(
266 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
267 : : BaseClass(arg1, arg2, arg3, arg4) {}
268 : : template<
269 : : typename T1, typename T2, typename T3, typename T4, typename T5 >
270 : : AggImplInheritanceHelper1(
271 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
272 : : T5 const & arg5):
273 : : BaseClass(arg1, arg2, arg3, arg4, arg5) {}
274 : : template<
275 : : typename T1, typename T2, typename T3, typename T4, typename T5,
276 : : typename T6 >
277 : : AggImplInheritanceHelper1(
278 : : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
279 : : T5 const & arg5, T6 const & arg6):
280 : : BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
281 : : public:
282 : : AggImplInheritanceHelper1() {}
283 : 20864 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
284 : 20864 : { return BaseClass::queryInterface( rType ); }
285 : 23063 : virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
286 : : {
287 [ + - ][ + - ]: 23063 : com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
[ + - ][ + - ]
288 [ + + ][ + + ]: 23063 : if (aRet.hasValue())
289 : 3172 : return aRet;
290 [ + - ][ + - ]: 23063 : return BaseClass::queryAggregation( rType );
291 : : }
292 : 57668 : virtual void SAL_CALL acquire() throw ()
293 : 57668 : { BaseClass::acquire(); }
294 : 57668 : virtual void SAL_CALL release() throw ()
295 : 57668 : { BaseClass::release(); }
296 : 8 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
297 [ # # ][ # # ]: 8 : { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
[ + - ][ + - ]
298 : 8 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
299 : 8 : { return ImplHelper_getImplementationId( cd::get() ); }
300 : : };
301 : : }
302 : :
303 : : #endif
304 : :
305 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|