Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / cppuhelper / implbase11.hxx
blob2eccf402e3f99085d2c72214f6582b7b4b512cf4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_CPPUHELPER_IMPLBASE11_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE11_HXX
22 #include <cppuhelper/implbase_ex.hxx>
23 #include <rtl/instance.hxx>
25 namespace cppu
27 /// @cond INTERNAL
29 struct class_data11
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 ];
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 SAL_WARN_UNUSED ImplClassData11
41 class_data* operator ()()
43 static class_data11 s_cd =
45 11 +1, false, false,
46 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
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(css::lang::XTypeProvider)
62 return reinterpret_cast< class_data * >(&s_cd);
66 /// @endcond
68 /** Implementation helper implementing interface css::lang::XTypeProvider
69 and method XInterface::queryInterface(), but no reference counting.
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.
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 css::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
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 css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
84 { return ImplHelper_query( rType, cd::get(), this ); }
85 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
86 { return ImplHelper_getTypes( cd::get() ); }
87 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
88 { return ImplHelper_getImplementationId( cd::get() ); }
90 #if !defined _MSC_VER // public -> protected changes mangled names there
91 protected:
92 #elif defined __clang__
93 #pragma clang diagnostic push
94 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
95 #endif
96 ~ImplHelper11() throw () {}
97 #if defined _MSC_VER && defined __clang__
98 #pragma clang diagnostic pop
99 #endif
101 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
102 css::uno::XInterface which supports weak mechanism to be held weakly
103 (supporting css::uno::XWeak through ::cppu::OWeakObject).
105 @derive
106 Inherit from this class giving your interface(s) to be implemented as template argument(s).
107 Your sub class defines method implementations for these interface(s).
109 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 >
110 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper11
111 : public OWeakObject
112 , public css::lang::XTypeProvider
113 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
115 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> > > {};
116 public:
117 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
118 { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
119 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
120 { OWeakObject::acquire(); }
121 virtual void SAL_CALL release() throw () SAL_OVERRIDE
122 { OWeakObject::release(); }
123 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
124 { return WeakImplHelper_getTypes( cd::get() ); }
125 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
126 { return ImplHelper_getImplementationId( cd::get() ); }
128 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
129 css::uno::XInterface which supports weak mechanism to be held weakly
130 (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
131 In addition, it supports also aggregation meaning object of this class can be aggregated
132 (css::uno::XAggregation through ::cppu::OWeakAggObject).
133 If a delegator is set (this object is aggregated), then incoming queryInterface()
134 calls are delegated to the delegator object. If the delegator does not support the
135 demanded interface, it calls queryAggregation() on its aggregated objects.
137 @derive
138 Inherit from this class giving your interface(s) to be implemented as template argument(s).
139 Your sub class defines method implementations for these interface(s).
141 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10, class Ifc11 >
142 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper11
143 : public OWeakAggObject
144 , public css::lang::XTypeProvider
145 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
147 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> > > {};
148 public:
149 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
150 { return OWeakAggObject::queryInterface( rType ); }
151 virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
152 { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
153 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
154 { OWeakAggObject::acquire(); }
155 virtual void SAL_CALL release() throw () SAL_OVERRIDE
156 { OWeakAggObject::release(); }
157 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
158 { return WeakAggImplHelper_getTypes( cd::get() ); }
159 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
160 { return ImplHelper_getImplementationId( cd::get() ); }
162 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
163 css::uno::XInterface inherting from a BaseClass.
164 All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
165 if a demanded interface is not supported by this class directly, the request is
166 delegated to the BaseClass.
168 @attention
169 The BaseClass has to be complete in a sense, that css::uno::XInterface
170 and css::lang::XTypeProvider are implemented properly. The
171 BaseClass must have at least one ctor that can be called with six or
172 fewer arguments, of which none is of non-const reference type.
174 @derive
175 Inherit from this class giving your additional interface(s) to be implemented as
176 template argument(s). Your sub class defines method implementations for these interface(s).
178 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 >
179 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper11
180 : public BaseClass
181 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
183 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> > > {};
184 protected:
185 template< typename T1 >
186 explicit ImplInheritanceHelper11(T1 const & arg1): BaseClass(arg1) {}
187 template< typename T1, typename T2 >
188 ImplInheritanceHelper11(T1 const & arg1, T2 const & arg2):
189 BaseClass(arg1, arg2) {}
190 template< typename T1, typename T2, typename T3 >
191 ImplInheritanceHelper11(
192 T1 const & arg1, T2 const & arg2, T3 const & arg3):
193 BaseClass(arg1, arg2, arg3) {}
194 template< typename T1, typename T2, typename T3, typename T4 >
195 ImplInheritanceHelper11(
196 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
197 BaseClass(arg1, arg2, arg3, arg4) {}
198 template<
199 typename T1, typename T2, typename T3, typename T4, typename T5 >
200 ImplInheritanceHelper11(
201 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
202 T5 const & arg5):
203 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
204 template<
205 typename T1, typename T2, typename T3, typename T4, typename T5,
206 typename T6 >
207 ImplInheritanceHelper11(
208 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
209 T5 const & arg5, T6 const & arg6):
210 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
211 public:
212 ImplInheritanceHelper11() {}
213 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
215 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
216 if (aRet.hasValue())
217 return aRet;
218 return BaseClass::queryInterface( rType );
220 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
221 { BaseClass::acquire(); }
222 virtual void SAL_CALL release() throw () SAL_OVERRIDE
223 { BaseClass::release(); }
224 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
225 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
226 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
227 { return ImplHelper_getImplementationId( cd::get() ); }
229 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
230 css::uno::XInterface inherting from a BaseClass.
231 All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
232 Upon queryAggregation(), if a demanded interface is not supported by this class directly,
233 the request is delegated to the BaseClass.
235 @attention
236 The BaseClass has to be complete in a sense, that css::uno::XInterface,
237 css::uno::XAggregation and css::lang::XTypeProvider
238 are implemented properly. The BaseClass must have at least one ctor
239 that can be called with six or fewer arguments, of which none is of
240 non-const reference type.
242 @derive
243 Inherit from this class giving your additional interface(s) to be implemented as
244 template argument(s). Your sub class defines method implementations for these interface(s).
246 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 >
247 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper11
248 : public BaseClass
249 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9, public Ifc10, public Ifc11
251 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> > > {};
252 protected:
253 template< typename T1 >
254 explicit AggImplInheritanceHelper11(T1 const & arg1): BaseClass(arg1) {}
255 template< typename T1, typename T2 >
256 AggImplInheritanceHelper11(T1 const & arg1, T2 const & arg2):
257 BaseClass(arg1, arg2) {}
258 template< typename T1, typename T2, typename T3 >
259 AggImplInheritanceHelper11(
260 T1 const & arg1, T2 const & arg2, T3 const & arg3):
261 BaseClass(arg1, arg2, arg3) {}
262 template< typename T1, typename T2, typename T3, typename T4 >
263 AggImplInheritanceHelper11(
264 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
265 BaseClass(arg1, arg2, arg3, arg4) {}
266 template<
267 typename T1, typename T2, typename T3, typename T4, typename T5 >
268 AggImplInheritanceHelper11(
269 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
270 T5 const & arg5):
271 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
272 template<
273 typename T1, typename T2, typename T3, typename T4, typename T5,
274 typename T6 >
275 AggImplInheritanceHelper11(
276 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
277 T5 const & arg5, T6 const & arg6):
278 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
279 public:
280 AggImplInheritanceHelper11() {}
281 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
282 { return BaseClass::queryInterface( rType ); }
283 virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
285 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
286 if (aRet.hasValue())
287 return aRet;
288 return BaseClass::queryAggregation( rType );
290 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
291 { BaseClass::acquire(); }
292 virtual void SAL_CALL release() throw () SAL_OVERRIDE
293 { BaseClass::release(); }
294 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
295 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
296 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
297 { return ImplHelper_getImplementationId( cd::get() ); }
301 #endif
303 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */