LibreOffice
LibreOffice 5.1 SDK C/C++ API Reference
implbase5.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_IMPLBASE5_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE5_HXX
21 
23 #include <rtl/instance.hxx>
24 
25 namespace cppu
26 {
28 
29  struct class_data5
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[ 5 + 1 ];
36  };
37 
38  template< typename Ifc1, typename Ifc2, typename Ifc3, typename Ifc4, typename Ifc5, typename Impl >
39  struct ImplClassData5
40  {
41  class_data* operator ()()
42  {
43  static class_data5 s_cd =
44  {
45  5 +1, sal_False, sal_False,
46  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
47  {
48  CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
49  CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
50  CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
51  CPPUHELPER_DETAIL_TYPEENTRY(Ifc4),
52  CPPUHELPER_DETAIL_TYPEENTRY(Ifc5),
53  CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
54  }
55  };
56  return reinterpret_cast< class_data * >(&s_cd);
57  }
58  };
59 
61 
70  template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
71  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper5
72  : public css::lang::XTypeProvider
73  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
74  {
75  struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, ImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
76  public:
77  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
78  { return ImplHelper_query( rType, cd::get(), this ); }
79  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
80  { return ImplHelper_getTypes( cd::get() ); }
81  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
82  { return ImplHelper_getImplementationId( cd::get() ); }
83 
84 #if !defined _MSC_VER // public -> protected changes mangled names there
85  protected:
86 #endif
87  ~ImplHelper5() throw () {}
88  };
97  template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
98  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper5
99  : public OWeakObject
100  , public css::lang::XTypeProvider
101  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
102  {
103  struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
104  public:
105  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
106  { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
107  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
108  { OWeakObject::acquire(); }
109  virtual void SAL_CALL release() throw () SAL_OVERRIDE
110  { OWeakObject::release(); }
111  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
112  { return WeakImplHelper_getTypes( cd::get() ); }
113  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
114  { return ImplHelper_getImplementationId( cd::get() ); }
115  };
129  template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
130  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper5
131  : public OWeakAggObject
132  , public css::lang::XTypeProvider
133  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
134  {
135  struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakAggImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
136  public:
137  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
138  { return OWeakAggObject::queryInterface( rType ); }
139  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
140  { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
141  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
143  virtual void SAL_CALL release() throw () SAL_OVERRIDE
145  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
146  { return WeakAggImplHelper_getTypes( cd::get() ); }
147  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
148  { return ImplHelper_getImplementationId( cd::get() ); }
149  };
166  template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
167  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper5
168  : public BaseClass
169  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
170  {
171  struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, ImplInheritanceHelper5<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
172  protected:
173  template< typename T1 >
174  explicit ImplInheritanceHelper5(T1 const & arg1): BaseClass(arg1) {}
175  template< typename T1, typename T2 >
176  ImplInheritanceHelper5(T1 const & arg1, T2 const & arg2):
177  BaseClass(arg1, arg2) {}
178  template< typename T1, typename T2, typename T3 >
180  T1 const & arg1, T2 const & arg2, T3 const & arg3):
181  BaseClass(arg1, arg2, arg3) {}
182  template< typename T1, typename T2, typename T3, typename T4 >
184  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
185  BaseClass(arg1, arg2, arg3, arg4) {}
186  template<
187  typename T1, typename T2, typename T3, typename T4, typename T5 >
189  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
190  T5 const & arg5):
191  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
192  template<
193  typename T1, typename T2, typename T3, typename T4, typename T5,
194  typename T6 >
196  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
197  T5 const & arg5, T6 const & arg6):
198  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
199  public:
201  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
202  {
203  css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
204  if (aRet.hasValue())
205  return aRet;
206  return BaseClass::queryInterface( rType );
207  }
208  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
209  { BaseClass::acquire(); }
210  virtual void SAL_CALL release() throw () SAL_OVERRIDE
211  { BaseClass::release(); }
212  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
213  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
214  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
215  { return ImplHelper_getImplementationId( cd::get() ); }
216  };
234  template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
235  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper5
236  : public BaseClass
237  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
238  {
239  struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, AggImplInheritanceHelper5<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
240  protected:
241  template< typename T1 >
242  explicit AggImplInheritanceHelper5(T1 const & arg1): BaseClass(arg1) {}
243  template< typename T1, typename T2 >
244  AggImplInheritanceHelper5(T1 const & arg1, T2 const & arg2):
245  BaseClass(arg1, arg2) {}
246  template< typename T1, typename T2, typename T3 >
248  T1 const & arg1, T2 const & arg2, T3 const & arg3):
249  BaseClass(arg1, arg2, arg3) {}
250  template< typename T1, typename T2, typename T3, typename T4 >
252  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
253  BaseClass(arg1, arg2, arg3, arg4) {}
254  template<
255  typename T1, typename T2, typename T3, typename T4, typename T5 >
257  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
258  T5 const & arg5):
259  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
260  template<
261  typename T1, typename T2, typename T3, typename T4, typename T5,
262  typename T6 >
264  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
265  T5 const & arg5, T6 const & arg6):
266  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
267  public:
269  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException) SAL_OVERRIDE
270  { return BaseClass::queryInterface( rType ); }
271  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) throw (css::uno::RuntimeException) SAL_OVERRIDE
272  {
273  css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
274  if (aRet.hasValue())
275  return aRet;
276  return BaseClass::queryAggregation( rType );
277  }
278  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
279  { BaseClass::acquire(); }
280  virtual void SAL_CALL release() throw () SAL_OVERRIDE
281  { BaseClass::release(); }
282  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException) SAL_OVERRIDE
283  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
284  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException) SAL_OVERRIDE
285  { return ImplHelper_getImplementationId( cd::get() ); }
286  };
287 }
288 
289 #endif
290 
291 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AggImplInheritanceHelper5(T1 const &arg1)
Definition: implbase5.hxx:242
ImplInheritanceHelper5()
Definition: implbase5.hxx:200
AggImplInheritanceHelper5(T1 const &arg1, T2 const &arg2)
Definition: implbase5.hxx:244
Base class to implement an UNO object supporting weak references, i.e.
Definition: weak.hxx:43
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase5.hxx:271
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase5.hxx:235
virtual void acquire() SAL_OVERRIDE
Definition: implbase5.hxx:278
Definition: Enterable.hxx:26
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase5.hxx:130
ImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase5.hxx:188
Helper class for a late-initialized static aggregate, e.g.
Definition: instance.hxx:546
ImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase5.hxx:183
AggImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase5.hxx:256
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
ImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase5.hxx:195
virtual void acquire() SAL_OVERRIDE
Definition: implbase5.hxx:208
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:421
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase5.hxx:98
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase5.hxx:147
Base class to implement an UNO object supporting weak references, i.e.
Definition: weakagg.hxx:41
Definition: types.h:389
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase5.hxx:145
ImplInheritanceHelper5(T1 const &arg1)
Definition: implbase5.hxx:174
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase5.hxx:214
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.
virtual void release() SAL_OVERRIDE
Definition: implbase5.hxx:210
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase5.hxx:105
unsigned char sal_Bool
Definition: types.h:48
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase5.hxx:282
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
Definition: implbase5.hxx:143
AggImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase5.hxx:247
AggImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase5.hxx:251
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
Definition: implbase5.hxx:107
~ImplHelper5()
Definition: implbase5.hxx:87
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase5.hxx:79
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase5.hxx:137
signed char sal_Int8
Definition: types.h:53
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase5.hxx:284
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:333
AggImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase5.hxx:263
#define sal_False
Definition: types.h:49
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase5.hxx:167
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase5.hxx:113
ImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase5.hxx:179
ImplInheritanceHelper5(T1 const &arg1, T2 const &arg2)
Definition: implbase5.hxx:176
virtual void release() SAL_OVERRIDE
decreasing m_refCount
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase5.hxx:77
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase5.hxx:201
virtual void release() SAL_OVERRIDE
Definition: implbase5.hxx:280
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
Definition: implbase5.hxx:141
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase5.hxx:269
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase5.hxx:111
virtual void release() SAL_OVERRIDE
decreasing m_refCount
Definition: implbase5.hxx:109
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase5.hxx:81
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase5.hxx:212
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase5.hxx:139
AggImplInheritanceHelper5()
Definition: implbase5.hxx:268
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
Implementation helper implementing interface css::lang::XTypeProvider and method XInterface::queryInt...
Definition: implbase5.hxx:71