LibreOffice: cppuhelper/implbase1.hxx Source File

LibreOffice LibreOffice 5.1 SDK C/C++ API Reference

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