Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _CPPUHELPER_IMPLBASE4_HXX_
20 : #define _CPPUHELPER_IMPLBASE4_HXX_
21 :
22 : #include <cppuhelper/implbase_ex.hxx>
23 : #include <rtl/instance.hxx>
24 :
25 : namespace cppu
26 : {
27 : /// @cond INTERNAL
28 :
29 : struct class_data4
30 : {
31 : sal_Int16 m_nTypes;
32 : sal_Bool m_storedTypeRefs;
33 : sal_Bool m_storedId;
34 : sal_Int8 m_id[ 16 ];
35 : type_entry m_typeEntries[ 4 + 1 ];
36 : };
37 :
38 : template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Impl >
39 : struct ImplClassData4
40 : {
41 1181 : class_data* operator ()()
42 : {
43 : static class_data4 s_cd =
44 : {
45 : 4 +1, sal_False, sal_False,
46 : { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
47 : {
48 : { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 },
49 : { { Ifc2::static_type }, ((sal_IntPtr)(Ifc2 *) (Impl *) 16) - 16 },
50 : { { Ifc3::static_type }, ((sal_IntPtr)(Ifc3 *) (Impl *) 16) - 16 },
51 : { { Ifc4::static_type }, ((sal_IntPtr)(Ifc4 *) (Impl *) 16) - 16 },
52 : { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
53 : }
54 : };
55 1181 : return reinterpret_cast< class_data * >(&s_cd);
56 : }
57 : };
58 :
59 : /// @endcond
60 :
61 : /** Implementation helper implementing interface com::sun::star::lang::XTypeProvider
62 : and method XInterface::queryInterface(), but no reference counting.
63 :
64 : @derive
65 : Inherit from this class giving your interface(s) to be implemented as template argument(s).
66 : Your sub class defines method implementations for these interface(s) including acquire()/
67 : release() and delegates incoming queryInterface() calls to this base class.
68 : */
69 : template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
70 1078 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper4
71 : : public com::sun::star::lang::XTypeProvider
72 : , public Ifc1, public Ifc2, public Ifc3, public Ifc4
73 : {
74 : struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, ImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
75 : public:
76 13017 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
77 13017 : { return ImplHelper_query( rType, cd::get(), this ); }
78 93 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
79 93 : { return ImplHelper_getTypes( cd::get() ); }
80 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
81 0 : { return ImplHelper_getImplementationId( cd::get() ); }
82 :
83 : #if !defined _MSC_VER // public -> protected changes mangled names there
84 : protected:
85 : #endif
86 1011 : ~ImplHelper4() throw () {}
87 : };
88 : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
89 : com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
90 : (supporting com::sun::star::uno::XWeak thru ::cppu::OWeakObject).
91 :
92 : @derive
93 : Inherit from this class giving your interface(s) to be implemented as template argument(s).
94 : Your sub class defines method implementations for these interface(s).
95 : */
96 : template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
97 71210 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper4
98 : : public OWeakObject
99 : , public com::sun::star::lang::XTypeProvider
100 : , public Ifc1, public Ifc2, public Ifc3, public Ifc4
101 : {
102 : struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
103 : public:
104 82043 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
105 82043 : { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
106 385012 : virtual void SAL_CALL acquire() throw ()
107 385012 : { OWeakObject::acquire(); }
108 384845 : virtual void SAL_CALL release() throw ()
109 384845 : { OWeakObject::release(); }
110 2 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
111 2 : { return WeakImplHelper_getTypes( cd::get() ); }
112 2 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
113 2 : { return ImplHelper_getImplementationId( cd::get() ); }
114 : };
115 : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
116 : com::sun::star::uno::XInterface which supports weak mechanism to be held weakly
117 : (supporting com::sun::star::uno::XWeak thru ::cppu::OWeakAggObject).
118 : In addition, it supports also aggregation meaning object of this class can be aggregated
119 : (com::sun::star::uno::XAggregation thru ::cppu::OWeakAggObject).
120 : If a delegator is set (this object is aggregated), then incoming queryInterface()
121 : calls are delegated to the delegator object. If the delegator does not support the
122 : demanded interface, it calls queryAggregation() on its aggregated objects.
123 :
124 : @derive
125 : Inherit from this class giving your interface(s) to be implemented as template argument(s).
126 : Your sub class defines method implementations for these interface(s).
127 : */
128 : template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
129 1690 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper4
130 : : public OWeakAggObject
131 : , public com::sun::star::lang::XTypeProvider
132 : , public Ifc1, public Ifc2, public Ifc3, public Ifc4
133 : {
134 : struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakAggImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
135 : public:
136 39656 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
137 39656 : { return OWeakAggObject::queryInterface( rType ); }
138 39656 : virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
139 39656 : { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
140 235323 : virtual void SAL_CALL acquire() throw ()
141 235323 : { OWeakAggObject::acquire(); }
142 235321 : virtual void SAL_CALL release() throw ()
143 235321 : { OWeakAggObject::release(); }
144 0 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
145 0 : { return WeakAggImplHelper_getTypes( cd::get() ); }
146 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
147 0 : { return ImplHelper_getImplementationId( cd::get() ); }
148 : };
149 : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
150 : com::sun::star::uno::XInterface inherting from a BaseClass.
151 : All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
152 : if a demanded interface is not supported by this class directly, the request is
153 : delegated to the BaseClass.
154 :
155 : @attention
156 : The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface
157 : and com::sun::star::lang::XTypeProvider are implemented properly. The
158 : BaseClass must have at least one ctor that can be called with six or
159 : fewer arguments, of which none is of non-const reference type.
160 :
161 : @derive
162 : Inherit from this class giving your additional interface(s) to be implemented as
163 : template argument(s). Your sub class defines method implementations for these interface(s).
164 : */
165 : template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
166 212 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper4
167 : : public BaseClass
168 : , public Ifc1, public Ifc2, public Ifc3, public Ifc4
169 : {
170 : struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, ImplInheritanceHelper4<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4> > > {};
171 : protected:
172 : template< typename T1 >
173 91 : explicit ImplInheritanceHelper4(T1 const & arg1): BaseClass(arg1) {}
174 : template< typename T1, typename T2 >
175 : ImplInheritanceHelper4(T1 const & arg1, T2 const & arg2):
176 : BaseClass(arg1, arg2) {}
177 : template< typename T1, typename T2, typename T3 >
178 : ImplInheritanceHelper4(
179 : T1 const & arg1, T2 const & arg2, T3 const & arg3):
180 : BaseClass(arg1, arg2, arg3) {}
181 : template< typename T1, typename T2, typename T3, typename T4 >
182 : ImplInheritanceHelper4(
183 : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
184 : BaseClass(arg1, arg2, arg3, arg4) {}
185 : template<
186 : typename T1, typename T2, typename T3, typename T4, typename T5 >
187 : ImplInheritanceHelper4(
188 : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
189 : T5 const & arg5):
190 : BaseClass(arg1, arg2, arg3, arg4, arg5) {}
191 : template<
192 : typename T1, typename T2, typename T3, typename T4, typename T5,
193 : typename T6 >
194 : ImplInheritanceHelper4(
195 : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
196 : T5 const & arg5, T6 const & arg6):
197 : BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
198 : public:
199 124 : ImplInheritanceHelper4() {}
200 594 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
201 : {
202 594 : com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
203 594 : if (aRet.hasValue())
204 249 : return aRet;
205 345 : return BaseClass::queryInterface( rType );
206 : }
207 9396 : virtual void SAL_CALL acquire() throw ()
208 9396 : { BaseClass::acquire(); }
209 9147 : virtual void SAL_CALL release() throw ()
210 9147 : { BaseClass::release(); }
211 0 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
212 0 : { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
213 50 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
214 50 : { return ImplHelper_getImplementationId( cd::get() ); }
215 : };
216 : /** Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and
217 : com::sun::star::uno::XInterface inherting from a BaseClass.
218 : All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
219 : Upon queryAggregation(), if a demanded interface is not supported by this class directly,
220 : the request is delegated to the BaseClass.
221 :
222 : @attention
223 : The BaseClass has to be complete in a sense, that com::sun::star::uno::XInterface,
224 : com::sun::star::uno::XAggregation and com::sun::star::lang::XTypeProvider
225 : are implemented properly. The BaseClass must have at least one ctor
226 : that can be called with six or fewer arguments, of which none is of
227 : non-const reference type.
228 :
229 : @derive
230 : Inherit from this class giving your additional interface(s) to be implemented as
231 : template argument(s). Your sub class defines method implementations for these interface(s).
232 : */
233 : template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
234 628 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper4
235 : : public BaseClass
236 : , public Ifc1, public Ifc2, public Ifc3, public Ifc4
237 : {
238 : struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, AggImplInheritanceHelper4<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4> > > {};
239 : protected:
240 : template< typename T1 >
241 : explicit AggImplInheritanceHelper4(T1 const & arg1): BaseClass(arg1) {}
242 : template< typename T1, typename T2 >
243 : AggImplInheritanceHelper4(T1 const & arg1, T2 const & arg2):
244 : BaseClass(arg1, arg2) {}
245 : template< typename T1, typename T2, typename T3 >
246 : AggImplInheritanceHelper4(
247 : T1 const & arg1, T2 const & arg2, T3 const & arg3):
248 : BaseClass(arg1, arg2, arg3) {}
249 : template< typename T1, typename T2, typename T3, typename T4 >
250 : AggImplInheritanceHelper4(
251 : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
252 : BaseClass(arg1, arg2, arg3, arg4) {}
253 : template<
254 : typename T1, typename T2, typename T3, typename T4, typename T5 >
255 : AggImplInheritanceHelper4(
256 : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
257 : T5 const & arg5):
258 : BaseClass(arg1, arg2, arg3, arg4, arg5) {}
259 : template<
260 : typename T1, typename T2, typename T3, typename T4, typename T5,
261 : typename T6 >
262 : AggImplInheritanceHelper4(
263 : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
264 : T5 const & arg5, T6 const & arg6):
265 : BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
266 : public:
267 651 : AggImplInheritanceHelper4() {}
268 10720 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
269 10720 : { return BaseClass::queryInterface( rType ); }
270 11790 : virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
271 : {
272 11790 : com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
273 11790 : if (aRet.hasValue())
274 1270 : return aRet;
275 10520 : return BaseClass::queryAggregation( rType );
276 : }
277 31872 : virtual void SAL_CALL acquire() throw ()
278 31872 : { BaseClass::acquire(); }
279 31735 : virtual void SAL_CALL release() throw ()
280 31735 : { BaseClass::release(); }
281 120 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
282 120 : { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
283 22 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
284 22 : { return ImplHelper_getImplementationId( cd::get() ); }
285 : };
286 : }
287 :
288 : #endif
289 :
290 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|