Branch libreoffice-5-0-4
[LibreOffice.git] / include / cppuhelper / implbase6.hxx
blob7a85bedfee91b3b1b638ae334dbee2514d7332d0
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_IMPLBASE6_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE6_HXX
22 #include <cppuhelper/implbase_ex.hxx>
23 #include <rtl/instance.hxx>
25 namespace cppu
27 /// @cond INTERNAL
29 struct class_data6
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 ];
38 template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Impl >
39 struct ImplClassData6
41 class_data* operator ()()
43 static class_data6 s_cd =
45 6 +1, sal_False, sal_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(com::sun::star::lang::XTypeProvider)
57 return reinterpret_cast< class_data * >(&s_cd);
61 /// @endcond
63 /** Implementation helper implementing interface com::sun::star::lang::XTypeProvider
64 and method XInterface::queryInterface(), but no reference counting.
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.
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
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() ); }
85 #if !defined _MSC_VER // public -> protected changes mangled names there
86 protected:
87 #endif
88 ~ImplHelper6() throw () {}
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 through ::cppu::OWeakObject).
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).
98 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
99 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
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 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 { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
108 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
109 { OWeakObject::acquire(); }
110 virtual void SAL_CALL release() throw () SAL_OVERRIDE
111 { OWeakObject::release(); }
112 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 { return WeakImplHelper_getTypes( cd::get() ); }
114 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
115 { return ImplHelper_getImplementationId( cd::get() ); }
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 through ::cppu::OWeakAggObject).
120 In addition, it supports also aggregation meaning object of this class can be aggregated
121 (com::sun::star::uno::XAggregation through ::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.
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).
130 template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
131 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
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 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 { return OWeakAggObject::queryInterface( rType ); }
140 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 { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
142 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
143 { OWeakAggObject::acquire(); }
144 virtual void SAL_CALL release() throw () SAL_OVERRIDE
145 { OWeakAggObject::release(); }
146 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 { return WeakAggImplHelper_getTypes( cd::get() ); }
148 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
149 { return ImplHelper_getImplementationId( cd::get() ); }
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.
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.
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).
167 template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6 >
168 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper6
169 : public BaseClass
170 , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6
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 ImplInheritanceHelper6(
185 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
186 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 ImplInheritanceHelper6() {}
202 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
204 com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
205 if (aRet.hasValue())
206 return aRet;
207 return BaseClass::queryInterface( rType );
209 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
210 { BaseClass::acquire(); }
211 virtual void SAL_CALL release() throw () SAL_OVERRIDE
212 { BaseClass::release(); }
213 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 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
215 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
216 { return ImplHelper_getImplementationId( cd::get() ); }
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.
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.
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).
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
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
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 );
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() ); }
290 #endif
292 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */