LibreOffice: cppuhelper/implbase2.hxx Source File

LibreOffice LibreOffice 5.1 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, sal_False, sal_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 #endif
83 ~ImplHelper2() throw () {}
84 };
93 template< class Ifc1, class Ifc2 >
94 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper2
95 : public OWeakObject
96 , public css::lang::XTypeProvider
97 , public Ifc1, public Ifc2
98 {
99 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakImplHelper2<Ifc1, Ifc2> > > {};
100 public:
101 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
102 { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
103 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
104 { OWeakObject::acquire(); }
105 virtual void SAL_CALL release() throw () SAL_OVERRIDE
106 { OWeakObject::release(); }
107 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
108 { return WeakImplHelper_getTypes( cd::get() ); }
109 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
110 { return ImplHelper_getImplementationId( cd::get() ); }
111 };
125 template< class Ifc1, class Ifc2 >
126 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper2
127 : public OWeakAggObject
128 , public css::lang::XTypeProvider
129 , public Ifc1, public Ifc2
130 {
131 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggImplHelper2<Ifc1, Ifc2> > > {};
132 public:
133 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
134 { return OWeakAggObject::queryInterface( rType ); }
135 virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
136 { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
137 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
138 { OWeakAggObject::acquire(); }
139 virtual void SAL_CALL release() throw () SAL_OVERRIDE
140 { OWeakAggObject::release(); }
141 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
142 { return WeakAggImplHelper_getTypes( cd::get() ); }
143 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
144 { return ImplHelper_getImplementationId( cd::get() ); }
145 };
162 template< class BaseClass, class Ifc1, class Ifc2 >
163 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper2
164 : public BaseClass
165 , public Ifc1, public Ifc2
166 {
167 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
168 protected:
169 template< typename T1 >
170 explicit ImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
171 template< typename T1, typename T2 >
172 ImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
173 BaseClass(arg1, arg2) {}
174 template< typename T1, typename T2, typename T3 >
175 ImplInheritanceHelper2(
176 T1 const & arg1, T2 const & arg2, T3 const & arg3):
177 BaseClass(arg1, arg2, arg3) {}
178 template< typename T1, typename T2, typename T3, typename T4 >
179 ImplInheritanceHelper2(
180 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
181 BaseClass(arg1, arg2, arg3, arg4) {}
182 template<
183 typename T1, typename T2, typename T3, typename T4, typename T5 >
184 ImplInheritanceHelper2(
185 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
186 T5 const & arg5):
187 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
188 template<
189 typename T1, typename T2, typename T3, typename T4, typename T5,
190 typename T6 >
191 ImplInheritanceHelper2(
192 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
193 T5 const & arg5, T6 const & arg6):
194 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
195 public:
196 ImplInheritanceHelper2() {}
197 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
198 {
199 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
200 if (aRet.hasValue())
201 return aRet;
202 return BaseClass::queryInterface( rType );
203 }
204 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
205 { BaseClass::acquire(); }
206 virtual void SAL_CALL release() throw () SAL_OVERRIDE
207 { BaseClass::release(); }
208 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
209 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
210 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
211 { return ImplHelper_getImplementationId( cd::get() ); }
212 };
230 template< class BaseClass, class Ifc1, class Ifc2 >
231 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper2
232 : public BaseClass
233 , public Ifc1, public Ifc2
234 {
235 struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, AggImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
236 protected:
237 template< typename T1 >
238 explicit AggImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
239 template< typename T1, typename T2 >
240 AggImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
241 BaseClass(arg1, arg2) {}
242 template< typename T1, typename T2, typename T3 >
243 AggImplInheritanceHelper2(
244 T1 const & arg1, T2 const & arg2, T3 const & arg3):
245 BaseClass(arg1, arg2, arg3) {}
246 template< typename T1, typename T2, typename T3, typename T4 >
247 AggImplInheritanceHelper2(
248 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
249 BaseClass(arg1, arg2, arg3, arg4) {}
250 template<
251 typename T1, typename T2, typename T3, typename T4, typename T5 >
252 AggImplInheritanceHelper2(
253 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
254 T5 const & arg5):
255 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
256 template<
257 typename T1, typename T2, typename T3, typename T4, typename T5,
258 typename T6 >
259 AggImplInheritanceHelper2(
260 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
261 T5 const & arg5, T6 const & arg6):
262 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
263 public:
264 AggImplInheritanceHelper2() {}
265 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException) SAL_OVERRIDE
266 { return BaseClass::queryInterface( rType ); }
267 virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) throw (css::uno::RuntimeException) SAL_OVERRIDE
268 {
269 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
270 if (aRet.hasValue())
271 return aRet;
272 return BaseClass::queryAggregation( rType );
273 }
274 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
275 { BaseClass::acquire(); }
276 virtual void SAL_CALL release() throw () SAL_OVERRIDE
277 { BaseClass::release(); }
278 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException) SAL_OVERRIDE
279 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
280 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException) SAL_OVERRIDE
281 { return ImplHelper_getImplementationId( cd::get() ); }
282 };
283 }
284
285 #endif
286
287 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
cppu::ImplInheritanceHelper2::ImplInheritanceHelper2
ImplInheritanceHelper2(T1 const &arg1)
Definition: implbase2.hxx:170
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:105
cppu::WeakAggImplHelper2::queryAggregation
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Called by the delegator or queryInterface.
Definition: implbase2.hxx:135
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:126
cppu::ImplInheritanceHelper2::ImplInheritanceHelper2
ImplInheritanceHelper2()
Definition: implbase2.hxx:196
cppu
Definition: Enterable.hxx:26
cppu::WeakAggImplHelper2::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:141
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:240
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 ::sun::star::uno::XWeak and ::sun::star::uno::XInter...
Definition: implbase2.hxx:101
cppu::ImplHelper2::~ImplHelper2
~ImplHelper2()
Definition: implbase2.hxx:83
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:276
SAL_OVERRIDE
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:421
cppu::OWeakAggObject
Base class to implement an UNO object supporting weak references, i.e.
Definition: weakagg.hxx:41
com::sun::star
Definition: types.h:389
implbase_ex.hxx
cppu::AggImplInheritanceHelper2
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase2.hxx:231
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:243
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:179
cppu::AggImplInheritanceHelper2::AggImplInheritanceHelper2
AggImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase2.hxx:252
cppu::ImplInheritanceHelper2::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:210
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:259
cppu::ImplInheritanceHelper2::acquire
virtual void acquire() SAL_OVERRIDE
Definition: implbase2.hxx:204
cppu::AggImplInheritanceHelper2::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:278
cppu::AggImplInheritanceHelper2::AggImplInheritanceHelper2
AggImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase2.hxx:247
cppu::ImplInheritanceHelper2::ImplInheritanceHelper2
ImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase2.hxx:175
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:133
cppu::ImplInheritanceHelper2
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase2.hxx:163
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:333
sal_False
#define sal_False
Definition: types.h:49
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:109
cppu::WeakAggImplHelper2::release
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
Definition: implbase2.hxx:139
cppu::WeakImplHelper2
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase2.hxx:94
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:191
cppu::ImplInheritanceHelper2::ImplInheritanceHelper2
ImplInheritanceHelper2(T1 const &arg1, T2 const &arg2)
Definition: implbase2.hxx:172
cppu::WeakAggImplHelper2::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:143
instance.hxx
cppu::AggImplInheritanceHelper2::AggImplInheritanceHelper2
AggImplInheritanceHelper2()
Definition: implbase2.hxx:264
cppu::AggImplInheritanceHelper2::AggImplInheritanceHelper2
AggImplInheritanceHelper2(T1 const &arg1)
Definition: implbase2.hxx:238
cppu::AggImplInheritanceHelper2::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:280
cppu::WeakImplHelper2::acquire
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
Definition: implbase2.hxx:103
cppu::WeakAggImplHelper2::acquire
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
Definition: implbase2.hxx:137
cppu::ImplInheritanceHelper2::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase2.hxx:197
cppu::WeakImplHelper2::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:107
cppu::ImplInheritanceHelper2::release
virtual void release() SAL_OVERRIDE
Definition: implbase2.hxx:206
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:208
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:184
cppu::AggImplInheritanceHelper2::queryAggregation
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase2.hxx:267
cppu::AggImplInheritanceHelper2::acquire
virtual void acquire() SAL_OVERRIDE
Definition: implbase2.hxx:274
cppu::AggImplInheritanceHelper2::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase2.hxx:265