LibreOffice
LibreOffice 6.2 SDK C/C++ API Reference
implbase3.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_IMPLBASE3_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE3_HXX
21 
23 #include "rtl/instance.hxx"
24 #include "cppuhelper/weak.hxx"
25 #include "cppuhelper/weakagg.hxx"
26 #include "com/sun/star/lang/XTypeProvider.hpp"
27 
28 namespace cppu
29 {
31 
32  struct class_data3
33  {
34  sal_Int16 m_nTypes;
35  sal_Bool m_storedTypeRefs;
36  sal_Bool m_storedId;
37  sal_Int8 m_id[ 16 ];
38  type_entry m_typeEntries[ 3 + 1 ];
39  };
40 
41  template< typename Ifc1, typename Ifc2, typename Ifc3, typename Impl > struct SAL_WARN_UNUSED ImplClassData3
42  {
43  class_data* operator ()()
44  {
45  static class_data3 s_cd =
46  {
47  3 +1, false, false,
48  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
49  {
50  CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
51  CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
52  CPPUHELPER_DETAIL_TYPEENTRY(Ifc3),
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 >
71  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper3
72  : public css::lang::XTypeProvider
73  , public Ifc1, public Ifc2, public Ifc3
74  {
75  struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, ImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
76  public:
77 #if defined LIBO_INTERNAL_ONLY
78  ImplHelper3() = default;
79  ImplHelper3(ImplHelper3 const &) = default;
80  ImplHelper3(ImplHelper3 &&) = default;
81  ImplHelper3 & operator =(ImplHelper3 const &) = default;
82  ImplHelper3 & operator =(ImplHelper3 &&) = default;
83 #endif
84 
85  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
86  { return ImplHelper_query( rType, cd::get(), this ); }
87  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
88  { return ImplHelper_getTypes( cd::get() ); }
89  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
90  { return ImplHelper_getImplementationId( cd::get() ); }
91 
92 #if !defined _MSC_VER // public -> protected changes mangled names there
93  protected:
94 #elif defined __clang__
95 #pragma clang diagnostic push
96 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
97 #endif
98  ~ImplHelper3() throw () {}
99 #if defined _MSC_VER && defined __clang__
100 #pragma clang diagnostic pop
101 #endif
102  };
111  template< class Ifc1, class Ifc2, class Ifc3 >
112  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper3
113  : public OWeakObject
114  , public css::lang::XTypeProvider
115  , public Ifc1, public Ifc2, public Ifc3
116  {
117  struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
118  public:
119  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
120  { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
121  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
122  { OWeakObject::acquire(); }
123  virtual void SAL_CALL release() throw () SAL_OVERRIDE
124  { OWeakObject::release(); }
125  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
126  { return WeakImplHelper_getTypes( cd::get() ); }
127  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
128  { return ImplHelper_getImplementationId( cd::get() ); }
129  };
143  template< class Ifc1, class Ifc2, class Ifc3 >
144  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper3
145  : public OWeakAggObject
146  , public css::lang::XTypeProvider
147  , public Ifc1, public Ifc2, public Ifc3
148  {
149  struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, WeakAggImplHelper3<Ifc1, Ifc2, Ifc3> > > {};
150  public:
151  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
152  { return OWeakAggObject::queryInterface( rType ); }
153  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
154  { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
155  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
157  virtual void SAL_CALL release() throw () SAL_OVERRIDE
159  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
160  { return WeakAggImplHelper_getTypes( cd::get() ); }
161  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
162  { return ImplHelper_getImplementationId( cd::get() ); }
163  };
181  template< class BaseClass, class Ifc1, class Ifc2, class Ifc3 >
182  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper3
183  : public BaseClass
184  , public Ifc1, public Ifc2, public Ifc3
185  {
186  struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, ImplInheritanceHelper3<BaseClass, Ifc1, Ifc2, Ifc3> > > {};
187  protected:
188  template< typename T1 >
189  explicit ImplInheritanceHelper3(T1 const & arg1): BaseClass(arg1) {}
190  template< typename T1, typename T2 >
191  ImplInheritanceHelper3(T1 const & arg1, T2 const & arg2):
192  BaseClass(arg1, arg2) {}
193  template< typename T1, typename T2, typename T3 >
195  T1 const & arg1, T2 const & arg2, T3 const & arg3):
196  BaseClass(arg1, arg2, arg3) {}
197  template< typename T1, typename T2, typename T3, typename T4 >
199  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
200  BaseClass(arg1, arg2, arg3, arg4) {}
201  template<
202  typename T1, typename T2, typename T3, typename T4, typename T5 >
204  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
205  T5 const & arg5):
206  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
207  template<
208  typename T1, typename T2, typename T3, typename T4, typename T5,
209  typename T6 >
211  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
212  T5 const & arg5, T6 const & arg6):
213  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
214  public:
216  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
217  {
218  css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
219  if (aRet.hasValue())
220  return aRet;
221  return BaseClass::queryInterface( rType );
222  }
223  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
224  { BaseClass::acquire(); }
225  virtual void SAL_CALL release() throw () SAL_OVERRIDE
226  { BaseClass::release(); }
227  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
228  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
229  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
230  { return ImplHelper_getImplementationId( cd::get() ); }
231  };
249  template< class BaseClass, class Ifc1, class Ifc2, class Ifc3 >
250  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper3
251  : public BaseClass
252  , public Ifc1, public Ifc2, public Ifc3
253  {
254  struct cd : public rtl::StaticAggregate< class_data, ImplClassData3 < Ifc1, Ifc2, Ifc3, AggImplInheritanceHelper3<BaseClass, Ifc1, Ifc2, Ifc3> > > {};
255  protected:
256  template< typename T1 >
257  explicit AggImplInheritanceHelper3(T1 const & arg1): BaseClass(arg1) {}
258  template< typename T1, typename T2 >
259  AggImplInheritanceHelper3(T1 const & arg1, T2 const & arg2):
260  BaseClass(arg1, arg2) {}
261  template< typename T1, typename T2, typename T3 >
263  T1 const & arg1, T2 const & arg2, T3 const & arg3):
264  BaseClass(arg1, arg2, arg3) {}
265  template< typename T1, typename T2, typename T3, typename T4 >
267  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
268  BaseClass(arg1, arg2, arg3, arg4) {}
269  template<
270  typename T1, typename T2, typename T3, typename T4, typename T5 >
272  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
273  T5 const & arg5):
274  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
275  template<
276  typename T1, typename T2, typename T3, typename T4, typename T5,
277  typename T6 >
279  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
280  T5 const & arg5, T6 const & arg6):
281  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
282  public:
284  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
285  { return BaseClass::queryInterface( rType ); }
286  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
287  {
288  css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
289  if (aRet.hasValue())
290  return aRet;
291  return BaseClass::queryAggregation( rType );
292  }
293  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
294  { BaseClass::acquire(); }
295  virtual void SAL_CALL release() throw () SAL_OVERRIDE
296  { BaseClass::release(); }
297  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
298  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
299  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
300  { return ImplHelper_getImplementationId( cd::get() ); }
301  };
302 }
303 
304 #endif
305 
306 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase3.hxx:127
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase3.hxx:85
AggImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase3.hxx:271
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase3.hxx:153
AggImplInheritanceHelper3(T1 const &arg1, T2 const &arg2)
Definition: implbase3.hxx:259
virtual void acquire() SAL_OVERRIDE
Definition: implbase3.hxx:293
Base class to implement an UNO object supporting weak references, i.e.
Definition: weak.hxx:43
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase3.hxx:250
virtual void acquire() SAL_OVERRIDE
Definition: implbase3.hxx:223
Definition: Enterable.hxx:26
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase3.hxx:227
Helper class for a late-initialized static aggregate, e.g.
Definition: instance.hxx:544
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:602
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
AggImplInheritanceHelper3(T1 const &arg1)
Definition: implbase3.hxx:257
virtual void release() SAL_OVERRIDE
Definition: implbase3.hxx:225
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
Definition: implbase3.hxx:155
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
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:409
Base class to implement an UNO object supporting weak references, i.e.
Definition: weakagg.hxx:41
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase3.hxx:182
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
Definition: implbase3.hxx:157
AggImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase3.hxx:278
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.
unsigned char sal_Bool
Definition: types.h:38
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase3.hxx:125
virtual void release() SAL_OVERRIDE
decreasing m_refCount
Definition: implbase3.hxx:123
AggImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase3.hxx:262
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase3.hxx:297
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase3.hxx:119
virtual void release() SAL_OVERRIDE
Definition: implbase3.hxx:295
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase3.hxx:284
ImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase3.hxx:210
signed char sal_Int8
Definition: types.h:43
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:312
Implementation helper implementing interface css::lang::XTypeProvider and method XInterface::queryInt...
Definition: implbase3.hxx:71
~ImplHelper3()
Definition: implbase3.hxx:98
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
Definition: implbase3.hxx:121
AggImplInheritanceHelper3()
Definition: implbase3.hxx:283
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase3.hxx:299
virtual void release() SAL_OVERRIDE
decreasing m_refCount
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase3.hxx:151
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase3.hxx:286
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase3.hxx:89
ImplInheritanceHelper3(T1 const &arg1, T2 const &arg2)
Definition: implbase3.hxx:191
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase3.hxx:159
ImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase3.hxx:194
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase3.hxx:216
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase3.hxx:87
ImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase3.hxx:203
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase3.hxx:229
ImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase3.hxx:198
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase3.hxx:112
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase3.hxx:144
AggImplInheritanceHelper3(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase3.hxx:266
ImplInheritanceHelper3()
Definition: implbase3.hxx:215
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase3.hxx:161
ImplInheritanceHelper3(T1 const &arg1)
Definition: implbase3.hxx:189