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