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