LibreOffice
LibreOffice 4.3 SDK C/C++ API Reference
implbase8.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_IMPLBASE8_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE8_HXX
21 
23 #include <rtl/instance.hxx>
24 
25 namespace cppu
26 {
28 
29  struct class_data8
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[ 8 + 1 ];
36  };
37 
38  template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Ifc6, typename Ifc7, typename Ifc8, typename Impl >
39  struct ImplClassData8
40  {
41  class_data* operator ()()
42  {
43  static class_data8 s_cd =
44  {
45  8 +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  { { Ifc5::static_type }, ((sal_IntPtr)(Ifc5 *) (Impl *) 16) - 16 },
53  { { Ifc6::static_type }, ((sal_IntPtr)(Ifc6 *) (Impl *) 16) - 16 },
54  { { Ifc7::static_type }, ((sal_IntPtr)(Ifc7 *) (Impl *) 16) - 16 },
55  { { Ifc8::static_type }, ((sal_IntPtr)(Ifc8 *) (Impl *) 16) - 16 },
56  { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
57  }
58  };
59  return reinterpret_cast< class_data * >(&s_cd);
60  }
61  };
62 
64 
73  template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
74  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper8
75  : public com::sun::star::lang::XTypeProvider
76  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
77  {
78  struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, ImplHelper8<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
79  public:
80  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
81  { return ImplHelper_query( rType, cd::get(), this ); }
82  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
83  { return ImplHelper_getTypes( cd::get() ); }
84  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
85  { return ImplHelper_getImplementationId( cd::get() ); }
86 
87 #if !defined _MSC_VER // public -> protected changes mangled names there
88  protected:
89 #endif
90  ~ImplHelper8() throw () {}
91  };
100  template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
101  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper8
102  : public OWeakObject
103  , public com::sun::star::lang::XTypeProvider
104  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
105  {
106  struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, WeakImplHelper8<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
107  public:
108  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
109  { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
110  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
111  { OWeakObject::acquire(); }
112  virtual void SAL_CALL release() throw () SAL_OVERRIDE
113  { OWeakObject::release(); }
114  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
115  { return WeakImplHelper_getTypes( cd::get() ); }
116  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
117  { return ImplHelper_getImplementationId( cd::get() ); }
118  };
132  template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
133  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper8
134  : public OWeakAggObject
135  , public com::sun::star::lang::XTypeProvider
136  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
137  {
138  struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, WeakAggImplHelper8<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
139  public:
140  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
141  { return OWeakAggObject::queryInterface( rType ); }
142  virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
143  { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
144  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
146  virtual void SAL_CALL release() throw () SAL_OVERRIDE
148  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
149  { return WeakAggImplHelper_getTypes( cd::get() ); }
150  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
151  { return ImplHelper_getImplementationId( cd::get() ); }
152  };
169  template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
170  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper8
171  : public BaseClass
172  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
173  {
174  struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, ImplInheritanceHelper8<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
175  protected:
176  template< typename T1 >
177  explicit ImplInheritanceHelper8(T1 const & arg1): BaseClass(arg1) {}
178  template< typename T1, typename T2 >
179  ImplInheritanceHelper8(T1 const & arg1, T2 const & arg2):
180  BaseClass(arg1, arg2) {}
181  template< typename T1, typename T2, typename T3 >
183  T1 const & arg1, T2 const & arg2, T3 const & arg3):
184  BaseClass(arg1, arg2, arg3) {}
185  template< typename T1, typename T2, typename T3, typename T4 >
187  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
188  BaseClass(arg1, arg2, arg3, arg4) {}
189  template<
190  typename T1, typename T2, typename T3, typename T4, typename T5 >
192  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
193  T5 const & arg5):
194  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
195  template<
196  typename T1, typename T2, typename T3, typename T4, typename T5,
197  typename T6 >
199  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
200  T5 const & arg5, T6 const & arg6):
201  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
202  public:
204  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
205  {
206  com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
207  if (aRet.hasValue())
208  return aRet;
209  return BaseClass::queryInterface( rType );
210  }
211  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
212  { BaseClass::acquire(); }
213  virtual void SAL_CALL release() throw () SAL_OVERRIDE
214  { BaseClass::release(); }
215  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
216  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
217  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
218  { return ImplHelper_getImplementationId( cd::get() ); }
219  };
237  template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5, class Ifc6, class Ifc7, class Ifc8 >
238  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper8
239  : public BaseClass
240  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5, public Ifc6, public Ifc7, public Ifc8
241  {
242  struct cd : public rtl::StaticAggregate< class_data, ImplClassData8< Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, AggImplInheritanceHelper8<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8> > > {};
243  protected:
244  template< typename T1 >
245  explicit AggImplInheritanceHelper8(T1 const & arg1): BaseClass(arg1) {}
246  template< typename T1, typename T2 >
247  AggImplInheritanceHelper8(T1 const & arg1, T2 const & arg2):
248  BaseClass(arg1, arg2) {}
249  template< typename T1, typename T2, typename T3 >
251  T1 const & arg1, T2 const & arg2, T3 const & arg3):
252  BaseClass(arg1, arg2, arg3) {}
253  template< typename T1, typename T2, typename T3, typename T4 >
255  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
256  BaseClass(arg1, arg2, arg3, arg4) {}
257  template<
258  typename T1, typename T2, typename T3, typename T4, typename T5 >
260  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
261  T5 const & arg5):
262  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
263  template<
264  typename T1, typename T2, typename T3, typename T4, typename T5,
265  typename T6 >
267  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
268  T5 const & arg5, T6 const & arg6):
269  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
270  public:
272  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
273  { return BaseClass::queryInterface( rType ); }
274  virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
275  {
276  com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
277  if (aRet.hasValue())
278  return aRet;
279  return BaseClass::queryAggregation( rType );
280  }
281  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
282  { BaseClass::acquire(); }
283  virtual void SAL_CALL release() throw () SAL_OVERRIDE
284  { BaseClass::release(); }
285  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
286  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
287  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException) SAL_OVERRIDE
288  { return ImplHelper_getImplementationId( cd::get() ); }
289  };
290 }
291 
292 #endif
293 
294 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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
Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and com::sun::star:...
Definition: implbase8.hxx:170
AggImplInheritanceHelper8(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase8.hxx:250
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase8.hxx:116
virtual com::sun::star::uno::Any queryAggregation(com::sun::star::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase8.hxx:274
Base class to implement an UNO object supporting weak references, i.e.
Definition: weakagg.hxx:40
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase8.hxx:204
unsigned char sal_Bool
Definition: types.h:46
virtual void release() SAL_OVERRIDE
decreasing m_refCount
Definition: implbase8.hxx:112
C++ class representing an IDL meta type.
Definition: Type.h:55
bool hasValue() const SAL_THROW(())
Tests if any contains a value.
Definition: Any.h:150
Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and com::sun::star:...
Definition: implbase8.hxx:101
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase8.hxx:80
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase8.hxx:148
~ImplHelper8()
Definition: implbase8.hxx:90
#define sal_False
Definition: types.h:47
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase8.hxx:150
ImplInheritanceHelper8(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase8.hxx:186
virtual void release() SAL_OVERRIDE
Definition: implbase8.hxx:283
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase8.hxx:285
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase8.hxx:140
Template C++ class representing an IDL sequence.
Definition: unotype.hxx:33
ImplInheritanceHelper8(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase8.hxx:198
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase8.hxx:82
virtual com::sun::star::uno::Any queryAggregation(com::sun::star::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase8.hxx:142
virtual ::com::sun::star::uno::Any queryInterface(const ::com::sun::star::uno::Type &rType) SAL_OVERRIDE
If a delegator is set, then the delegator is queried for the demanded interface.
ImplInheritanceHelper8(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase8.hxx:191
Implementation helper implementing interface com::sun::star::lang::XTypeProvider and method XInterfac...
Definition: implbase8.hxx:74
AggImplInheritanceHelper8(T1 const &arg1)
Definition: implbase8.hxx:245
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
Definition: implbase8.hxx:144
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:423
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase8.hxx:272
ImplInheritanceHelper8(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase8.hxx:182
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
signed char sal_Int8
Definition: types.h:51
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase8.hxx:84
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
Definition: implbase8.hxx:146
Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and com::sun::star:...
Definition: implbase8.hxx:238
Implementation helper implementing interfaces com::sun::star::lang::XTypeProvider and com::sun::star:...
Definition: implbase8.hxx:133
Definition: Enterable.hxx:26
ImplInheritanceHelper8(T1 const &arg1, T2 const &arg2)
Definition: implbase8.hxx:179
C++ class representing an IDL any.
Definition: Any.h:46
virtual void release() SAL_OVERRIDE
Definition: implbase8.hxx:213
AggImplInheritanceHelper8()
Definition: implbase8.hxx:271
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase8.hxx:215
AggImplInheritanceHelper8(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase8.hxx:259
AggImplInheritanceHelper8(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase8.hxx:266
ImplInheritanceHelper8()
Definition: implbase8.hxx:203
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase8.hxx:217
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:317
Base class to implement an UNO object supporting weak references, i.e.
Definition: weak.hxx:43
virtual com::sun::star::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase8.hxx:287
Helper class for a late-initialized static aggregate, e.g.
Definition: instance.hxx:542
ImplInheritanceHelper8(T1 const &arg1)
Definition: implbase8.hxx:177
virtual void release() SAL_OVERRIDE
decreasing m_refCount
AggImplInheritanceHelper8(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase8.hxx:254
AggImplInheritanceHelper8(T1 const &arg1, T2 const &arg2)
Definition: implbase8.hxx:247
virtual com::sun::star::uno::Any queryInterface(com::sun::star::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase8.hxx:108
virtual void acquire() SAL_OVERRIDE
Definition: implbase8.hxx:211
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase8.hxx:114
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
Definition: implbase8.hxx:110
Definition: types.h:391
virtual void acquire() SAL_OVERRIDE
Definition: implbase8.hxx:281