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>
32 sal_Bool m_storedTypeRefs
;
35 type_entry m_typeEntries
[ 3 + 1 ];
38 template< typename Ifc1
, typename Ifc2
, typename Ifc3
, typename Impl
> struct SAL_WARN_UNUSED ImplClassData3
40 class_data
* operator ()()
42 static class_data3 s_cd
=
45 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
47 CPPUHELPER_DETAIL_TYPEENTRY(Ifc1
),
48 CPPUHELPER_DETAIL_TYPEENTRY(Ifc2
),
49 CPPUHELPER_DETAIL_TYPEENTRY(Ifc3
),
50 CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider
)
53 return reinterpret_cast< class_data
* >(&s_cd
);
59 /** Implementation helper implementing interface css::lang::XTypeProvider
60 and method XInterface::queryInterface(), but no reference counting.
63 Inherit from this class giving your interface(s) to be implemented as template argument(s).
64 Your sub class defines method implementations for these interface(s) including acquire()/
65 release() and delegates incoming queryInterface() calls to this base class.
67 template< class Ifc1
, class Ifc2
, class Ifc3
>
68 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper3
69 : public css::lang::XTypeProvider
70 , public Ifc1
, public Ifc2
, public Ifc3
72 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, ImplHelper3
<Ifc1
, Ifc2
, Ifc3
> > > {};
74 virtual css::uno::Any SAL_CALL
queryInterface( css::uno::Type
const & rType
) SAL_OVERRIDE
75 { return ImplHelper_query( rType
, cd::get(), this ); }
76 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() SAL_OVERRIDE
77 { return ImplHelper_getTypes( cd::get() ); }
78 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() SAL_OVERRIDE
79 { return ImplHelper_getImplementationId( cd::get() ); }
81 #if !defined _MSC_VER // public -> protected changes mangled names there
83 #elif defined __clang__
84 #pragma clang diagnostic push
85 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
87 ~ImplHelper3() throw () {}
88 #if defined _MSC_VER && defined __clang__
89 #pragma clang diagnostic pop
92 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
93 css::uno::XInterface which supports weak mechanism to be held weakly
94 (supporting css::uno::XWeak through ::cppu::OWeakObject).
97 Inherit from this class giving your interface(s) to be implemented as template argument(s).
98 Your sub class defines method implementations for these interface(s).
100 template< class Ifc1
, class Ifc2
, class Ifc3
>
101 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper3
103 , public css::lang::XTypeProvider
104 , public Ifc1
, public Ifc2
, public Ifc3
106 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, WeakImplHelper3
<Ifc1
, Ifc2
, Ifc3
> > > {};
108 virtual css::uno::Any SAL_CALL
queryInterface( css::uno::Type
const & rType
) SAL_OVERRIDE
109 { return WeakImplHelper_query( rType
, cd::get(), this, static_cast<OWeakObject
*>(this) ); }
110 virtual void SAL_CALL
acquire() throw () SAL_OVERRIDE
111 { OWeakObject::acquire(); }
112 virtual void SAL_CALL
release() throw () SAL_OVERRIDE
113 { OWeakObject::release(); }
114 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() SAL_OVERRIDE
115 { return WeakImplHelper_getTypes( cd::get() ); }
116 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() SAL_OVERRIDE
117 { return ImplHelper_getImplementationId( cd::get() ); }
119 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
120 css::uno::XInterface which supports weak mechanism to be held weakly
121 (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
122 In addition, it supports also aggregation meaning object of this class can be aggregated
123 (css::uno::XAggregation through ::cppu::OWeakAggObject).
124 If a delegator is set (this object is aggregated), then incoming queryInterface()
125 calls are delegated to the delegator object. If the delegator does not support the
126 demanded interface, it calls queryAggregation() on its aggregated objects.
129 Inherit from this class giving your interface(s) to be implemented as template argument(s).
130 Your sub class defines method implementations for these interface(s).
132 template< class Ifc1
, class Ifc2
, class Ifc3
>
133 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper3
134 : public OWeakAggObject
135 , public css::lang::XTypeProvider
136 , public Ifc1
, public Ifc2
, public Ifc3
138 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, WeakAggImplHelper3
<Ifc1
, Ifc2
, Ifc3
> > > {};
140 virtual css::uno::Any SAL_CALL
queryInterface( css::uno::Type
const & rType
) SAL_OVERRIDE
141 { return OWeakAggObject::queryInterface( rType
); }
142 virtual css::uno::Any SAL_CALL
queryAggregation( css::uno::Type
const & rType
) SAL_OVERRIDE
143 { return WeakAggImplHelper_queryAgg( rType
, cd::get(), this, static_cast<OWeakAggObject
*>(this) ); }
144 virtual void SAL_CALL
acquire() throw () SAL_OVERRIDE
145 { OWeakAggObject::acquire(); }
146 virtual void SAL_CALL
release() throw () SAL_OVERRIDE
147 { OWeakAggObject::release(); }
148 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() SAL_OVERRIDE
149 { return WeakAggImplHelper_getTypes( cd::get() ); }
150 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() SAL_OVERRIDE
151 { return ImplHelper_getImplementationId( cd::get() ); }
153 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
154 css::uno::XInterface inherting from a BaseClass.
155 All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
156 if a demanded interface is not supported by this class directly, the request is
157 delegated to the BaseClass.
160 The BaseClass has to be complete in a sense, that css::uno::XInterface
161 and css::lang::XTypeProvider are implemented properly. The
162 BaseClass must have at least one ctor that can be called with six or
163 fewer arguments, of which none is of non-const reference type.
164 also has to have a default ctor.
167 Inherit from this class giving your additional interface(s) to be implemented as
168 template argument(s). Your sub class defines method implementations for these interface(s).
170 template< class BaseClass
, class Ifc1
, class Ifc2
, class Ifc3
>
171 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper3
173 , public Ifc1
, public Ifc2
, public Ifc3
175 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, ImplInheritanceHelper3
<BaseClass
, Ifc1
, Ifc2
, Ifc3
> > > {};
177 template< typename T1
>
178 explicit ImplInheritanceHelper3(T1
const & arg1
): BaseClass(arg1
) {}
179 template< typename T1
, typename T2
>
180 ImplInheritanceHelper3(T1
const & arg1
, T2
const & arg2
):
181 BaseClass(arg1
, arg2
) {}
182 template< typename T1
, typename T2
, typename T3
>
183 ImplInheritanceHelper3(
184 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
):
185 BaseClass(arg1
, arg2
, arg3
) {}
186 template< typename T1
, typename T2
, typename T3
, typename T4
>
187 ImplInheritanceHelper3(
188 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
, T4
const & arg4
):
189 BaseClass(arg1
, arg2
, arg3
, arg4
) {}
191 typename T1
, typename T2
, typename T3
, typename T4
, typename T5
>
192 ImplInheritanceHelper3(
193 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
, T4
const & arg4
,
195 BaseClass(arg1
, arg2
, arg3
, arg4
, arg5
) {}
197 typename T1
, typename T2
, typename T3
, typename T4
, typename T5
,
199 ImplInheritanceHelper3(
200 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
, T4
const & arg4
,
201 T5
const & arg5
, T6
const & arg6
):
202 BaseClass(arg1
, arg2
, arg3
, arg4
, arg5
, arg6
) {}
204 ImplInheritanceHelper3() {}
205 virtual css::uno::Any SAL_CALL
queryInterface( css::uno::Type
const & rType
) SAL_OVERRIDE
207 css::uno::Any
aRet( ImplHelper_queryNoXInterface( rType
, cd::get(), this ) );
210 return BaseClass::queryInterface( rType
);
212 virtual void SAL_CALL
acquire() throw () SAL_OVERRIDE
213 { BaseClass::acquire(); }
214 virtual void SAL_CALL
release() throw () SAL_OVERRIDE
215 { BaseClass::release(); }
216 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() SAL_OVERRIDE
217 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
218 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() SAL_OVERRIDE
219 { return ImplHelper_getImplementationId( cd::get() ); }
221 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
222 css::uno::XInterface inherting from a BaseClass.
223 All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
224 Upon queryAggregation(), if a demanded interface is not supported by this class directly,
225 the request is delegated to the BaseClass.
228 The BaseClass has to be complete in a sense, that css::uno::XInterface,
229 css::uno::XAggregation and css::lang::XTypeProvider
230 are implemented properly. The BaseClass must have at least one ctor
231 that can be called with six or fewer arguments, of which none is of
232 non-const reference type.
235 Inherit from this class giving your additional interface(s) to be implemented as
236 template argument(s). Your sub class defines method implementations for these interface(s).
238 template< class BaseClass
, class Ifc1
, class Ifc2
, class Ifc3
>
239 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper3
241 , public Ifc1
, public Ifc2
, public Ifc3
243 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData3
< Ifc1
, Ifc2
, Ifc3
, AggImplInheritanceHelper3
<BaseClass
, Ifc1
, Ifc2
, Ifc3
> > > {};
245 template< typename T1
>
246 explicit AggImplInheritanceHelper3(T1
const & arg1
): BaseClass(arg1
) {}
247 template< typename T1
, typename T2
>
248 AggImplInheritanceHelper3(T1
const & arg1
, T2
const & arg2
):
249 BaseClass(arg1
, arg2
) {}
250 template< typename T1
, typename T2
, typename T3
>
251 AggImplInheritanceHelper3(
252 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
):
253 BaseClass(arg1
, arg2
, arg3
) {}
254 template< typename T1
, typename T2
, typename T3
, typename T4
>
255 AggImplInheritanceHelper3(
256 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
, T4
const & arg4
):
257 BaseClass(arg1
, arg2
, arg3
, arg4
) {}
259 typename T1
, typename T2
, typename T3
, typename T4
, typename T5
>
260 AggImplInheritanceHelper3(
261 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
, T4
const & arg4
,
263 BaseClass(arg1
, arg2
, arg3
, arg4
, arg5
) {}
265 typename T1
, typename T2
, typename T3
, typename T4
, typename T5
,
267 AggImplInheritanceHelper3(
268 T1
const & arg1
, T2
const & arg2
, T3
const & arg3
, T4
const & arg4
,
269 T5
const & arg5
, T6
const & arg6
):
270 BaseClass(arg1
, arg2
, arg3
, arg4
, arg5
, arg6
) {}
272 AggImplInheritanceHelper3() {}
273 virtual css::uno::Any SAL_CALL
queryInterface( css::uno::Type
const & rType
) SAL_OVERRIDE
274 { return BaseClass::queryInterface( rType
); }
275 virtual css::uno::Any SAL_CALL
queryAggregation( css::uno::Type
const & rType
) SAL_OVERRIDE
277 css::uno::Any
aRet( ImplHelper_queryNoXInterface( rType
, cd::get(), this ) );
280 return BaseClass::queryAggregation( rType
);
282 virtual void SAL_CALL
acquire() throw () SAL_OVERRIDE
283 { BaseClass::acquire(); }
284 virtual void SAL_CALL
release() throw () SAL_OVERRIDE
285 { BaseClass::release(); }
286 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() SAL_OVERRIDE
287 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
288 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId() SAL_OVERRIDE
289 { return ImplHelper_getImplementationId( cd::get() ); }
295 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */