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