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