LibreOffice
LibreOffice 5.3 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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, false, 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 #elif defined __clang__
87 #pragma clang diagnostic push
88 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
89 #endif
90  ~ImplHelper5() throw () {}
91 #if defined _MSC_VER && defined __clang__
92 #pragma clang diagnostic pop
93 #endif
94  };
103  template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
104  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper5
105  : public OWeakObject
106  , public css::lang::XTypeProvider
107  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
108  {
109  struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
110  public:
111  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
112  { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
113  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
114  { OWeakObject::acquire(); }
115  virtual void SAL_CALL release() throw () SAL_OVERRIDE
116  { OWeakObject::release(); }
117  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
118  { return WeakImplHelper_getTypes( cd::get() ); }
119  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
120  { return ImplHelper_getImplementationId( cd::get() ); }
121  };
135  template< class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
136  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper5
137  : public OWeakAggObject
138  , public css::lang::XTypeProvider
139  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
140  {
141  struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, WeakAggImplHelper5<Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
142  public:
143  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
144  { return OWeakAggObject::queryInterface( rType ); }
145  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
146  { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
147  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
149  virtual void SAL_CALL release() throw () SAL_OVERRIDE
151  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
152  { return WeakAggImplHelper_getTypes( cd::get() ); }
153  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
154  { return ImplHelper_getImplementationId( cd::get() ); }
155  };
172  template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
173  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper5
174  : public BaseClass
175  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
176  {
177  struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, ImplInheritanceHelper5<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
178  protected:
179  template< typename T1 >
180  explicit ImplInheritanceHelper5(T1 const & arg1): BaseClass(arg1) {}
181  template< typename T1, typename T2 >
182  ImplInheritanceHelper5(T1 const & arg1, T2 const & arg2):
183  BaseClass(arg1, arg2) {}
184  template< typename T1, typename T2, typename T3 >
186  T1 const & arg1, T2 const & arg2, T3 const & arg3):
187  BaseClass(arg1, arg2, arg3) {}
188  template< typename T1, typename T2, typename T3, typename T4 >
190  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
191  BaseClass(arg1, arg2, arg3, arg4) {}
192  template<
193  typename T1, typename T2, typename T3, typename T4, typename T5 >
195  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
196  T5 const & arg5):
197  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
198  template<
199  typename T1, typename T2, typename T3, typename T4, typename T5,
200  typename T6 >
202  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
203  T5 const & arg5, T6 const & arg6):
204  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
205  public:
207  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
208  {
209  css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
210  if (aRet.hasValue())
211  return aRet;
212  return BaseClass::queryInterface( rType );
213  }
214  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
215  { BaseClass::acquire(); }
216  virtual void SAL_CALL release() throw () SAL_OVERRIDE
217  { BaseClass::release(); }
218  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
219  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
220  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
221  { return ImplHelper_getImplementationId( cd::get() ); }
222  };
240  template< class BaseClass, class Ifc1, class Ifc2, class Ifc3, class Ifc4, class Ifc5 >
241  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper5
242  : public BaseClass
243  , public Ifc1, public Ifc2, public Ifc3, public Ifc4, public Ifc5
244  {
245  struct cd : public rtl::StaticAggregate< class_data, ImplClassData5 < Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, AggImplInheritanceHelper5<BaseClass, Ifc1, Ifc2, Ifc3, Ifc4, Ifc5> > > {};
246  protected:
247  template< typename T1 >
248  explicit AggImplInheritanceHelper5(T1 const & arg1): BaseClass(arg1) {}
249  template< typename T1, typename T2 >
250  AggImplInheritanceHelper5(T1 const & arg1, T2 const & arg2):
251  BaseClass(arg1, arg2) {}
252  template< typename T1, typename T2, typename T3 >
254  T1 const & arg1, T2 const & arg2, T3 const & arg3):
255  BaseClass(arg1, arg2, arg3) {}
256  template< typename T1, typename T2, typename T3, typename T4 >
258  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
259  BaseClass(arg1, arg2, arg3, arg4) {}
260  template<
261  typename T1, typename T2, typename T3, typename T4, typename T5 >
263  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
264  T5 const & arg5):
265  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
266  template<
267  typename T1, typename T2, typename T3, typename T4, typename T5,
268  typename T6 >
270  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
271  T5 const & arg5, T6 const & arg6):
272  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
273  public:
275  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException) SAL_OVERRIDE
276  { return BaseClass::queryInterface( rType ); }
277  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) throw (css::uno::RuntimeException) SAL_OVERRIDE
278  {
279  css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
280  if (aRet.hasValue())
281  return aRet;
282  return BaseClass::queryAggregation( rType );
283  }
284  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
285  { BaseClass::acquire(); }
286  virtual void SAL_CALL release() throw () SAL_OVERRIDE
287  { BaseClass::release(); }
288  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException) SAL_OVERRIDE
289  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
290  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException) SAL_OVERRIDE
291  { return ImplHelper_getImplementationId( cd::get() ); }
292  };
293 }
294 
295 #endif
296 
297 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AggImplInheritanceHelper5(T1 const &arg1)
Definition: implbase5.hxx:248
ImplInheritanceHelper5()
Definition: implbase5.hxx:206
AggImplInheritanceHelper5(T1 const &arg1, T2 const &arg2)
Definition: implbase5.hxx:250
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:277
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase5.hxx:241
virtual void acquire() SAL_OVERRIDE
Definition: implbase5.hxx:284
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase5.hxx:136
ImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase5.hxx:194
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:189
AggImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase5.hxx:262
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:201
virtual void acquire() SAL_OVERRIDE
Definition: implbase5.hxx:214
#define SAL_OVERRIDE
C++11 &quot;override&quot; feature.
Definition: types.h:423
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase5.hxx:104
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase5.hxx:153
Base class to implement an UNO object supporting weak references, i.e.
Definition: weakagg.hxx:41
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase5.hxx:151
ImplInheritanceHelper5(T1 const &arg1)
Definition: implbase5.hxx:180
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase5.hxx:220
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:216
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Basic queryInterface() implementation supporting com::sun::star::uno::XWeak and com::sun::star::uno::...
Definition: implbase5.hxx:111
unsigned char sal_Bool
Definition: types.h:48
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase5.hxx:288
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
Definition: implbase5.hxx:149
AggImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase5.hxx:253
AggImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase5.hxx:257
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
Definition: implbase5.hxx:113
~ImplHelper5()
Definition: implbase5.hxx:90
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
If a delegator is set, then the delegator is queried for the demanded interface.
Definition: implbase5.hxx:143
signed char sal_Int8
Definition: types.h:53
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase5.hxx:290
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:335
AggImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase5.hxx:269
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase5.hxx:173
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase5.hxx:119
ImplInheritanceHelper5(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase5.hxx:185
ImplInheritanceHelper5(T1 const &arg1, T2 const &arg2)
Definition: implbase5.hxx:182
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:207
virtual void release() SAL_OVERRIDE
Definition: implbase5.hxx:286
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
Definition: implbase5.hxx:147
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase5.hxx:275
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase5.hxx:117
virtual void release() SAL_OVERRIDE
decreasing m_refCount
Definition: implbase5.hxx:115
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:218
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Called by the delegator or queryInterface.
Definition: implbase5.hxx:145
AggImplInheritanceHelper5()
Definition: implbase5.hxx:274
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