LibreOffice LibreOffice 4.2 SDK C/C++ API Reference

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 #include <com/sun/star/uno/XComponentContext.hpp>
25
26 namespace cppu
27 {
29
30 struct class_data1
31 {
32 sal_Int16 m_nTypes;
33 sal_Bool m_storedTypeRefs;
34 sal_Bool m_storedId;
35 sal_Int8 m_id[ 16 ];
36 type_entry m_typeEntries[ 1 + 1 ];
37 };
38
39 template< typename Ifc1, typename Impl > struct ImplClassData1
40 {
41 class_data* operator ()()
42 {
43 static class_data1 s_cd =
44 {
45 1 +1, sal_False, sal_False,
46 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
47 {
48 { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 },
49 { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
50 }
51 };
52 return reinterpret_cast< class_data * >(&s_cd);
53 }
54 };
55
57
66 template< class Ifc1 >
67 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper1
68 : public com::sun::star::lang::XTypeProvider
69 , public Ifc1
70 {
71 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1 < Ifc1, ImplHelper1<Ifc1> > > {};
72 public:
73 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
74 { return ImplHelper_query( rType, cd::get(), this ); }
75 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
76 { return ImplHelper_getTypes( cd::get() ); }
77 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
78 { return ImplHelper_getImplementationId( cd::get() ); }
79
80 #if !defined _MSC_VER // public -> protected changes mangled names there
81 protected:
82 #endif
83 ~ImplHelper1() throw () {}
84 };
97 template< class Ifc1 >
98 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper1
99 : public OWeakObject
100 , public com::sun::star::lang::XTypeProvider
101 , public Ifc1
102 {
103 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakImplHelper1< Ifc1 > > > {};
104 public:
105 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
106 { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
107 virtual void SAL_CALL acquire() throw ()
108 { OWeakObject::acquire(); }
109 virtual void SAL_CALL release() throw ()
110 { OWeakObject::release(); }
111 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
112 { return WeakImplHelper_getTypes( cd::get() ); }
113 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
114 { return ImplHelper_getImplementationId( cd::get() ); }
115 };
129 template< class Ifc1 >
130 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper1
131 : public OWeakAggObject
132 , public com::sun::star::lang::XTypeProvider
133 , public Ifc1
134 {
135 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggImplHelper1< Ifc1 > > > {};
136 public:
137 virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
138 { return OWeakAggObject::queryInterface( rType ); }
139 virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
140 { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
141 virtual void SAL_CALL acquire() throw ()
142 { OWeakAggObject::acquire(); }
143 virtual void SAL_CALL release() throw ()
144 { OWeakAggObject::release(); }
145 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
146 { return WeakAggImplHelper_getTypes( cd::get() ); }
147 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
148 { return ImplHelper_getImplementationId( cd::get() ); }
149 };
166 template< class BaseClass, class Ifc1 >
167 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper1
168 : public BaseClass
169 , public Ifc1
170 {
171 struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, ImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
172 protected:
173 #if (defined __SUNPRO_CC && __SUNPRO_CC <= 0x550)
174 // Hack, to get comphelper::service_decl to work for non-trivial impl classes
175 ImplInheritanceHelper1( com::sun::star::uno::Sequence<com::sun::star::uno::Any> const& args,
176 com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const& xContext ) : BaseClass(args,xContext) {}
177 #endif
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 com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
207 {
208 com::sun::star::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 ()
214 { BaseClass::acquire(); }
215 virtual void SAL_CALL release() throw ()
216 { BaseClass::release(); }
217 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
218 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
219 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
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 com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
275 { return BaseClass::queryInterface( rType ); }
276 virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
277 {
278 com::sun::star::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 ()
284 { BaseClass::acquire(); }
285 virtual void SAL_CALL release() throw ()
286 { BaseClass::release(); }
287 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
288 { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
289 virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
290 { return ImplHelper_getImplementationId( cd::get() ); }
291 };
292 }
293
294 #endif
295
296 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
cppu::WeakAggImplHelper1::getTypes
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes()
Definition: implbase1.hxx:145
cppu::OWeakObject::acquire
virtual void acquire()
increasing m_refCount
cppu::WeakImplHelper1::acquire
virtual void acquire()
increasing m_refCount
Definition: implbase1.hxx:107
cppu::ImplHelper1::~ImplHelper1
~ImplHelper1()
Definition: implbase1.hxx:83
cppu::AggImplInheritanceHelper1::AggImplInheritanceHelper1
AggImplInheritanceHelper1()
Definition: implbase1.hxx:273
cppu::OWeakAggObject::release
virtual void release()
If a delegator is set, then the delegators gets released.
rtl::StaticAggregate
Helper class for a late-initialized static aggregate, e.g.
Definition: instance.hxx:542
cppu::AggImplInheritanceHelper1::getTypes
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes()
Definition: implbase1.hxx:287
com::sun::star::uno::Type
C++ class representing an IDL meta type.
Definition: Type.h:55
cppu::WeakAggImplHelper1::acquire
virtual void acquire()
If a delegator is set, then the delegators gets acquired.
Definition: implbase1.hxx:141
cppu::ImplHelper1::queryInterface
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType)
Definition: implbase1.hxx:73
cppu::ImplHelper1
Implementation helper implementing interface com::sun::star::lang::XTypeProvider and method XInterfac...
Definition: implbase1.hxx:67
cppu::WeakImplHelper1::release
virtual void release()
decreasing m_refCount
Definition: implbase1.hxx:109
cppu::OWeakAggObject
Base class to implement an UNO object supporting weak references, i.e.
Definition: weakagg.hxx:40
cppu::ImplInheritanceHelper1::ImplInheritanceHelper1
ImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase1.hxx:184
cppu::queryInterface
inline::com::sun::star::uno::Any queryInterface(const ::com::sun::star::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
cppu::WeakAggImplHelper1::release
virtual void release()
If a delegator is set, then the delegators gets released.
Definition: implbase1.hxx:143
implbase_ex.hxx
cppu::WeakImplHelper1
Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and com::sun::star:...
Definition: implbase1.hxx:98
cppu::WeakImplHelper1::queryInterface
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType)
Definition: implbase1.hxx:105
SAL_NO_VTABLE
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:315
cppu::WeakAggImplHelper1::getImplementationId
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId()
Definition: implbase1.hxx:147
cppu::ImplInheritanceHelper1::release
virtual void release()
Definition: implbase1.hxx:215
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::getImplementationId
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId()
Definition: implbase1.hxx:219
cppu::AggImplInheritanceHelper1::AggImplInheritanceHelper1
AggImplInheritanceHelper1(T1 const &arg1)
Definition: implbase1.hxx:247
cppu::WeakAggImplHelper1::queryInterface
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType)
Definition: implbase1.hxx:137
cppu::OWeakObject::release
virtual void release()
decreasing m_refCount
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::AggImplInheritanceHelper1
Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and com::sun::star:...
Definition: implbase1.hxx:240
cppu::ImplInheritanceHelper1::ImplInheritanceHelper1
ImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase1.hxx:188
cppu::AggImplInheritanceHelper1::queryAggregation
virtual com::sun::star::uno::Any queryAggregation(com::sun::star::uno::Type const &rType)
Definition: implbase1.hxx:276
cppu::AggImplInheritanceHelper1::AggImplInheritanceHelper1
AggImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase1.hxx:256
cppu::ImplInheritanceHelper1::acquire
virtual void acquire()
Definition: implbase1.hxx:213
cppu::WeakAggImplHelper1::queryAggregation
virtual com::sun::star::uno::Any queryAggregation(com::sun::star::uno::Type const &rType)
Definition: implbase1.hxx:139
cppu::ImplInheritanceHelper1
Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and com::sun::star:...
Definition: implbase1.hxx:167
cppu::ImplInheritanceHelper1::ImplInheritanceHelper1
ImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase1.hxx:193
cppu::OWeakAggObject::queryInterface
virtual ::com::sun::star::uno::Any queryInterface(const ::com::sun::star::uno::Type &rType)
If a delegator is set, then the delegator is queried for the demanded interface.
cppu::ImplHelper1::getImplementationId
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId()
Definition: implbase1.hxx:77
cppu::ImplInheritanceHelper1::ImplInheritanceHelper1
ImplInheritanceHelper1(T1 const &arg1, T2 const &arg2)
Definition: implbase1.hxx:181
instance.hxx
cppu::ImplHelper1::getTypes
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes()
Definition: implbase1.hxx:75
cppu::ImplInheritanceHelper1::ImplInheritanceHelper1
ImplInheritanceHelper1()
Definition: implbase1.hxx:205
com::sun::star::uno::Reference
Template reference class for interface type derived from BaseReference.
Definition: unotype.hxx:32
cppu::AggImplInheritanceHelper1::AggImplInheritanceHelper1
AggImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase1.hxx:252
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
cppu::AggImplInheritanceHelper1::acquire
virtual void acquire()
Definition: implbase1.hxx:283
cppu::WeakAggImplHelper1
Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and com::sun::star:...
Definition: implbase1.hxx:130
cppu::AggImplInheritanceHelper1::queryInterface
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType)
Definition: implbase1.hxx:274
com::sun::star::uno::Any
C++ class representing an IDL any.
Definition: Any.h:46
cppu::ImplInheritanceHelper1::ImplInheritanceHelper1
ImplInheritanceHelper1(T1 const &arg1)
Definition: implbase1.hxx:179
cppu::AggImplInheritanceHelper1::getImplementationId
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId()
Definition: implbase1.hxx:289
cppu::AggImplInheritanceHelper1::release
virtual void release()
Definition: implbase1.hxx:285
sal_Bool
unsigned char sal_Bool
Definition: types.h:46
com::sun::star::uno::Any::hasValue
sal_Bool hasValue() const
Tests if any contains a value.
Definition: Any.h:150
cppu::OWeakAggObject::acquire
virtual void acquire()
If a delegator is set, then the delegators gets acquired.
cppu::OWeakObject
Base class to implement an UNO object supporting weak references, i.e.
Definition: weak.hxx:43
sal_False
#define sal_False
Definition: types.h:47
cppu::ImplInheritanceHelper1::queryInterface
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType)
Definition: implbase1.hxx:206
cppu::AggImplInheritanceHelper1::AggImplInheritanceHelper1
AggImplInheritanceHelper1(T1 const &arg1, T2 const &arg2)
Definition: implbase1.hxx:249
sal_Int8
signed char sal_Int8
Definition: types.h:51
cppu::WeakImplHelper1::getImplementationId
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId()
Definition: implbase1.hxx:113
com::sun::star::uno::Sequence
Template C++ class representing an IDL sequence.
Definition: unotype.hxx:33
cppu::WeakImplHelper1::getTypes
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes()
Definition: implbase1.hxx:111
cppu::ImplInheritanceHelper1::getTypes
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes()
Definition: implbase1.hxx:217