LibreOffice
LibreOffice 4.2 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
implbase4.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_IMPLBASE4_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE4_HXX
21 
23 #include <rtl/instance.hxx>
24 
25 namespace cppu
26 {
28 
29  struct class_data4
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[ 4 + 1 ];
36  };
37 
38  template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Impl >
39  struct ImplClassData4
40  {
41  class_data* operator ()()
42  {
43  static class_data4 s_cd =
44  {
45  4 +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  { { Ifc2::static_type }, ((sal_IntPtr)(Ifc2 *) (Impl *) 16) - 16 },
50  { { Ifc3::static_type }, ((sal_IntPtr)(Ifc3 *) (Impl *) 16) - 16 },
51  { { Ifc4::static_type }, ((sal_IntPtr)(Ifc4 *) (Impl *) 16) - 16 },
52  { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
53  }
54  };
55  return reinterpret_cast< class_data * >(&s_cd);
56  }
57  };
58 
60 
69  template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
70  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper4
71  : public com::sun::star::lang::XTypeProvider
72  , public Ifc1, public Ifc2, public Ifc3, public Ifc4
73  {
74  struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, ImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
75  public:
76  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
77  { return ImplHelper_query( rType, cd::get(), this ); }
78  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
79  { return ImplHelper_getTypes( cd::get() ); }
80  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
81  { return ImplHelper_getImplementationId( cd::get() ); }
82 
83 #if !defined _MSC_VER // public -> protected changes mangled names there
84  protected:
85 #endif
86  ~ImplHelper4() throw () {}
87  };
96  template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
97  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper4
98  : public OWeakObject
99  , public com::sun::star::lang::XTypeProvider
100  , public Ifc1, public Ifc2, public Ifc3, public Ifc4
101  {
102  struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
103  public:
104  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
105  { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
106  virtual void SAL_CALL acquire() throw ()
107  { OWeakObject::acquire(); }
108  virtual void SAL_CALL release() throw ()
109  { OWeakObject::release(); }
110  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
111  { return WeakImplHelper_getTypes( cd::get() ); }
112  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
113  { return ImplHelper_getImplementationId( cd::get() ); }
114  };
128  template< class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
129  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper4
130  : public OWeakAggObject
131  , public com::sun::star::lang::XTypeProvider
132  , public Ifc1, public Ifc2, public Ifc3, public Ifc4
133  {
134  struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, WeakAggImplHelper4<Ifc1, Ifc2, Ifc3, Ifc4> > > {};
135  public:
136  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
137  { return OWeakAggObject::queryInterface( rType ); }
138  virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
139  { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
140  virtual void SAL_CALL acquire() throw ()
142  virtual void SAL_CALL release() throw ()
144  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
145  { return WeakAggImplHelper_getTypes( cd::get() ); }
146  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
147  { return ImplHelper_getImplementationId( cd::get() ); }
148  };
165  template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
166  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper4
167  : public BaseClass
168  , public Ifc1, public Ifc2, public Ifc3, public Ifc4
169  {
170  struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, ImplInheritanceHelper4<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4> > > {};
171  protected:
172  template< typename T1 >
173  explicit ImplInheritanceHelper4(T1 const & arg1): BaseClass(arg1) {}
174  template< typename T1, typename T2 >
175  ImplInheritanceHelper4(T1 const & arg1, T2 const & arg2):
176  BaseClass(arg1, arg2) {}
177  template< typename T1, typename T2, typename T3 >
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 >
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 >
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 >
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:
200  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
201  {
202  com::sun::star::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 ()
208  { BaseClass::acquire(); }
209  virtual void SAL_CALL release() throw ()
210  { BaseClass::release(); }
211  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
212  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
213  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
214  { return ImplHelper_getImplementationId( cd::get() ); }
215  };
233  template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4 >
234  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper4
235  : public BaseClass
236  , public Ifc1, public Ifc2, public Ifc3, public Ifc4
237  {
238  struct cd : public rtl::StaticAggregate< class_data, ImplClassData4 < Ifc1, Ifc2, Ifc3, Ifc4, AggImplInheritanceHelper4<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4> > > {};
239  protected:
240  template< typename T1 >
241  explicit AggImplInheritanceHelper4(T1 const & arg1): BaseClass(arg1) {}
242  template< typename T1, typename T2 >
243  AggImplInheritanceHelper4(T1 const & arg1, T2 const & arg2):
244  BaseClass(arg1, arg2) {}
245  template< typename T1, typename T2, typename T3 >
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 >
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 >
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 >
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:
268  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
269  { return BaseClass::queryInterface( rType ); }
270  virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
271  {
272  com::sun::star::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 ()
278  { BaseClass::acquire(); }
279  virtual void SAL_CALL release() throw ()
280  { BaseClass::release(); }
281  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
282  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
283  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
284  { return ImplHelper_getImplementationId( cd::get() ); }
285  };
286 }
287 
288 #endif
289 
290 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AggImplInheritanceHelper4()
Definition: implbase4.hxx:267
virtual void acquire()
increasing m_refCount
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType)
Definition: implbase4.hxx:136
virtual void release()
decreasing m_refCount
Definition: implbase4.hxx:108
virtual void release()
If a delegator is set, then the delegators gets released.
Helper class for a late-initialized static aggregate, e.g.
Definition: instance.hxx:542
AggImplInheritanceHelper4(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase4.hxx:246
ImplInheritanceHelper4()
Definition: implbase4.hxx:199
virtual com::sun::star::uno::Any queryAggregation(com::sun::star::uno::Type const &rType)
Definition: implbase4.hxx:138
virtual void acquire()
increasing m_refCount
Definition: implbase4.hxx:106
C++ class representing an IDL meta type.
Definition: Type.h:55
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType)
Definition: implbase4.hxx:76
Base class to implement an UNO object supporting weak references, i.e.
Definition: weakagg.hxx:40
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes()
Definition: implbase4.hxx:78
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
ImplInheritanceHelper4(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase4.hxx:194
Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and com::sun::star:...
Definition: implbase4.hxx:166
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:315
AggImplInheritanceHelper4(T1 const &arg1)
Definition: implbase4.hxx:241
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId()
Definition: implbase4.hxx:213
ImplInheritanceHelper4(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase4.hxx:187
virtual void release()
decreasing m_refCount
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId()
Definition: implbase4.hxx:80
ImplInheritanceHelper4(T1 const &arg1)
Definition: implbase4.hxx:173
AggImplInheritanceHelper4(T1 const &arg1, T2 const &arg2)
Definition: implbase4.hxx:243
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId()
Definition: implbase4.hxx:283
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes()
Definition: implbase4.hxx:110
virtual void acquire()
Definition: implbase4.hxx:207
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.
Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and com::sun::star:...
Definition: implbase4.hxx:129
AggImplInheritanceHelper4(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase4.hxx:250
C++ class representing an IDL any.
Definition: Any.h:46
virtual void release()
Definition: implbase4.hxx:209
ImplInheritanceHelper4(T1 const &arg1, T2 const &arg2)
Definition: implbase4.hxx:175
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId()
Definition: implbase4.hxx:112
AggImplInheritanceHelper4(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase4.hxx:262
AggImplInheritanceHelper4(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase4.hxx:255
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes()
Definition: implbase4.hxx:281
unsigned char sal_Bool
Definition: types.h:46
sal_Bool hasValue() const
Tests if any contains a value.
Definition: Any.h:150
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType)
Definition: implbase4.hxx:268
Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and com::sun::star:...
Definition: implbase4.hxx:97
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType)
Definition: implbase4.hxx:200
Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and com::sun::star:...
Definition: implbase4.hxx:234
Implementation helper implementing interface com::sun::star::lang::XTypeProvider and method XInterfac...
Definition: implbase4.hxx:70
virtual void acquire()
Definition: implbase4.hxx:277
virtual void acquire()
If a delegator is set, then the delegators gets acquired.
Base class to implement an UNO object supporting weak references, i.e.
Definition: weak.hxx:43
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes()
Definition: implbase4.hxx:211
virtual void acquire()
If a delegator is set, then the delegators gets acquired.
Definition: implbase4.hxx:140
virtual void release()
If a delegator is set, then the delegators gets released.
Definition: implbase4.hxx:142
#define sal_False
Definition: types.h:47
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes()
Definition: implbase4.hxx:144
virtual void release()
Definition: implbase4.hxx:279
signed char sal_Int8
Definition: types.h:51
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType)
Definition: implbase4.hxx:104
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId()
Definition: implbase4.hxx:146
ImplInheritanceHelper4(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase4.hxx:182
virtual com::sun::star::uno::Any queryAggregation(com::sun::star::uno::Type const &rType)
Definition: implbase4.hxx:270
ImplInheritanceHelper4(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase4.hxx:178
~ImplHelper4()
Definition: implbase4.hxx:86
Template C++ class representing an IDL sequence.
Definition: unotype.hxx:33