1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_CPPUHELPER_IMPLBASE1_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE1_HXX
22 #include <cppuhelper/implbase_ex.hxx>
23 #include <rtl/instance.hxx>
32 sal_Bool m_storedTypeRefs
;
35 type_entry m_typeEntries
[ 1 + 1 ];
38 template< typename Ifc1
, typename Impl
> struct SAL_WARN_UNUSED ImplClassData1
40 class_data
* operator ()()
42 static class_data1 s_cd
=
45 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
47 CPPUHELPER_DETAIL_TYPEENTRY(Ifc1
),
48 CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider
)
51 return reinterpret_cast< class_data
* >(&s_cd
);
57 /** Implementation helper implementing interface css::lang::XTypeProvider
58 and method XInterface::queryInterface(), but no reference counting.
61 Inherit from this class giving your interface(s) to be implemented as template argument(s).
62 Your sub class defines method implementations for these interface(s) including acquire()/
63 release() and delegates incoming queryInterface() calls to this base class.
65 template< class Ifc1
>
66 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper1
67 : public css::lang::XTypeProvider
70 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData1
< Ifc1
, ImplHelper1
<Ifc1
> > > {};
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() ); }
79 #if !defined _MSC_VER // public -> protected changes mangled names there
81 #elif defined __clang__
82 #pragma clang diagnostic push
83 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
85 ~ImplHelper1() throw () {}
86 #if defined _MSC_VER && defined __clang__
87 #pragma clang diagnostic pop
90 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
91 css::uno::XInterface which supports weak mechanism to be held weakly
92 (supporting css::uno::XWeak through ::cppu::OWeakObject).
95 Inherit from this class giving your interface(s) to be implemented as template argument(s).
96 Your sub class defines method implementations for these interface(s).
98 These classes are used when you implement your UNO component.
99 WeakImplHelper1 till WeakImplHelper12 can be used when you want
100 to implement 1 till 12 interfaces in your component.
102 template< class Ifc1
>
103 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper1
105 , public css::lang::XTypeProvider
108 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData1
< Ifc1
, WeakImplHelper1
< Ifc1
> > > {};
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() ); }
121 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
122 css::uno::XInterface which supports weak mechanism to be held weakly
123 (supporting css::uno::XWeak through ::cppu::OWeakAggObject).
124 In addition, it supports also aggregation meaning object of this class can be aggregated
125 (css::uno::XAggregation through ::cppu::OWeakAggObject).
126 If a delegator is set (this object is aggregated), then incoming queryInterface()
127 calls are delegated to the delegator object. If the delegator does not support the
128 demanded interface, it calls queryAggregation() on its aggregated objects.
131 Inherit from this class giving your interface(s) to be implemented as template argument(s).
132 Your sub class defines method implementations for these interface(s).
134 template< class Ifc1
>
135 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper1
136 : public OWeakAggObject
137 , public css::lang::XTypeProvider
140 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData1
< Ifc1
, WeakAggImplHelper1
< Ifc1
> > > {};
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() ); }
155 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
156 css::uno::XInterface inherting from a BaseClass.
157 All acquire() and release() calls are delegated to the BaseClass. Upon queryInterface(),
158 if a demanded interface is not supported by this class directly, the request is
159 delegated to the BaseClass.
162 The BaseClass has to be complete in a sense, that css::uno::XInterface
163 and css::lang::XTypeProvider are implemented properly. The
164 BaseClass must have at least one ctor that can be called with six or
165 fewer arguments, of which none is of non-const reference type.
168 Inherit from this class giving your additional interface(s) to be implemented as
169 template argument(s). Your sub class defines method implementations for these interface(s).
171 template< class BaseClass
, class Ifc1
>
172 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper1
176 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData1
< Ifc1
, ImplInheritanceHelper1
< BaseClass
, Ifc1
> > > {};
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
) {}
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
,
196 BaseClass(arg1
, arg2
, arg3
, arg4
, arg5
) {}
198 typename T1
, typename T2
, typename T3
, typename T4
, typename T5
,
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
) {}
205 ImplInheritanceHelper1() {}
206 virtual css::uno::Any SAL_CALL
queryInterface( css::uno::Type
const & rType
) SAL_OVERRIDE
208 css::uno::Any
aRet( ImplHelper_queryNoXInterface( rType
, cd::get(), this ) );
211 return BaseClass::queryInterface( rType
);
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() ); }
222 /** Implementation helper implementing interfaces css::lang::XTypeProvider and
223 css::uno::XInterface inherting from a BaseClass.
224 All acquire(), release() and queryInterface() calls are delegated to the BaseClass.
225 Upon queryAggregation(), if a demanded interface is not supported by this class directly,
226 the request is delegated to the BaseClass.
229 The BaseClass has to be complete in a sense, that css::uno::XInterface,
230 css::uno::XAggregation and css::lang::XTypeProvider
231 are implemented properly. The BaseClass must have at least one ctor
232 that can be called with six or fewer arguments, of which none is of
233 non-const reference type.
236 Inherit from this class giving your additional interface(s) to be implemented as
237 template argument(s). Your sub class defines method implementations for these interface(s).
239 template< class BaseClass
, class Ifc1
>
240 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper1
244 struct cd
: public rtl::StaticAggregate
< class_data
, ImplClassData1
< Ifc1
, AggImplInheritanceHelper1
< BaseClass
, Ifc1
> > > {};
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
) {}
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
,
264 BaseClass(arg1
, arg2
, arg3
, arg4
, arg5
) {}
266 typename T1
, typename T2
, typename T3
, typename T4
, typename T5
,
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
) {}
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
278 css::uno::Any
aRet( ImplHelper_queryNoXInterface( rType
, cd::get(), this ) );
281 return BaseClass::queryAggregation( rType
);
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() ); }
296 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */