LibreOffice: cppuhelper/implbase1.hxx Source File

LibreOffice LibreOffice 6.0 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 SAL_WARN_UNUSED ImplClassData1
39 {
40 class_data* operator ()()
41 {
42 static class_data1 s_cd =
43 {
44 1 +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(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 ) SAL_OVERRIDE
73 { return ImplHelper_query( rType, cd::get(), this ); }
74 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
75 { return ImplHelper_getTypes( cd::get() ); }
76 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
77 { return ImplHelper_getImplementationId( cd::get() ); }
78
79 #if !defined _MSC_VER // public -> protected changes mangled names there
80 protected:
81 #elif defined __clang__
82 #pragma clang diagnostic push
83 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
84 #endif
85 ~ImplHelper1() throw () {}
86 #if defined _MSC_VER && defined __clang__
87 #pragma clang diagnostic pop
88 #endif
89 };
102 template< class Ifc1 >
103 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper1
104 : public OWeakObject
105 , public css::lang::XTypeProvider
106 , public Ifc1
107 {
108 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakImplHelper1< Ifc1 > > > {};
109 public:
110 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
111 { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
112 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
113 { OWeakObject::acquire(); }
114 virtual void SAL_CALL release() throw () SAL_OVERRIDE
115 { OWeakObject::release(); }
116 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
117 { return WeakImplHelper_getTypes( cd::get() ); }
118 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
119 { return ImplHelper_getImplementationId( cd::get() ); }
120 };
134 template< class Ifc1 >
135 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper1
136 : public OWeakAggObject
137 , public css::lang::XTypeProvider
138 , public Ifc1
139 {
140 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggImplHelper1< Ifc1 > > > {};
141 public:
142 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
143 { return OWeakAggObject::queryInterface( rType ); }
144 virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
145 { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
146 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
147 { OWeakAggObject::acquire(); }
148 virtual void SAL_CALL release() throw () SAL_OVERRIDE
149 { OWeakAggObject::release(); }
150 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
151 { return WeakAggImplHelper_getTypes( cd::get() ); }
152 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
153 { return ImplHelper_getImplementationId( cd::get() ); }
154 };
171 template< class BaseClass, class Ifc1 >
172 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper1
173 : public BaseClass
174 , public Ifc1
175 {
176 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, ImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
177 protected:
178 template< typename T1 >
179 explicit ImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
180 template< typename T1, typename T2 >
181 ImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
182 BaseClass(arg1, arg2) {}
183 template< typename T1, typename T2, typename T3 >
184 ImplInheritanceHelper1(
185 T1 const & arg1, T2 const & arg2, T3 const & arg3):
186 BaseClass(arg1, arg2, arg3) {}
187 template< typename T1, typename T2, typename T3, typename T4 >
188 ImplInheritanceHelper1(
189 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
190 BaseClass(arg1, arg2, arg3, arg4) {}
191 template<
192 typename T1, typename T2, typename T3, typename T4, typename T5 >
193 ImplInheritanceHelper1(
194 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
195 T5 const & arg5):
196 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
197 template<
198 typename T1, typename T2, typename T3, typename T4, typename T5,
199 typename T6 >
200 ImplInheritanceHelper1(
201 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
202 T5 const & arg5, T6 const & arg6):
203 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
204 public:
205 ImplInheritanceHelper1() {}
206 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
207 {
208 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
209 if (aRet.hasValue())
210 return aRet;
211 return BaseClass::queryInterface( rType );
212 }
213 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
214 { BaseClass::acquire(); }
215 virtual void SAL_CALL release() throw () SAL_OVERRIDE
216 { BaseClass::release(); }
217 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
218 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
219 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
220 { return ImplHelper_getImplementationId( cd::get() ); }
221 };
239 template< class BaseClass, class Ifc1 >
240 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper1
241 : public BaseClass
242 , public Ifc1
243 {
244 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, AggImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
245 protected:
246 template< typename T1 >
247 explicit AggImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
248 template< typename T1, typename T2 >
249 AggImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
250 BaseClass(arg1, arg2) {}
251 template< typename T1, typename T2, typename T3 >
252 AggImplInheritanceHelper1(
253 T1 const & arg1, T2 const & arg2, T3 const & arg3):
254 BaseClass(arg1, arg2, arg3) {}
255 template< typename T1, typename T2, typename T3, typename T4 >
256 AggImplInheritanceHelper1(
257 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
258 BaseClass(arg1, arg2, arg3, arg4) {}
259 template<
260 typename T1, typename T2, typename T3, typename T4, typename T5 >
261 AggImplInheritanceHelper1(
262 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
263 T5 const & arg5):
264 BaseClass(arg1, arg2, arg3, arg4, arg5) {}
265 template<
266 typename T1, typename T2, typename T3, typename T4, typename T5,
267 typename T6 >
268 AggImplInheritanceHelper1(
269 T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
270 T5 const & arg5, T6 const & arg6):
271 BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
272 public:
273 AggImplInheritanceHelper1() {}
274 virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
275 { return BaseClass::queryInterface( rType ); }
276 virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
277 {
278 css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
279 if (aRet.hasValue())
280 return aRet;
281 return BaseClass::queryAggregation( rType );
282 }
283 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
284 { BaseClass::acquire(); }
285 virtual void SAL_CALL release() throw () SAL_OVERRIDE
286 { BaseClass::release(); }
287 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
288 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
289 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
290 { return ImplHelper_getImplementationId( cd::get() ); }
291 };
292 }
293
294 #endif
295
296 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
cppu::AggImplInheritanceHelper1::AggImplInheritanceHelper1
AggImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase1.hxx:252
cppu::ImplHelper1
Implementation helper implementing interface css::lang::XTypeProvider and method XInterface::queryInt...
Definition: implbase1.hxx:66
SAL_OVERRIDE
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:415
cppu::ImplInheritanceHelper1::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase1.hxx:206
cppu::ImplHelper1::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase1.hxx:72
SAL_NO_VTABLE
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:317
cppu::OWeakObject::acquire
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
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:146
cppu::ImplInheritanceHelper1::ImplInheritanceHelper1
ImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase1.hxx:184
rtl::StaticAggregate
Helper class for a late-initialized static aggregate, e.g.
Definition: instance.hxx:544
cppu::AggImplInheritanceHelper1::queryAggregation
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase1.hxx:276
cppu::ImplInheritanceHelper1::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase1.hxx:219
cppu::WeakAggImplHelper1::release
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
Definition: implbase1.hxx:148
cppu::OWeakAggObject
Base class to implement an UNO object supporting weak references, i.e.
Definition: weakagg.hxx:41
cppu::WeakImplHelper1::release
virtual void release() SAL_OVERRIDE
decreasing m_refCount
Definition: implbase1.hxx:114
sal_Int8
signed char sal_Int8
Definition: types.h:44
cppu::WeakImplHelper1::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: implbase1.hxx:110
cppu::ImplInheritanceHelper1::ImplInheritanceHelper1
ImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase1.hxx:193
cppu::WeakImplHelper1::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase1.hxx:116
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:142
cppu::WeakAggImplHelper1::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase1.hxx:150
cppu::AggImplInheritanceHelper1::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase1.hxx:289
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:268
cppu::WeakImplHelper1
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase1.hxx:103
cppu::WeakAggImplHelper1::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase1.hxx:152
SAL_WARN_UNUSED
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:606
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::AggImplInheritanceHelper1::release
virtual void release() SAL_OVERRIDE
Definition: implbase1.hxx:285
cppu::WeakImplHelper1::acquire
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
Definition: implbase1.hxx:112
cppu::WeakAggImplHelper1
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase1.hxx:135
cppu::OWeakObject
Base class to implement an UNO object supporting weak references, i.e.
Definition: weak.hxx:43
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)
Definition: implbase1.hxx:181
cppu::ImplInheritanceHelper1::ImplInheritanceHelper1
ImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase1.hxx:188
cppu::AggImplInheritanceHelper1::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase1.hxx:287
sal_Bool
unsigned char sal_Bool
Definition: types.h:39
cppu::OWeakAggObject::acquire
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
cppu::ImplHelper1::~ImplHelper1
~ImplHelper1()
Definition: implbase1.hxx:85
cppu::AggImplInheritanceHelper1::AggImplInheritanceHelper1
AggImplInheritanceHelper1()
Definition: implbase1.hxx:273
cppu::OWeakAggObject::release
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
cppu::ImplInheritanceHelper1
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase1.hxx:172
cppu::AggImplInheritanceHelper1::queryInterface
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase1.hxx:274
cppu::WeakImplHelper1::getImplementationId
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase1.hxx:118
cppu::ImplHelper1::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase1.hxx:74
cppu::AggImplInheritanceHelper1::AggImplInheritanceHelper1
AggImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase1.hxx:261
cppu::ImplInheritanceHelper1::ImplInheritanceHelper1
ImplInheritanceHelper1(T1 const &arg1)
Definition: implbase1.hxx:179
cppu::AggImplInheritanceHelper1::AggImplInheritanceHelper1
AggImplInheritanceHelper1(T1 const &arg1, T2 const &arg2)
Definition: implbase1.hxx:249
cppu::WeakAggImplHelper1::queryAggregation
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Called by the delegator or queryInterface.
Definition: implbase1.hxx:144
implbase_ex.hxx
cppu::AggImplInheritanceHelper1
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase1.hxx:240
cppu::AggImplInheritanceHelper1::acquire
virtual void acquire() SAL_OVERRIDE
Definition: implbase1.hxx:283
cppu::ImplInheritanceHelper1::release
virtual void release() SAL_OVERRIDE
Definition: implbase1.hxx:215
cppu::ImplInheritanceHelper1::acquire
virtual void acquire() SAL_OVERRIDE
Definition: implbase1.hxx:213
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::AggImplInheritanceHelper1::AggImplInheritanceHelper1
AggImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase1.hxx:256
cppu::AggImplInheritanceHelper1::AggImplInheritanceHelper1
AggImplInheritanceHelper1(T1 const &arg1)
Definition: implbase1.hxx:247
cppu::ImplInheritanceHelper1::getTypes
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase1.hxx:217
instance.hxx
cppu::ImplInheritanceHelper1::ImplInheritanceHelper1
ImplInheritanceHelper1()
Definition: implbase1.hxx:205
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:200