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