LibreOffice: cppuhelper/implbase2.hxx Source File

LibreOffice LibreOffice 5.2 SDK C/C++ API Reference

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

implbase2.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_IMPLBASE2_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE2_HXX
21
22 #include <cppuhelper/implbase_ex.hxx>
23 #include <rtl/instance.hxx>
24
25 namespace cppu
26 {
28
29 struct class_data2
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[ 2 + 1 ];
36 };
37
38 template< typename Ifc1, typename Ifc2, typename Impl > struct ImplClassData2
39 {
40 class_data* operator ()()
41 {
42 static class_data2 s_cd =
43 {
44 2 +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(css::lang::XTypeProvider)
50 }
51 };
52 return reinterpret_cast< class_data * >(&s_cd);
53 }
54 };
55
57
66 template< class Ifc1, class Ifc2 >
67 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper2
68 : public css::lang::XTypeProvider
69 , public Ifc1, public Ifc2
70 {
71 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplHelper2<Ifc1, Ifc2> > > {};
72 public:
73 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
74 { return ImplHelper_query( rType, cd::get(), this ); }
75 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
76 { return ImplHelper_getTypes( cd::get() ); }
77 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
78 { return ImplHelper_getImplementationId( cd::get() ); }
79
80 #if !defined _MSC_VER // public -> protected changes mangled names there
81 protected:
82 #elif defined __clang__
83 #pragma clang diagnostic push
84 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
85 #endif
86 ~ImplHelper2() throw () {}
87 #if defined _MSC_VER && defined __clang__
88 #pragma clang diagnostic pop
89 #endif
90 };
99 template< class Ifc1, class Ifc2 >
100 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper2
101 : public OWeakObject
102 , public css::lang::XTypeProvider
103 , public Ifc1, public Ifc2
104 {
105 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakImplHelper2<Ifc1, Ifc2> > > {};
106 public:
107 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
108 { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
109 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
110 { OWeakObject::acquire(); }
111 virtual void SAL_CALL release() throw () SAL_OVERRIDE
112 { OWeakObject::release(); }
113 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
114 { return WeakImplHelper_getTypes( cd::get() ); }
115 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
116 { return ImplHelper_getImplementationId( cd::get() ); }
117 };
131 template< class Ifc1, class Ifc2 >
132 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper2
133 : public OWeakAggObject
134 , public css::lang::XTypeProvider
135 , public Ifc1, public Ifc2
136 {
137 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggImplHelper2<Ifc1, Ifc2> > > {};
138 public:
139 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
140 { return OWeakAggObject::queryInterface( rType ); }
141 virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
142 { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
143 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
144 { OWeakAggObject::acquire(); }
145 virtual void SAL_CALL release() throw () SAL_OVERRIDE
146 { OWeakAggObject::release(); }
147 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
148 { return WeakAggImplHelper_getTypes( cd::get() ); }
149 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
150 { return ImplHelper_getImplementationId( cd::get() ); }
151 };
168 template< class BaseClass, class Ifc1, class Ifc2 >
169 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper2
170 : public BaseClass
171 , public Ifc1, public Ifc2
172 {
173 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
174 protected:
175 template< typename T1 >
176 explicit ImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
177 template< typename T1, typename T2 >
178 ImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
179 BaseClass(arg1, arg2) {}
180 template< typename T1, typename T2, typename T3 >
181 ImplInheritanceHelper2(
182 T1 const & arg1, T2 const & arg2, T3 const & arg3):
183 BaseClass(arg1, arg2, arg3) {}
184 template< typename T1, typename T2, typename T3, typename T4 >
185 ImplInheritanceHelper2(
186 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
187 BaseClass(arg1, arg2, arg3, arg4) {}
188 template<
189 typename T1, typename T2, typename T3, typename T4, typename T5 >
190 ImplInheritanceHelper2(
191 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
192 T5 const & arg5):
193 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
194 template<
195 typename T1, typename T2, typename T3, typename T4, typename T5,
196 typename T6 >
197 ImplInheritanceHelper2(
198 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
199 T5 const & arg5, T6 const & arg6):
200 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
201 public:
202 ImplInheritanceHelper2() {}
203 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
204 {
205 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
206 if (aRet.hasValue())
207 return aRet;
208 return BaseClass::queryInterface( rType );
209 }
210 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
211 { BaseClass::acquire(); }
212 virtual void SAL_CALL release() throw () SAL_OVERRIDE
213 { BaseClass::release(); }
214 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
215 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
216 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
217 { return ImplHelper_getImplementationId( cd::get() ); }
218 };
236 template< class BaseClass, class Ifc1, class Ifc2 >
237 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper2
238 : public BaseClass
239 , public Ifc1, public Ifc2
240 {
241 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, AggImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
242 protected:
243 template< typename T1 >
244 explicit AggImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
245 template< typename T1, typename T2 >
246 AggImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
247 BaseClass(arg1, arg2) {}
248 template< typename T1, typename T2, typename T3 >
249 AggImplInheritanceHelper2(
250 T1 const & arg1, T2 const & arg2, T3 const & arg3):
251 BaseClass(arg1, arg2, arg3) {}
252 template< typename T1, typename T2, typename T3, typename T4 >
253 AggImplInheritanceHelper2(
254 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
255 BaseClass(arg1, arg2, arg3, arg4) {}
256 template<
257 typename T1, typename T2, typename T3, typename T4, typename T5 >
258 AggImplInheritanceHelper2(
259 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
260 T5 const & arg5):
261 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
262 template<
263 typename T1, typename T2, typename T3, typename T4, typename T5,
264 typename T6 >
265 AggImplInheritanceHelper2(
266 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
267 T5 const & arg5, T6 const & arg6):
268 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
269 public:
270 AggImplInheritanceHelper2() {}
271 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException) SAL_OVERRIDE
272 { return BaseClass::queryInterface( rType ); }
273 virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) throw (css::uno::RuntimeException) SAL_OVERRIDE
274 {
275 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
276 if (aRet.hasValue())
277 return aRet;
278 return BaseClass::queryAggregation( rType );
279 }
280 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
281 { BaseClass::acquire(); }
282 virtual void SAL_CALL release() throw () SAL_OVERRIDE
283 { BaseClass::release(); }
284 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException) SAL_OVERRIDE
285 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
286 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException) SAL_OVERRIDE
287 { return ImplHelper_getImplementationId( cd::get() ); }
288 };
289 }
290
291 #endif
292
293 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
cppu::ImplInheritanceHelper2::ImplInheritanceHelper2
ImplInheritanceHelper2(T1 const &arg1)
Definition: implbase2.hxx:176
cppu::ImplHelper2::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:77
cppu::WeakImplHelper2::release
virtual void release() SAL_OVERRIDE
decreasing m_refCount
Definition: implbase2.hxx:111
cppu::WeakAggImplHelper2::queryAggregation
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Called by the delegator or queryInterface.
Definition: implbase2.hxx:141
cppu::OWeakObject
Base class to implement an UNO object supporting weak references, i.e.
Definition: weak.hxx:43
cppu::WeakAggImplHelper2
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase2.hxx:132
cppu::ImplInheritanceHelper2::ImplInheritanceHelper2
ImplInheritanceHelper2()
Definition: implbase2.hxx:202
cppu
Definition: Enterable.hxx:26
cppu::WeakAggImplHelper2::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:147
rtl::StaticAggregate
Helper class for a late-initialized static aggregate, e.g.
Definition: instance.hxx:546
cppu::AggImplInheritanceHelper2::AggImplInheritanceHelper2
AggImplInheritanceHelper2(T1 const &arg1, T2 const &arg2)
Definition: implbase2.hxx:246
cppu::OWeakAggObject::acquire
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
cppu::WeakImplHelper2::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: implbase2.hxx:107
cppu::ImplHelper2::~ImplHelper2
~ImplHelper2()
Definition: implbase2.hxx:86
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::OWeakObject::acquire
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
cppu::AggImplInheritanceHelper2::release
virtual void release() SAL_OVERRIDE
Definition: implbase2.hxx:282
SAL_OVERRIDE
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:423
cppu::OWeakAggObject
Base class to implement an UNO object supporting weak references, i.e.
Definition: weakagg.hxx:41
com::sun::star
Definition: types.h:391
implbase_ex.hxx
cppu::AggImplInheritanceHelper2
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase2.hxx:237
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.
sal_Bool
unsigned char sal_Bool
Definition: types.h:48
cppu::AggImplInheritanceHelper2::AggImplInheritanceHelper2
AggImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase2.hxx:249
cppu::ImplHelper2::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase2.hxx:73
cppu::ImplInheritanceHelper2::ImplInheritanceHelper2
ImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase2.hxx:185
cppu::AggImplInheritanceHelper2::AggImplInheritanceHelper2
AggImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase2.hxx:258
cppu::ImplInheritanceHelper2::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:216
cppu::AggImplInheritanceHelper2::AggImplInheritanceHelper2
AggImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase2.hxx:265
cppu::ImplInheritanceHelper2::acquire
virtual void acquire() SAL_OVERRIDE
Definition: implbase2.hxx:210
cppu::AggImplInheritanceHelper2::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:284
cppu::AggImplInheritanceHelper2::AggImplInheritanceHelper2
AggImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase2.hxx:253
cppu::ImplInheritanceHelper2::ImplInheritanceHelper2
ImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase2.hxx:181
cppu::WeakAggImplHelper2::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: implbase2.hxx:139
cppu::ImplInheritanceHelper2
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase2.hxx:169
sal_Int8
signed char sal_Int8
Definition: types.h:53
SAL_NO_VTABLE
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:335
cppu::OWeakObject::release
virtual void release() SAL_OVERRIDE
decreasing m_refCount
cppu::WeakImplHelper2::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:115
cppu::WeakAggImplHelper2::release
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
Definition: implbase2.hxx:145
cppu::WeakImplHelper2
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase2.hxx:100
cppu::ImplInheritanceHelper2::ImplInheritanceHelper2
ImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase2.hxx:197
cppu::ImplInheritanceHelper2::ImplInheritanceHelper2
ImplInheritanceHelper2(T1 const &arg1, T2 const &arg2)
Definition: implbase2.hxx:178
cppu::WeakAggImplHelper2::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:149
instance.hxx
cppu::AggImplInheritanceHelper2::AggImplInheritanceHelper2
AggImplInheritanceHelper2()
Definition: implbase2.hxx:270
cppu::AggImplInheritanceHelper2::AggImplInheritanceHelper2
AggImplInheritanceHelper2(T1 const &arg1)
Definition: implbase2.hxx:244
cppu::AggImplInheritanceHelper2::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:286
cppu::WeakImplHelper2::acquire
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
Definition: implbase2.hxx:109
cppu::WeakAggImplHelper2::acquire
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
Definition: implbase2.hxx:143
cppu::ImplInheritanceHelper2::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase2.hxx:203
cppu::WeakImplHelper2::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:113
cppu::ImplInheritanceHelper2::release
virtual void release() SAL_OVERRIDE
Definition: implbase2.hxx:212
cppu::ImplHelper2::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:75
cppu::ImplHelper2
Implementation helper implementing interface css::lang::XTypeProvider and queryInterface(), but no reference counting.
Definition: implbase2.hxx:67
cppu::ImplInheritanceHelper2::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:214
cppu::OWeakAggObject::release
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
cppu::ImplInheritanceHelper2::ImplInheritanceHelper2
ImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase2.hxx:190
cppu::AggImplInheritanceHelper2::queryAggregation
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase2.hxx:273
cppu::AggImplInheritanceHelper2::acquire
virtual void acquire() SAL_OVERRIDE
Definition: implbase2.hxx:280
cppu::AggImplInheritanceHelper2::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase2.hxx:271