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_IMPLBASE10_HXX
20 : #define INCLUDED_CPPUHELPER_IMPLBASE10_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_data10
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[ 10 + 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 Impl >
39 : struct ImplClassData10
40 : {
41 0 : class_data* operator ()()
42 : {
43 : static class_data10 s_cd =
44 : {
45 : 10 +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 : { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
59 : }
60 : };
61 0 : 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, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
76 0 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper10
77 : : public com::sun::star::lang::XTypeProvider
78 : , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
79 : {
80 : struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, ImplHelper10<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
81 : public:
82 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
83 0 : { return ImplHelper_query( rType, cd::get(), this ); }
84 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
85 0 : { return ImplHelper_getTypes( cd::get() ); }
86 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
87 0 : { return ImplHelper_getImplementationId( cd::get() ); }
88 :
89 : #if !defined _MSC_VER // public -> protected changes mangled names there
90 : protected:
91 : #endif
92 0 : ~ImplHelper10() 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, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
103 0 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper10
104 : : public OWeakObject
105 : , public com::sun::star::lang::XTypeProvider
106 : , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
107 : {
108 : struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, WeakImplHelper10<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
109 : public:
110 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
111 0 : { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
112 0 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
113 0 : { OWeakObject::acquire(); }
114 0 : virtual void SAL_CALL release() throw () SAL_OVERRIDE
115 0 : { OWeakObject::release(); }
116 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
117 0 : { return WeakImplHelper_getTypes( cd::get() ); }
118 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
119 0 : { 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, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
135 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper10
136 : : public OWeakAggObject
137 : , public com::sun::star::lang::XTypeProvider
138 : , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
139 : {
140 : struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, WeakAggImplHelper10<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
141 : public:
142 : 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
143 : { return OWeakAggObject::queryInterface( rType ); }
144 : 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
145 : { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
146 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
147 : { OWeakAggObject::acquire(); }
148 : virtual void SAL_CALL release() throw () SAL_OVERRIDE
149 : { OWeakAggObject::release(); }
150 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
151 : { return WeakAggImplHelper_getTypes( cd::get() ); }
152 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
153 : { 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, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
172 0 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper10
173 : : public BaseClass
174 : , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
175 : {
176 : struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, ImplInheritanceHelper10<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
177 : protected:
178 : template< typename T1 >
179 : explicit ImplInheritanceHelper10(T1 const & arg1): BaseClass(arg1) {}
180 : template< typename T1, typename T2 >
181 : ImplInheritanceHelper10(T1 const & arg1, T2 const & arg2):
182 : BaseClass(arg1, arg2) {}
183 : template< typename T1, typename T2, typename T3 >
184 : ImplInheritanceHelper10(
185 : T1 const & arg1, T2 const & arg2, T3 const & arg3):
186 : BaseClass(arg1, arg2, arg3) {}
187 : template< typename T1, typename T2, typename T3, typename T4 >
188 : ImplInheritanceHelper10(
189 : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
190 : BaseClass(arg1, arg2, arg3, arg4) {}
191 : template<
192 : typename T1, typename T2, typename T3, typename T4, typename T5 >
193 : ImplInheritanceHelper10(
194 : T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
195 : T5 const & arg5):
196 : BaseClass(arg1, arg2, arg3, arg4, arg5) {}
197 : template<
198 : typename T1, typename T2, typename T3, typename T4, typename T5,
199 : typename T6 >
200 : ImplInheritanceHelper10(
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 0 : ImplInheritanceHelper10() {}
206 0 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
207 : {
208 0 : com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
209 0 : if (aRet.hasValue())
210 0 : return aRet;
211 0 : return BaseClass::queryInterface( rType );
212 : }
213 0 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
214 0 : { BaseClass::acquire(); }
215 0 : virtual void SAL_CALL release() throw () SAL_OVERRIDE
216 0 : { BaseClass::release(); }
217 0 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
218 0 : { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
219 0 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
220 0 : { 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, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10 >
240 : class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper10
241 : : public BaseClass
242 : , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10
243 : {
244 : struct cd : public rtl::StaticAggregate< class_data, ImplClassData10< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, AggImplInheritanceHelper10<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10> > > {};
245 : protected:
246 : template< typename T1 >
247 : explicit AggImplInheritanceHelper10(T1 const & arg1): BaseClass(arg1) {}
248 : template< typename T1, typename T2 >
249 : AggImplInheritanceHelper10(T1 const & arg1, T2 const & arg2):
250 : BaseClass(arg1, arg2) {}
251 : template< typename T1, typename T2, typename T3 >
252 : AggImplInheritanceHelper10(
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 : AggImplInheritanceHelper10(
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 : AggImplInheritanceHelper10(
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 : AggImplInheritanceHelper10(
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 : AggImplInheritanceHelper10() {}
274 : virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
275 : { return BaseClass::queryInterface( rType ); }
276 : virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
277 : {
278 : com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
279 : if (aRet.hasValue())
280 : return aRet;
281 : return BaseClass::queryAggregation( rType );
282 : }
283 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
284 : { BaseClass::acquire(); }
285 : virtual void SAL_CALL release() throw () SAL_OVERRIDE
286 : { BaseClass::release(); }
287 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
288 : { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
289 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
290 : { return ImplHelper_getImplementationId( cd::get() ); }
291 : };
292 : }
293 :
294 : #endif
295 :
296 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|