LibreOffice
LibreOffice 5.3 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
implbase1.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_IMPLBASE1_HXX
20 #define INCLUDED_CPPUHELPER_IMPLBASE1_HXX
21 
23 #include <rtl/instance.hxx>
24 
25 namespace cppu
26 {
28 
29  struct class_data1
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[ 1 + 1 ];
36  };
37 
38  template< typename Ifc1, typename Impl > struct ImplClassData1
39  {
40  class_data* operator ()()
41  {
42  static class_data1 s_cd =
43  {
44  1 +1, false, false,
45  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
46  {
47  CPPUHELPER_DETAIL_TYPEENTRY(Ifc1),
48  CPPUHELPER_DETAIL_TYPEENTRY(css::lang::XTypeProvider)
49  }
50  };
51  return reinterpret_cast< class_data * >(&s_cd);
52  }
53  };
54 
56 
65  template< class Ifc1 >
66  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper1
67  : public css::lang::XTypeProvider
68  , public Ifc1
69  {
70  struct cd : public rtl::StaticAggregate< class_data, ImplClassData1 < Ifc1, ImplHelper1<Ifc1> > > {};
71  public:
72  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
73  { return ImplHelper_query( rType, cd::get(), this ); }
74  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
75  { return ImplHelper_getTypes( cd::get() ); }
76  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
77  { return ImplHelper_getImplementationId( cd::get() ); }
78 
79 #if !defined _MSC_VER // public -> protected changes mangled names there
80  protected:
81 #elif defined __clang__
82 #pragma clang diagnostic push
83 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
84 #endif
85  ~ImplHelper1() throw () {}
86 #if defined _MSC_VER && defined __clang__
87 #pragma clang diagnostic pop
88 #endif
89  };
102  template< class Ifc1 >
103  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE SAL_DLLPUBLIC_EXPORT WeakImplHelper1
104  : public OWeakObject
105  , public css::lang::XTypeProvider
106  , public Ifc1
107  {
108  struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakImplHelper1< Ifc1 > > > {};
109  public:
110  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
111  { return WeakImplHelper_query( rType, cd::get(), this, static_cast<OWeakObject *>(this) ); }
112  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
113  { OWeakObject::acquire(); }
114  virtual void SAL_CALL release() throw () SAL_OVERRIDE
115  { OWeakObject::release(); }
116  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
117  { return WeakImplHelper_getTypes( cd::get() ); }
118  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
119  { return ImplHelper_getImplementationId( cd::get() ); }
120  };
134  template< class Ifc1 >
135  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper1
136  : public OWeakAggObject
137  , public css::lang::XTypeProvider
138  , public Ifc1
139  {
140  struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggImplHelper1< Ifc1 > > > {};
141  public:
142  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
143  { return OWeakAggObject::queryInterface( rType ); }
144  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
145  { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, static_cast<OWeakAggObject *>(this) ); }
146  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
148  virtual void SAL_CALL release() throw () SAL_OVERRIDE
150  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
151  { return WeakAggImplHelper_getTypes( cd::get() ); }
152  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
153  { return ImplHelper_getImplementationId( cd::get() ); }
154  };
171  template< class BaseClass, class Ifc1 >
172  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper1
173  : public BaseClass
174  , public Ifc1
175  {
176  struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, ImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
177  protected:
178  template< typename T1 >
179  explicit ImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
180  template< typename T1, typename T2 >
181  ImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
182  BaseClass(arg1, arg2) {}
183  template< typename T1, typename T2, typename T3 >
185  T1 const & arg1, T2 const & arg2, T3 const & arg3):
186  BaseClass(arg1, arg2, arg3) {}
187  template< typename T1, typename T2, typename T3, typename T4 >
189  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
190  BaseClass(arg1, arg2, arg3, arg4) {}
191  template<
192  typename T1, typename T2, typename T3, typename T4, typename T5 >
194  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
195  T5 const & arg5):
196  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
197  template<
198  typename T1, typename T2, typename T3, typename T4, typename T5,
199  typename T6 >
201  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
202  T5 const & arg5, T6 const & arg6):
203  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
204  public:
206  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
207  {
208  css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
209  if (aRet.hasValue())
210  return aRet;
211  return BaseClass::queryInterface( rType );
212  }
213  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
214  { BaseClass::acquire(); }
215  virtual void SAL_CALL release() throw () SAL_OVERRIDE
216  { BaseClass::release(); }
217  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
218  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
219  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
220  { return ImplHelper_getImplementationId( cd::get() ); }
221  };
239  template< class BaseClass, class Ifc1 >
240  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper1
241  : public BaseClass
242  , public Ifc1
243  {
244  struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, AggImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
245  protected:
246  template< typename T1 >
247  explicit AggImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
248  template< typename T1, typename T2 >
249  AggImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
250  BaseClass(arg1, arg2) {}
251  template< typename T1, typename T2, typename T3 >
253  T1 const & arg1, T2 const & arg2, T3 const & arg3):
254  BaseClass(arg1, arg2, arg3) {}
255  template< typename T1, typename T2, typename T3, typename T4 >
257  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
258  BaseClass(arg1, arg2, arg3, arg4) {}
259  template<
260  typename T1, typename T2, typename T3, typename T4, typename T5 >
262  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
263  T5 const & arg5):
264  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
265  template<
266  typename T1, typename T2, typename T3, typename T4, typename T5,
267  typename T6 >
269  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
270  T5 const & arg5, T6 const & arg6):
271  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
272  public:
274  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) throw (css::uno::RuntimeException) SAL_OVERRIDE
275  { return BaseClass::queryInterface( rType ); }
276  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) throw (css::uno::RuntimeException) SAL_OVERRIDE
277  {
278  css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
279  if (aRet.hasValue())
280  return aRet;
281  return BaseClass::queryAggregation( rType );
282  }
283  virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
284  { BaseClass::acquire(); }
285  virtual void SAL_CALL release() throw () SAL_OVERRIDE
286  { BaseClass::release(); }
287  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() throw (css::uno::RuntimeException) SAL_OVERRIDE
288  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
289  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (css::uno::RuntimeException) SAL_OVERRIDE
290  { return ImplHelper_getImplementationId( cd::get() ); }
291  };
292 }
293 
294 #endif
295 
296 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase1.hxx:135
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase1.hxx:72
ImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase1.hxx:188
virtual void acquire() SAL_OVERRIDE
Definition: implbase1.hxx:283
AggImplInheritanceHelper1(T1 const &arg1, T2 const &arg2)
Definition: implbase1.hxx:249
Base class to implement an UNO object supporting weak references, i.e.
Definition: weak.hxx:43
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase1.hxx:206
ImplInheritanceHelper1(T1 const &arg1, T2 const &arg2)
Definition: implbase1.hxx:181
Helper class for a late-initialized static aggregate, e.g.
Definition: instance.hxx:546
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase1.hxx:276
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface which...
Definition: implbase1.hxx:103
virtual css::uno::Any queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
Definition: implbase1.hxx:274
virtual css::uno::Any queryAggregation(css::uno::Type const &rType) SAL_OVERRIDE
Called by the delegator or queryInterface.
Definition: implbase1.hxx:144
AggImplInheritanceHelper1(T1 const &arg1)
Definition: implbase1.hxx:247
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
Definition: implbase1.hxx:148
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase1.hxx:76
AggImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase1.hxx:268
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
AggImplInheritanceHelper1()
Definition: implbase1.hxx:273
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
AggImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4)
Definition: implbase1.hxx:256
ImplInheritanceHelper1()
Definition: implbase1.hxx:205
virtual void acquire() SAL_OVERRIDE
Definition: implbase1.hxx:213
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: implbase1.hxx:110
#define SAL_OVERRIDE
C++11 &quot;override&quot; feature.
Definition: types.h:423
Base class to implement an UNO object supporting weak references, i.e.
Definition: weakagg.hxx:41
ImplInheritanceHelper1(T1 const &arg1)
Definition: implbase1.hxx:179
Implementation helper implementing interface css::lang::XTypeProvider and method XInterface::queryInt...
Definition: implbase1.hxx:66
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase1.hxx:152
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:48
virtual void release() SAL_OVERRIDE
decreasing m_refCount
Definition: implbase1.hxx:114
AggImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase1.hxx:252
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase1.hxx:217
ImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5, T6 const &arg6)
Definition: implbase1.hxx:200
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase1.hxx:172
virtual void acquire() SAL_OVERRIDE
increasing m_refCount
Definition: implbase1.hxx:112
AggImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase1.hxx:261
signed char sal_Int8
Definition: types.h:53
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: implbase1.hxx:142
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase1.hxx:289
~ImplHelper1()
Definition: implbase1.hxx:85
#define SAL_NO_VTABLE
Use this for pure virtual classes, e.g.
Definition: types.h:335
virtual void release() SAL_OVERRIDE
decreasing m_refCount
ImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3)
Definition: implbase1.hxx:184
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase1.hxx:219
virtual void release() SAL_OVERRIDE
Definition: implbase1.hxx:215
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase1.hxx:74
virtual void acquire() SAL_OVERRIDE
If a delegator is set, then the delegators gets acquired.
Definition: implbase1.hxx:146
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase1.hxx:116
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase1.hxx:287
ImplInheritanceHelper1(T1 const &arg1, T2 const &arg2, T3 const &arg3, T4 const &arg4, T5 const &arg5)
Definition: implbase1.hxx:193
virtual css::uno::Sequence< css::uno::Type > getTypes() SAL_OVERRIDE
Definition: implbase1.hxx:150
virtual void release() SAL_OVERRIDE
If a delegator is set, then the delegators gets released.
virtual void release() SAL_OVERRIDE
Definition: implbase1.hxx:285
virtual css::uno::Sequence< sal_Int8 > getImplementationId() SAL_OVERRIDE
Definition: implbase1.hxx:118
Implementation helper implementing interfaces css::lang::XTypeProvider and css::uno::XInterface inher...
Definition: implbase1.hxx:240