LibreOffice: cppuhelper/implbase3.hxx Source File

LibreOffice LibreOffice 6.1 SDK C/C++ API Reference

implbase3.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19 #ifndef INCLUDED_CPPUHELPER_IMPLBASE3_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE3_HXX
21
22 #include "cppuhelper/implbase_ex.hxx"
23 #include "rtl/instance.hxx"
24
25 namespace cppu
26 {
28
29 struct class_data3
30 {
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[ 3 + 1 ];
36 };
37
38 template< typename Ifc1, typename Ifc2, typename Ifc3, typename Impl > struct SAL_WARN_UNUSED ImplClassData3
39 {
40 class_data* operator ()()
41 {
42 static class_data3 s_cd =
43 {
44 3 +1, false, false,
45 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
46 {
47 CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
48 CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
49 CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
50 CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
51 }
52 };
53 return reinterpret_cast< class_data * >(&s_cd);
54 }
55 };
56
58
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
71 {
72 struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, ImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
73 public:
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() ); }
80
81 #if !defined _MSC_VER // public -> protected changes mangled names there
82 protected:
83 #elif defined __clang__
84 #pragma clang diagnostic push
85 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
86 #endif
87 ~ImplHelper3() throw () {}
88 #if defined _MSC_VER && defined __clang__
89 #pragma clang diagnostic pop
90 #endif
91 };
100 template< class Ifc1, class Ifc2, class Ifc3 >
101 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper3
102 : public OWeakObject
103 , public css::lang::XTypeProvider
104 , public Ifc1, public Ifc2, public Ifc3
105 {
106 struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
107 public:
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() ); }
118 };
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
137 {
138 struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakAggImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
139 public:
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() ); }
152 };
170 template< class BaseClass, class Ifc1, class Ifc2, class Ifc3 >
171 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper3
172 : public BaseClass
173 , public Ifc1, public Ifc2, public Ifc3
174 {
175 struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, ImplInheritanceHelper3<BaseClass, Ifc1, Ifc2, Ifc3> > > {};
176 protected:
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) {}
190 template<
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,
194 T5 const & arg5):
195 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
196 template<
197 typename T1, typename T2, typename T3, typename T4, typename T5,
198 typename T6 >
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) {}
203 public:
204 ImplInheritanceHelper3() {}
205 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
206 {
207 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
208 if (aRet.hasValue())
209 return aRet;
210 return BaseClass::queryInterface( rType );
211 }
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() ); }
220 };
238 template< class BaseClass, class Ifc1, class Ifc2, class Ifc3 >
239 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper3
240 : public BaseClass
241 , public Ifc1, public Ifc2, public Ifc3
242 {
243 struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, AggImplInheritanceHelper3<BaseClass, Ifc1, Ifc2, Ifc3> > > {};
244 protected:
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) {}
258 template<
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,
262 T5 const & arg5):
263 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
264 template<
265 typename T1, typename T2, typename T3, typename T4, typename T5,
266 typename T6 >
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) {}
271 public:
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
276 {
277 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
278 if (aRet.hasValue())
279 return aRet;
280 return BaseClass::queryAggregation( rType );
281 }
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() ); }
290 };
291 }
292
293 #endif
294
295 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
cppu::AggImplInheritanceHelper3::AggImplInheritanceHelper3
AggImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase3.hxx:260
SAL_OVERRIDE
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:407
SAL_NO_VTABLE
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:310
cppu::OWeakObject::acquire
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
cppu::OWeakObject::release
virtual void release() SAL_OVERRIDE
decreasing m_refCount
rtl::StaticAggregate
Helper class for a late-initialized static aggregate, e.g.
Definition: instance.hxx:544
cppu::ImplHelper3::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase3.hxx:74
cppu::ImplInheritanceHelper3::ImplInheritanceHelper3
ImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase3.hxx:183
cppu::WeakAggImplHelper3
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase3.hxx:133
cppu::OWeakAggObject
Base class to implement an UNO object supporting weak references, i.e.
Definition: weakagg.hxx:41
cppu::WeakAggImplHelper3::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase3.hxx:150
cppu::WeakAggImplHelper3::release
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
Definition: implbase3.hxx:146
cppu::AggImplInheritanceHelper3::acquire
virtual void acquire() SAL_OVERRIDE
Definition: implbase3.hxx:282
cppu::AggImplInheritanceHelper3::queryAggregation
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase3.hxx:275
cppu::ImplInheritanceHelper3::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase3.hxx:216
sal_Int8
signed char sal_Int8
Definition: types.h:43
cppu::ImplHelper3
Implementation helper implementing interface css::lang::XTypeProvider and method XInterface::queryInt...
Definition: implbase3.hxx:68
cppu::ImplInheritanceHelper3
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase3.hxx:171
cppu::WeakImplHelper3::release
virtual void release() SAL_OVERRIDE
decreasing m_refCount
Definition: implbase3.hxx:112
cppu::ImplInheritanceHelper3::ImplInheritanceHelper3
ImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase3.hxx:192
cppu::ImplInheritanceHelper3::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase3.hxx:218
cppu::AggImplInheritanceHelper3::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase3.hxx:286
cppu::AggImplInheritanceHelper3::AggImplInheritanceHelper3
AggImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase3.hxx:267
SAL_WARN_UNUSED
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:598
cppu::WeakAggImplHelper3::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
If a delegator is set, then the delegator is queried for the demanded interface.
Definition: implbase3.hxx:140
cppu::AggImplInheritanceHelper3
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase3.hxx:239
cppu::AggImplInheritanceHelper3::AggImplInheritanceHelper3
AggImplInheritanceHelper3(T1 const &arg1)
Definition: implbase3.hxx:246
cppu::WeakImplHelper3::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase3.hxx:114
cppu::queryInterface
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
cppu::ImplInheritanceHelper3::ImplInheritanceHelper3
ImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase3.hxx:199
cppu::ImplInheritanceHelper3::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase3.hxx:205
cppu::OWeakObject
Base class to implement an UNO object supporting weak references, i.e.
Definition: weak.hxx:43
sal_Bool
unsigned char sal_Bool
Definition: types.h:38
cppu::WeakImplHelper3
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase3.hxx:101
cppu::OWeakAggObject::acquire
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
cppu::OWeakAggObject::release
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
cppu::ImplInheritanceHelper3::acquire
virtual void acquire() SAL_OVERRIDE
Definition: implbase3.hxx:212
cppu::ImplInheritanceHelper3::ImplInheritanceHelper3
ImplInheritanceHelper3()
Definition: implbase3.hxx:204
cppu::ImplInheritanceHelper3::ImplInheritanceHelper3
ImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase3.hxx:187
cppu::WeakImplHelper3::acquire
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
Definition: implbase3.hxx:110
cppu::ImplHelper3::~ImplHelper3
~ImplHelper3()
Definition: implbase3.hxx:87
cppu::AggImplInheritanceHelper3::AggImplInheritanceHelper3
AggImplInheritanceHelper3()
Definition: implbase3.hxx:272
cppu::AggImplInheritanceHelper3::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase3.hxx:273
implbase_ex.hxx
cppu::WeakImplHelper3::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase3.hxx:116
cppu::AggImplInheritanceHelper3::AggImplInheritanceHelper3
AggImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase3.hxx:251
cppu
Definition: Enterable.hxx:26
cppu::OWeakAggObject::queryInterface
virtual css::uno::Any queryInterface(const css::uno::Type &rType) SAL_OVERRIDE
If a delegator is set, then the delegator is queried for the demanded interface.
cppu::ImplInheritanceHelper3::ImplInheritanceHelper3
ImplInheritanceHelper3(T1 const &arg1, T2 const &arg2)
Definition: implbase3.hxx:180
cppu::ImplInheritanceHelper3::release
virtual void release() SAL_OVERRIDE
Definition: implbase3.hxx:214
cppu::WeakAggImplHelper3::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase3.hxx:148
cppu::AggImplInheritanceHelper3::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase3.hxx:288
cppu::ImplHelper3::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase3.hxx:78
cppu::ImplHelper3::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase3.hxx:76
cppu::WeakAggImplHelper3::acquire
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
Definition: implbase3.hxx:144
cppu::WeakImplHelper3::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Basic queryInterface() implementation supporting com::sun::star::uno::XWeak and com::sun::star::uno::...
Definition: implbase3.hxx:108
instance.hxx
cppu::WeakAggImplHelper3::queryAggregation
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Called by the delegator or queryInterface.
Definition: implbase3.hxx:142
cppu::AggImplInheritanceHelper3::AggImplInheritanceHelper3
AggImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase3.hxx:255
cppu::ImplInheritanceHelper3::ImplInheritanceHelper3
ImplInheritanceHelper3(T1 const &arg1)
Definition: implbase3.hxx:178
cppu::AggImplInheritanceHelper3::release
virtual void release() SAL_OVERRIDE
Definition: implbase3.hxx:284
cppu::AggImplInheritanceHelper3::AggImplInheritanceHelper3
AggImplInheritanceHelper3(T1 const &arg1, T2 const &arg2)
Definition: implbase3.hxx:248