AlterOffice
AlterOffice 3.4 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
implbase2.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 #ifndef INCLUDED_CPPUHELPER_IMPLBASE2_HXX
4 #define INCLUDED_CPPUHELPER_IMPLBASE2_HXX
5 
7 #include "rtl/instance.hxx"
8 #include "cppuhelper/weak.hxx"
9 #include "cppuhelper/weakagg.hxx"
10 #include "com/sun/star/lang/XTypeProvider.hpp"
11 
12 namespace cppu
13 {
15 
16  struct class_data2
17  {
18  sal_Int16 m_nTypes;
19  sal_Bool m_storedTypeRefs;
20  sal_Bool m_storedId;
21  sal_Int8 m_id[ 16 ];
22  type_entry m_typeEntries[ 2 + 1 ];
23  };
24 
25  template< typename Ifc1, typename Ifc2, typename Impl > struct SAL_WARN_UNUSED ImplClassData2
26  {
27  class_data* operator ()()
28  {
29  static class_data2 s_cd =
30  {
31  2 +1, false, false,
32  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
33  {
34  CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
35  CPPUHELPER_DETAIL_TYPEENTRY(Ifc2),
36  CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
37  }
38  };
39  return reinterpret_cast< class_data * >(&s_cd);
40  }
41  };
42 
44 
53  template< class Ifc1, class Ifc2 >
54  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper2
55  : public css::lang::XTypeProvider
56  , public Ifc1, public Ifc2
57  {
58  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplHelper2<Ifc1, Ifc2> > > {};
59  public:
60 #if defined LIBO_INTERNAL_ONLY
61  ImplHelper2() = default;
62  ImplHelper2(ImplHelper2 const &) = default;
63  ImplHelper2(ImplHelper2 &&) = default;
64  ImplHelper2 & operator =(ImplHelper2 const &) = default;
65  ImplHelper2 & operator =(ImplHelper2 &&) = default;
66 #endif
67 
68  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
69  { return ImplHelper_query( rType, cd::get(), this ); }
70  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
71  { return ImplHelper_getTypes( cd::get() ); }
72  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
73  { return ImplHelper_getImplementationId( cd::get() ); }
74 
75 #if !defined _MSC_VER // public -> protected changes mangled names there
76  protected:
77 #endif
79  };
88  template< class Ifc1, class Ifc2 >
89  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper2
90  : public OWeakObject
91  , public css::lang::XTypeProvider
92  , public Ifc1, public Ifc2
93  {
94  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakImplHelper2<Ifc1, Ifc2> > > {};
95  public:
96  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
97  { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
98  virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
100  virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
101  { OWeakObject::release(); }
102  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
103  { return WeakImplHelper_getTypes( cd::get() ); }
104  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
105  { return ImplHelper_getImplementationId( cd::get() ); }
106  };
120  template< class Ifc1, class Ifc2 >
121  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper2
122  : public OWeakAggObject
123  , public css::lang::XTypeProvider
124  , public Ifc1, public Ifc2
125  {
126  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggImplHelper2<Ifc1, Ifc2> > > {};
127  public:
128  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
129  { return OWeakAggObject::queryInterface( rType ); }
130  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
131  { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
132  virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
134  virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
136  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
137  { return WeakAggImplHelper_getTypes( cd::get() ); }
138  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
139  { return ImplHelper_getImplementationId( cd::get() ); }
140  };
157  template< class BaseClass, class Ifc1, class Ifc2 >
158  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper2
159  : public BaseClass
160  , public Ifc1, public Ifc2
161  {
162  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
163  protected:
164  template< typename T1 >
165  explicit ImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
166  template< typename T1, typename T2 >
167  ImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
168  BaseClass(arg1, arg2) {}
169  template< typename T1, typename T2, typename T3 >
171  T1 const & arg1, T2 const & arg2, T3 const & arg3):
172  BaseClass(arg1, arg2, arg3) {}
173  template< typename T1, typename T2, typename T3, typename T4 >
175  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
176  BaseClass(arg1, arg2, arg3, arg4) {}
177  template<
178  typename T1, typename T2, typename T3, typename T4, typename T5 >
180  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
181  T5 const & arg5):
182  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
183  template<
184  typename T1, typename T2, typename T3, typename T4, typename T5,
185  typename T6 >
187  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
188  T5 const & arg5, T6 const & arg6):
189  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
190  public:
192  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
193  {
194  css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
195  if (aRet.hasValue())
196  return aRet;
197  return BaseClass::queryInterface( rType );
198  }
199  virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
200  { BaseClass::acquire(); }
201  virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
202  { BaseClass::release(); }
203  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
204  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
205  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
206  { return ImplHelper_getImplementationId( cd::get() ); }
207  };
225  template< class BaseClass, class Ifc1, class Ifc2 >
226  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper2
227  : public BaseClass
228  , public Ifc1, public Ifc2
229  {
230  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, AggImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
231  protected:
232  template< typename T1 >
233  explicit AggImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
234  template< typename T1, typename T2 >
235  AggImplInheritanceHelper2(T1 const & arg1, T2 const & arg2):
236  BaseClass(arg1, arg2) {}
237  template< typename T1, typename T2, typename T3 >
239  T1 const & arg1, T2 const & arg2, T3 const & arg3):
240  BaseClass(arg1, arg2, arg3) {}
241  template< typename T1, typename T2, typename T3, typename T4 >
243  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
244  BaseClass(arg1, arg2, arg3, arg4) {}
245  template<
246  typename T1, typename T2, typename T3, typename T4, typename T5 >
248  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
249  T5 const & arg5):
250  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
251  template<
252  typename T1, typename T2, typename T3, typename T4, typename T5,
253  typename T6 >
255  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
256  T5 const & arg5, T6 const & arg6):
257  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
258  public:
260  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE
261  { return BaseClass::queryInterface( rType ); }
262  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE
263  {
264  css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
265  if (aRet.hasValue())
266  return aRet;
267  return BaseClass::queryAggregation( rType );
268  }
269  virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
270  { BaseClass::acquire(); }
271  virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
272  { BaseClass::release(); }
273  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
274  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
275  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
276  { return ImplHelper_getImplementationId( cd::get() ); }
277  };
278 }
279 
280 #endif
281 
282 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase2.hxx:121
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:70
unsigned char sal_Bool
Definition: types.h:18
virtual void release() SAL_NOEXCEPT SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
Definition: implbase2.hxx:134
~ImplHelper2() SAL_NOEXCEPT
Definition: implbase2.hxx:78
AggImplInheritanceHelper2(T1 const &arg1, T2 const &arg2)
Definition: implbase2.hxx:235
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase2.hxx:192
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase2.hxx:89
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Called by the delegator or queryInterface.
Definition: implbase2.hxx:130
virtual void release() SAL_NOEXCEPT SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:203
Base class to implement a UNO object supporting weak references, i.e.
Definition: weakagg.hxx:25
ImplInheritanceHelper2()
Definition: implbase2.hxx:191
virtual void release() SAL_NOEXCEPT SAL_OVERRIDE
Definition: implbase2.hxx:271
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:205
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: implbase2.hxx:96
virtual void release() SAL_NOEXCEPT SAL_OVERRIDE
Definition: implbase2.hxx:201
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase2.hxx:226
Implementation helper implementing interface css::lang::XTypeProvider and queryInterface(), but no reference counting.
Definition: implbase2.hxx:54
ImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase2.hxx:186
AggImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase2.hxx:238
ImplInheritanceHelper2(T1 const &arg1, T2 const &arg2)
Definition: implbase2.hxx:167
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:138
AggImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase2.hxx:247
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:567
AggImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase2.hxx:254
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:102
virtual void release() SAL_NOEXCEPT SAL_OVERRIDE
decreasing m_refCount
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:136
virtual void acquire() SAL_NOEXCEPT SAL_OVERRIDE
increasing m_refCount
virtual void acquire() SAL_NOEXCEPT SAL_OVERRIDE
increasing m_refCount
Definition: implbase2.hxx:98
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase2.hxx:158
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase2.hxx:273
Helper class for a late-initialized static aggregate, e.g.
Definition: instance.hxx:528
AggImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase2.hxx:242
virtual void release() SAL_NOEXCEPT SAL_OVERRIDE
decreasing m_refCount
Definition: implbase2.hxx:100
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:23
ImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase2.hxx:174
#define SAL_NOEXCEPT
Macro for C++11 &quot;noexcept&quot; vs.
Definition: types.h:396
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase2.hxx:68
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:104
virtual void acquire() SAL_NOEXCEPT SAL_OVERRIDE
Definition: implbase2.hxx:269
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:274
virtual void acquire() SAL_NOEXCEPT SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
ImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase2.hxx:170
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.
AggImplInheritanceHelper2()
Definition: implbase2.hxx:259
AggImplInheritanceHelper2(T1 const &arg1)
Definition: implbase2.hxx:233
virtual void acquire() SAL_NOEXCEPT SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
Definition: implbase2.hxx:132
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:72
ImplInheritanceHelper2(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase2.hxx:179
signed char sal_Int8
Definition: types.h:23
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase2.hxx:275
#define SAL_OVERRIDE
C++11 &quot;override&quot; feature.
Definition: types.h:371
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: implbase2.hxx:128
ImplInheritanceHelper2(T1 const &arg1)
Definition: implbase2.hxx:165
Base class to implement a UNO object supporting weak references, i.e.
Definition: weak.hxx:27
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase2.hxx:262
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase2.hxx:260
virtual void acquire() SAL_NOEXCEPT SAL_OVERRIDE
Definition: implbase2.hxx:199