Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / cppuhelper / implbase8.hxx
blob279b3206d613c866ebd3d479afec3b1a8cca99c9
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>
25 namespace cppu
27 /// @cond INTERNAL
29 struct class_data8
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[ 8 + 1 ];
38 template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Impl >
39 struct SAL_WARN_UNUSED ImplClassData8
41 class_data* operator ()()
43 static class_data8 s_cd =
45 8 +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(css::lang::XTypeProvider)
59 return reinterpret_cast< class_data * >(&s_cd);
63 /// @endcond
65 /** Implementation helper implementing interface css::lang::XTypeProvider
66 and method XInterface::queryInterface(), but no reference counting.
68 @derive
69 Inherit from this class giving your interface(s) to be implemented as template argument(s).
70 Your sub class defines method implementations for these interface(s) including acquire()/
71 release() and delegates incoming queryInterface() calls to this base class.
73 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
74 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper8
75 : public css::lang::XTypeProvider
76 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
78 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> > > {};
79 public:
80 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
81 { return ImplHelper_query( rType, cd::get(), this ); }
82 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
83 { return ImplHelper_getTypes( cd::get() ); }
84 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
85 { return ImplHelper_getImplementationId( cd::get() ); }
87 #if !defined _MSC_VER // public -> protected changes mangled names there
88 protected:
89 #elif defined __clang__
90 #pragma clang diagnostic push
91 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
92 #endif
93 ~ImplHelper8() throw () {}
94 #if defined _MSC_VER && defined __clang__
95 #pragma clang diagnostic pop
96 #endif
98 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
99 css::uno::XInterface which supports weak mechanism to be held weakly
100 (supporting css::uno::XWeak through ::cppu::OWeakObject).
102 @derive
103 Inherit from this class giving your interface(s) to be implemented as template argument(s).
104 Your sub class defines method implementations for these interface(s).
106 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
107 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper8
108 : public OWeakObject
109 , public css::lang::XTypeProvider
110 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
112 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> > > {};
113 public:
114 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
115 { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
116 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
117 { OWeakObject::acquire(); }
118 virtual void SAL_CALL release() throw () SAL_OVERRIDE
119 { OWeakObject::release(); }
120 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
121 { return WeakImplHelper_getTypes( cd::get() ); }
122 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
123 { return ImplHelper_getImplementationId( cd::get() ); }
125 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
126 css::uno::XInterface which supports weak mechanism to be held weakly
127 (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
128 In addition, it supports also aggregation meaning object of this class can be aggregated
129 (css::uno::XAggregation through ::cppu::OWeakAggObject).
130 If a delegator is set (this object is aggregated), then incoming queryInterface()
131 calls are delegated to the delegator object. If the delegator does not support the
132 demanded interface, it calls queryAggregation() on its aggregated objects.
134 @derive
135 Inherit from this class giving your interface(s) to be implemented as template argument(s).
136 Your sub class defines method implementations for these interface(s).
138 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
139 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper8
140 : public OWeakAggObject
141 , public css::lang::XTypeProvider
142 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
144 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> > > {};
145 public:
146 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
147 { return OWeakAggObject::queryInterface( rType ); }
148 virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
149 { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
150 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
151 { OWeakAggObject::acquire(); }
152 virtual void SAL_CALL release() throw () SAL_OVERRIDE
153 { OWeakAggObject::release(); }
154 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
155 { return WeakAggImplHelper_getTypes( cd::get() ); }
156 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
157 { return ImplHelper_getImplementationId( cd::get() ); }
159 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
160 css::uno::XInterface inherting from a BaseClass.
161 All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
162 if a demanded interface is not supported by this class directly, the request is
163 delegated to the BaseClass.
165 @attention
166 The BaseClass has to be complete in a sense, that css::uno::XInterface
167 and css::lang::XTypeProvider are implemented properly. The
168 BaseClass must have at least one ctor that can be called with six or
169 fewer arguments, of which none is of non-const reference type.
171 @derive
172 Inherit from this class giving your additional interface(s) to be implemented as
173 template argument(s). Your sub class defines method implementations for these interface(s).
175 template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
176 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper8
177 : public BaseClass
178 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
180 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> > > {};
181 protected:
182 template< typename T1 >
183 explicit ImplInheritanceHelper8(T1 const & arg1): BaseClass(arg1) {}
184 template< typename T1, typename T2 >
185 ImplInheritanceHelper8(T1 const & arg1, T2 const & arg2):
186 BaseClass(arg1, arg2) {}
187 template< typename T1, typename T2, typename T3 >
188 ImplInheritanceHelper8(
189 T1 const & arg1, T2 const & arg2, T3 const & arg3):
190 BaseClass(arg1, arg2, arg3) {}
191 template< typename T1, typename T2, typename T3, typename T4 >
192 ImplInheritanceHelper8(
193 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
194 BaseClass(arg1, arg2, arg3, arg4) {}
195 template<
196 typename T1, typename T2, typename T3, typename T4, typename T5 >
197 ImplInheritanceHelper8(
198 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
199 T5 const & arg5):
200 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
201 template<
202 typename T1, typename T2, typename T3, typename T4, typename T5,
203 typename T6 >
204 ImplInheritanceHelper8(
205 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
206 T5 const & arg5, T6 const & arg6):
207 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
208 public:
209 ImplInheritanceHelper8() {}
210 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
212 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
213 if (aRet.hasValue())
214 return aRet;
215 return BaseClass::queryInterface( rType );
217 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
218 { BaseClass::acquire(); }
219 virtual void SAL_CALL release() throw () SAL_OVERRIDE
220 { BaseClass::release(); }
221 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
222 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
223 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
224 { return ImplHelper_getImplementationId( cd::get() ); }
226 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
227 css::uno::XInterface inherting from a BaseClass.
228 All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
229 Upon queryAggregation(), if a demanded interface is not supported by this class directly,
230 the request is delegated to the BaseClass.
232 @attention
233 The BaseClass has to be complete in a sense, that css::uno::XInterface,
234 css::uno::XAggregation and css::lang::XTypeProvider
235 are implemented properly. The BaseClass must have at least one ctor
236 that can be called with six or fewer arguments, of which none is of
237 non-const reference type.
239 @derive
240 Inherit from this class giving your additional interface(s) to be implemented as
241 template argument(s). Your sub class defines method implementations for these interface(s).
243 template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
244 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper8
245 : public BaseClass
246 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
248 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> > > {};
249 protected:
250 template< typename T1 >
251 explicit AggImplInheritanceHelper8(T1 const & arg1): BaseClass(arg1) {}
252 template< typename T1, typename T2 >
253 AggImplInheritanceHelper8(T1 const & arg1, T2 const & arg2):
254 BaseClass(arg1, arg2) {}
255 template< typename T1, typename T2, typename T3 >
256 AggImplInheritanceHelper8(
257 T1 const & arg1, T2 const & arg2, T3 const & arg3):
258 BaseClass(arg1, arg2, arg3) {}
259 template< typename T1, typename T2, typename T3, typename T4 >
260 AggImplInheritanceHelper8(
261 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
262 BaseClass(arg1, arg2, arg3, arg4) {}
263 template<
264 typename T1, typename T2, typename T3, typename T4, typename T5 >
265 AggImplInheritanceHelper8(
266 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
267 T5 const & arg5):
268 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
269 template<
270 typename T1, typename T2, typename T3, typename T4, typename T5,
271 typename T6 >
272 AggImplInheritanceHelper8(
273 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
274 T5 const & arg5, T6 const & arg6):
275 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
276 public:
277 AggImplInheritanceHelper8() {}
278 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
279 { return BaseClass::queryInterface( rType ); }
280 virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
282 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
283 if (aRet.hasValue())
284 return aRet;
285 return BaseClass::queryAggregation( rType );
287 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
288 { BaseClass::acquire(); }
289 virtual void SAL_CALL release() throw () SAL_OVERRIDE
290 { BaseClass::release(); }
291 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
292 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
293 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
294 { return ImplHelper_getImplementationId( cd::get() ); }
298 #endif
300 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */