1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_IMPLBASE3_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE3_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"
35 sal_Bool m_storedTypeRefs
;
38 type_entry m_typeEntries
[ 3 + 1 ];
41 template< typename Ifc1
, typename Ifc2
, typename Ifc3
, typename Impl
> struct SAL_WARN_UNUSED ImplClassData3
43 class_data
* operator ()()
45 static class_data3 s_cd
=
48 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
50 CPPUHELPER_DETAIL_TYPEENTRY(Ifc1
),
51 CPPUHELPER_DETAIL_TYPEENTRY(Ifc2
),
52 CPPUHELPER_DETAIL_TYPEENTRY(Ifc3
),
53 CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider
)
56 return reinterpret_cast< class_data
* >(&s_cd
);
62 /** Implementation helper implementing interface css::lang::XTypeProvider
63 and method XInterface::queryInterface(), but no reference counting.
66 Inherit from this class giving your interface(s) to be implemented as template argument(s).
67 Your sub class defines method implementations for these interface(s) including acquire()/
68 release() and delegates incoming queryInterface() calls to this base class.
70 template< class Ifc1
, class Ifc2
, class Ifc3
>
71 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper3
72 : public css::lang::XTypeProvider
73 , public Ifc1
, public Ifc2
, public Ifc3
75 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, ImplHelper3
<Ifc1
, Ifc2
, Ifc3
> > > {};
77 #if defined LIBO_INTERNAL_ONLY
78 ImplHelper3() = default;
79 ImplHelper3(ImplHelper3
const &) = default;
80 ImplHelper3(ImplHelper3
&&) = default;
81 ImplHelper3
& operator =(ImplHelper3
const &) = default;
82 ImplHelper3
& operator =(ImplHelper3
&&) = default;
85 virtual css::uno::Any SAL_CALL
queryInterface( css::uno::Type
const & rType
) SAL_OVERRIDE
86 { return ImplHelper_query( rType
, cd::get(), this ); }
87 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() SAL_OVERRIDE
88 { return ImplHelper_getTypes( cd::get() ); }
89 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() SAL_OVERRIDE
90 { return ImplHelper_getImplementationId( cd::get() ); }
92 #if !defined _MSC_VER // public -> protected changes mangled names there
94 #elif defined __clang__
95 #pragma clang diagnostic push
96 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
98 ~ImplHelper3() throw () {}
99 #if defined _MSC_VER && defined __clang__
100 #pragma clang diagnostic pop
103 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
104 css::uno::XInterface which supports weak mechanism to be held weakly
105 (supporting css::uno::XWeak through ::cppu::OWeakObject).
108 Inherit from this class giving your interface(s) to be implemented as template argument(s).
109 Your sub class defines method implementations for these interface(s).
111 template< class Ifc1
, class Ifc2
, class Ifc3
>
112 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper3
114 , public css::lang::XTypeProvider
115 , public Ifc1
, public Ifc2
, public Ifc3
117 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, WeakImplHelper3
<Ifc1
, Ifc2
, Ifc3
> > > {};
119 virtual css::uno::Any SAL_CALL
queryInterface( css::uno::Type
const & rType
) SAL_OVERRIDE
120 { return WeakImplHelper_query( rType
, cd::get(), this, static_cast<OWeakObject
*>(this) ); }
121 virtual void SAL_CALL
acquire() throw () SAL_OVERRIDE
122 { OWeakObject::acquire(); }
123 virtual void SAL_CALL
release() throw () SAL_OVERRIDE
124 { OWeakObject::release(); }
125 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() SAL_OVERRIDE
126 { return WeakImplHelper_getTypes( cd::get() ); }
127 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() SAL_OVERRIDE
128 { return ImplHelper_getImplementationId( cd::get() ); }
130 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
131 css::uno::XInterface which supports weak mechanism to be held weakly
132 (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
133 In addition, it supports also aggregation meaning object of this class can be aggregated
134 (css::uno::XAggregation through ::cppu::OWeakAggObject).
135 If a delegator is set (this object is aggregated), then incoming queryInterface()
136 calls are delegated to the delegator object. If the delegator does not support the
137 demanded interface, it calls queryAggregation() on its aggregated objects.
140 Inherit from this class giving your interface(s) to be implemented as template argument(s).
141 Your sub class defines method implementations for these interface(s).
143 template< class Ifc1
, class Ifc2
, class Ifc3
>
144 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper3
145 : public OWeakAggObject
146 , public css::lang::XTypeProvider
147 , public Ifc1
, public Ifc2
, public Ifc3
149 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, WeakAggImplHelper3
<Ifc1
, Ifc2
, Ifc3
> > > {};
151 virtual css::uno::Any SAL_CALL
queryInterface( css::uno::Type
const & rType
) SAL_OVERRIDE
152 { return OWeakAggObject::queryInterface( rType
); }
153 virtual css::uno::Any SAL_CALL
queryAggregation( css::uno::Type
const & rType
) SAL_OVERRIDE
154 { return WeakAggImplHelper_queryAgg( rType
, cd::get(), this, static_cast<OWeakAggObject
*>(this) ); }
155 virtual void SAL_CALL
acquire() throw () SAL_OVERRIDE
156 { OWeakAggObject::acquire(); }
157 virtual void SAL_CALL
release() throw () SAL_OVERRIDE
158 { OWeakAggObject::release(); }
159 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() SAL_OVERRIDE
160 { return WeakAggImplHelper_getTypes( cd::get() ); }
161 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() SAL_OVERRIDE
162 { return ImplHelper_getImplementationId( cd::get() ); }
164 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
165 css::uno::XInterface inherting from a BaseClass.
166 All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
167 if a demanded interface is not supported by this class directly, the request is
168 delegated to the BaseClass.
171 The BaseClass has to be complete in a sense, that css::uno::XInterface
172 and css::lang::XTypeProvider are implemented properly. The
173 BaseClass must have at least one ctor that can be called with six or
174 fewer arguments, of which none is of non-const reference type.
175 also has to have a default ctor.
178 Inherit from this class giving your additional interface(s) to be implemented as
179 template argument(s). Your sub class defines method implementations for these interface(s).
181 template< class BaseClass
, class Ifc1
, class Ifc2
, class Ifc3
>
182 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper3
184 , public Ifc1
, public Ifc2
, public Ifc3
186 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, ImplInheritanceHelper3
<BaseClass
, Ifc1
, Ifc2
, Ifc3
> > > {};
188 template< typename T1
>
189 explicit ImplInheritanceHelper3(T1
const & arg1
): BaseClass(arg1
) {}
190 template< typename T1
, typename T2
>
191 ImplInheritanceHelper3(T1
const & arg1
, T2
const & arg2
):
192 BaseClass(arg1
, arg2
) {}
193 template< typename T1
, typename T2
, typename T3
>
194 ImplInheritanceHelper3(
195 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
):
196 BaseClass(arg1
, arg2
, arg3
) {}
197 template< typename T1
, typename T2
, typename T3
, typename T4
>
198 ImplInheritanceHelper3(
199 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
, T4
const & arg4
):
200 BaseClass(arg1
, arg2
, arg3
, arg4
) {}
202 typename T1
, typename T2
, typename T3
, typename T4
, typename T5
>
203 ImplInheritanceHelper3(
204 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
, T4
const & arg4
,
206 BaseClass(arg1
, arg2
, arg3
, arg4
, arg5
) {}
208 typename T1
, typename T2
, typename T3
, typename T4
, typename T5
,
210 ImplInheritanceHelper3(
211 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
, T4
const & arg4
,
212 T5
const & arg5
, T6
const & arg6
):
213 BaseClass(arg1
, arg2
, arg3
, arg4
, arg5
, arg6
) {}
215 ImplInheritanceHelper3() {}
216 virtual css::uno::Any SAL_CALL
queryInterface( css::uno::Type
const & rType
) SAL_OVERRIDE
218 css::uno::Any
aRet( ImplHelper_queryNoXInterface( rType
, cd::get(), this ) );
221 return BaseClass::queryInterface( rType
);
223 virtual void SAL_CALL
acquire() throw () SAL_OVERRIDE
224 { BaseClass::acquire(); }
225 virtual void SAL_CALL
release() throw () SAL_OVERRIDE
226 { BaseClass::release(); }
227 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() SAL_OVERRIDE
228 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
229 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() SAL_OVERRIDE
230 { return ImplHelper_getImplementationId( cd::get() ); }
232 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
233 css::uno::XInterface inherting from a BaseClass.
234 All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
235 Upon queryAggregation(), if a demanded interface is not supported by this class directly,
236 the request is delegated to the BaseClass.
239 The BaseClass has to be complete in a sense, that css::uno::XInterface,
240 css::uno::XAggregation and css::lang::XTypeProvider
241 are implemented properly. The BaseClass must have at least one ctor
242 that can be called with six or fewer arguments, of which none is of
243 non-const reference type.
246 Inherit from this class giving your additional interface(s) to be implemented as
247 template argument(s). Your sub class defines method implementations for these interface(s).
249 template< class BaseClass
, class Ifc1
, class Ifc2
, class Ifc3
>
250 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper3
252 , public Ifc1
, public Ifc2
, public Ifc3
254 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, AggImplInheritanceHelper3
<BaseClass
, Ifc1
, Ifc2
, Ifc3
> > > {};
256 template< typename T1
>
257 explicit AggImplInheritanceHelper3(T1
const & arg1
): BaseClass(arg1
) {}
258 template< typename T1
, typename T2
>
259 AggImplInheritanceHelper3(T1
const & arg1
, T2
const & arg2
):
260 BaseClass(arg1
, arg2
) {}
261 template< typename T1
, typename T2
, typename T3
>
262 AggImplInheritanceHelper3(
263 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
):
264 BaseClass(arg1
, arg2
, arg3
) {}
265 template< typename T1
, typename T2
, typename T3
, typename T4
>
266 AggImplInheritanceHelper3(
267 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
, T4
const & arg4
):
268 BaseClass(arg1
, arg2
, arg3
, arg4
) {}
270 typename T1
, typename T2
, typename T3
, typename T4
, typename T5
>
271 AggImplInheritanceHelper3(
272 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
, T4
const & arg4
,
274 BaseClass(arg1
, arg2
, arg3
, arg4
, arg5
) {}
276 typename T1
, typename T2
, typename T3
, typename T4
, typename T5
,
278 AggImplInheritanceHelper3(
279 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
, T4
const & arg4
,
280 T5
const & arg5
, T6
const & arg6
):
281 BaseClass(arg1
, arg2
, arg3
, arg4
, arg5
, arg6
) {}
283 AggImplInheritanceHelper3() {}
284 virtual css::uno::Any SAL_CALL
queryInterface( css::uno::Type
const & rType
) SAL_OVERRIDE
285 { return BaseClass::queryInterface( rType
); }
286 virtual css::uno::Any SAL_CALL
queryAggregation( css::uno::Type
const & rType
) SAL_OVERRIDE
288 css::uno::Any
aRet( ImplHelper_queryNoXInterface( rType
, cd::get(), this ) );
291 return BaseClass::queryAggregation( rType
);
293 virtual void SAL_CALL
acquire() throw () SAL_OVERRIDE
294 { BaseClass::acquire(); }
295 virtual void SAL_CALL
release() throw () SAL_OVERRIDE
296 { BaseClass::release(); }
297 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() SAL_OVERRIDE
298 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
299 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() SAL_OVERRIDE
300 { return ImplHelper_getImplementationId( cd::get() ); }
306 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */