bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / cppuhelper / implbase8.hxx
blob08dec44e42150bf98a5e3385ae97728e47112801
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_IMPLBASE8_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE8_HXX
22 #include "cppuhelper/implbase_ex.hxx"
23 #include "rtl/instance.hxx"
24 #include "cppuhelper/weak.hxx"
25 #include "cppuhelper/weakagg.hxx"
26 #include "com/sun/star/lang/XTypeProvider.hpp"
28 namespace cppu
30 /// @cond INTERNAL
32 struct class_data8
34 sal_Int16 m_nTypes;
35 sal_Bool m_storedTypeRefs;
36 sal_Bool m_storedId;
37 sal_Int8 m_id[ 16 ];
38 type_entry m_typeEntries[ 8 + 1 ];
41 template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Impl >
42 struct SAL_WARN_UNUSED ImplClassData8
44 class_data* operator ()()
46 static class_data8 s_cd =
48 8 +1, false, false,
49 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
51 CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
52 CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
53 CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
54 CPPUHELPER_DETAIL_TYPEENTRY(Ifc4),
55 CPPUHELPER_DETAIL_TYPEENTRY(Ifc5),
56 CPPUHELPER_DETAIL_TYPEENTRY(Ifc6),
57 CPPUHELPER_DETAIL_TYPEENTRY(Ifc7),
58 CPPUHELPER_DETAIL_TYPEENTRY(Ifc8),
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 >
77 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper8
78 : public css::lang::XTypeProvider
79 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
81 struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, ImplHelper8<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
82 public:
83 #if defined LIBO_INTERNAL_ONLY
84 ImplHelper8() = default;
85 ImplHelper8(ImplHelper8 const &) = default;
86 ImplHelper8(ImplHelper8 &&) = default;
87 ImplHelper8 & operator =(ImplHelper8 const &) = default;
88 ImplHelper8 & operator =(ImplHelper8 &&) = default;
89 #endif
91 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
92 { return ImplHelper_query( rType, cd::get(), this ); }
93 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
94 { return ImplHelper_getTypes( cd::get() ); }
95 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
96 { return ImplHelper_getImplementationId( cd::get() ); }
98 #if !defined _MSC_VER // public -> protected changes mangled names there
99 protected:
100 #elif defined __clang__
101 #pragma clang diagnostic push
102 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
103 #endif
104 ~ImplHelper8() throw () {}
105 #if defined _MSC_VER && defined __clang__
106 #pragma clang diagnostic pop
107 #endif
109 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
110 css::uno::XInterface which supports weak mechanism to be held weakly
111 (supporting css::uno::XWeak through ::cppu::OWeakObject).
113 @derive
114 Inherit from this class giving your interface(s) to be implemented as template argument(s).
115 Your sub class defines method implementations for these interface(s).
117 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
118 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper8
119 : public OWeakObject
120 , public css::lang::XTypeProvider
121 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
123 struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, WeakImplHelper8<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
124 public:
125 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
126 { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
127 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
128 { OWeakObject::acquire(); }
129 virtual void SAL_CALL release() throw () SAL_OVERRIDE
130 { OWeakObject::release(); }
131 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
132 { return WeakImplHelper_getTypes( cd::get() ); }
133 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
134 { return ImplHelper_getImplementationId( cd::get() ); }
136 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
137 css::uno::XInterface which supports weak mechanism to be held weakly
138 (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
139 In addition, it supports also aggregation meaning object of this class can be aggregated
140 (css::uno::XAggregation through ::cppu::OWeakAggObject).
141 If a delegator is set (this object is aggregated), then incoming queryInterface()
142 calls are delegated to the delegator object. If the delegator does not support the
143 demanded interface, it calls queryAggregation() on its aggregated objects.
145 @derive
146 Inherit from this class giving your interface(s) to be implemented as template argument(s).
147 Your sub class defines method implementations for these interface(s).
149 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
150 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper8
151 : public OWeakAggObject
152 , public css::lang::XTypeProvider
153 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
155 struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, WeakAggImplHelper8<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
156 public:
157 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
158 { return OWeakAggObject::queryInterface( rType ); }
159 virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
160 { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
161 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
162 { OWeakAggObject::acquire(); }
163 virtual void SAL_CALL release() throw () SAL_OVERRIDE
164 { OWeakAggObject::release(); }
165 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
166 { return WeakAggImplHelper_getTypes( cd::get() ); }
167 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
168 { return ImplHelper_getImplementationId( cd::get() ); }
170 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
171 css::uno::XInterface inherting from a BaseClass.
172 All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
173 if a demanded interface is not supported by this class directly, the request is
174 delegated to the BaseClass.
176 @attention
177 The BaseClass has to be complete in a sense, that css::uno::XInterface
178 and css::lang::XTypeProvider are implemented properly. The
179 BaseClass must have at least one ctor that can be called with six or
180 fewer arguments, of which none is of non-const reference type.
182 @derive
183 Inherit from this class giving your additional interface(s) to be implemented as
184 template argument(s). Your sub class defines method implementations for these interface(s).
186 template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
187 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper8
188 : public BaseClass
189 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
191 struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, ImplInheritanceHelper8<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
192 protected:
193 template< typename T1 >
194 explicit ImplInheritanceHelper8(T1 const & arg1): BaseClass(arg1) {}
195 template< typename T1, typename T2 >
196 ImplInheritanceHelper8(T1 const & arg1, T2 const & arg2):
197 BaseClass(arg1, arg2) {}
198 template< typename T1, typename T2, typename T3 >
199 ImplInheritanceHelper8(
200 T1 const & arg1, T2 const & arg2, T3 const & arg3):
201 BaseClass(arg1, arg2, arg3) {}
202 template< typename T1, typename T2, typename T3, typename T4 >
203 ImplInheritanceHelper8(
204 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
205 BaseClass(arg1, arg2, arg3, arg4) {}
206 template<
207 typename T1, typename T2, typename T3, typename T4, typename T5 >
208 ImplInheritanceHelper8(
209 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
210 T5 const & arg5):
211 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
212 template<
213 typename T1, typename T2, typename T3, typename T4, typename T5,
214 typename T6 >
215 ImplInheritanceHelper8(
216 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
217 T5 const & arg5, T6 const & arg6):
218 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
219 public:
220 ImplInheritanceHelper8() {}
221 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
223 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
224 if (aRet.hasValue())
225 return aRet;
226 return BaseClass::queryInterface( rType );
228 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
229 { BaseClass::acquire(); }
230 virtual void SAL_CALL release() throw () SAL_OVERRIDE
231 { BaseClass::release(); }
232 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
233 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
234 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
235 { return ImplHelper_getImplementationId( cd::get() ); }
237 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
238 css::uno::XInterface inherting from a BaseClass.
239 All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
240 Upon queryAggregation(), if a demanded interface is not supported by this class directly,
241 the request is delegated to the BaseClass.
243 @attention
244 The BaseClass has to be complete in a sense, that css::uno::XInterface,
245 css::uno::XAggregation and css::lang::XTypeProvider
246 are implemented properly. The BaseClass must have at least one ctor
247 that can be called with six or fewer arguments, of which none is of
248 non-const reference type.
250 @derive
251 Inherit from this class giving your additional interface(s) to be implemented as
252 template argument(s). Your sub class defines method implementations for these interface(s).
254 template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
255 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper8
256 : public BaseClass
257 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
259 struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, AggImplInheritanceHelper8<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
260 protected:
261 template< typename T1 >
262 explicit AggImplInheritanceHelper8(T1 const & arg1): BaseClass(arg1) {}
263 template< typename T1, typename T2 >
264 AggImplInheritanceHelper8(T1 const & arg1, T2 const & arg2):
265 BaseClass(arg1, arg2) {}
266 template< typename T1, typename T2, typename T3 >
267 AggImplInheritanceHelper8(
268 T1 const & arg1, T2 const & arg2, T3 const & arg3):
269 BaseClass(arg1, arg2, arg3) {}
270 template< typename T1, typename T2, typename T3, typename T4 >
271 AggImplInheritanceHelper8(
272 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
273 BaseClass(arg1, arg2, arg3, arg4) {}
274 template<
275 typename T1, typename T2, typename T3, typename T4, typename T5 >
276 AggImplInheritanceHelper8(
277 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
278 T5 const & arg5):
279 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
280 template<
281 typename T1, typename T2, typename T3, typename T4, typename T5,
282 typename T6 >
283 AggImplInheritanceHelper8(
284 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
285 T5 const & arg5, T6 const & arg6):
286 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
287 public:
288 AggImplInheritanceHelper8() {}
289 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
290 { return BaseClass::queryInterface( rType ); }
291 virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
293 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
294 if (aRet.hasValue())
295 return aRet;
296 return BaseClass::queryAggregation( rType );
298 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
299 { BaseClass::acquire(); }
300 virtual void SAL_CALL release() throw () SAL_OVERRIDE
301 { BaseClass::release(); }
302 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
303 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
304 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
305 { return ImplHelper_getImplementationId( cd::get() ); }
309 #endif
311 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */