My Project
UDK 3.2.7 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  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org. If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 #ifndef _CPPUHELPER_IMPLBASE1_HXX_
29 #define _CPPUHELPER_IMPLBASE1_HXX_
30 
32 #include <rtl/instance.hxx>
33 #include <com/sun/star/uno/XComponentContext.hpp>
34 
35 namespace cppu
36 {
38 
39  struct class_data1
40  {
41  sal_Int16 m_nTypes;
42  sal_Bool m_storedTypeRefs;
43  sal_Bool m_storedId;
44  sal_Int8 m_id[ 16 ];
45  type_entry m_typeEntries[ 1 + 1 ];
46  };
47 
48  template< typename Ifc1, typename Impl > struct ImplClassData1
49  {
50  class_data* operator ()()
51  {
52  static class_data1 s_cd =
53  {
54  1 +1, sal_False, sal_False,
55  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
56  {
57  { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 },
58  { { com::sun::star::lang::XTypeProvider::static_type }, ((sal_IntPtr)(com::sun::star::lang::XTypeProvider *) (Impl *) 16) - 16 }
59  }
60  };
61  return reinterpret_cast< class_data * >(&s_cd);
62  }
63  };
64 
66 
75  template< class Ifc1 >
76  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper1
77  : public com::sun::star::lang::XTypeProvider
78  , public Ifc1
79  {
80  struct cd : public rtl::StaticAggregate< class_data, ImplClassData1 < Ifc1, ImplHelper1<Ifc1> > > {};
81  public:
82  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
83  { return ImplHelper_query( rType, cd::get(), this ); }
84  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
85  { return ImplHelper_getTypes( cd::get() ); }
86  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
87  { return ImplHelper_getImplementationId( cd::get() ); }
88 
89 #if !defined _MSC_VER // public -> protected changes mangled names there
90  protected:
91 #endif
92  ~ImplHelper1() throw () {}
93  };
106  template< class Ifc1 >
107  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper1
108  : public OWeakObject
109  , public com::sun::star::lang::XTypeProvider
110  , public Ifc1
111  {
112  struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakImplHelper1< Ifc1 > > > {};
113  public:
114  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
115  { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
116  virtual void SAL_CALL acquire() throw ()
117  { OWeakObject::acquire(); }
118  virtual void SAL_CALL release() throw ()
119  { OWeakObject::release(); }
120  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
121  { return WeakImplHelper_getTypes( cd::get() ); }
122  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
123  { return ImplHelper_getImplementationId( cd::get() ); }
124  };
138  template< class Ifc1 >
139  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper1
140  : public OWeakAggObject
141  , public com::sun::star::lang::XTypeProvider
142  , public Ifc1
143  {
144  struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, WeakAggImplHelper1< Ifc1 > > > {};
145  public:
146  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
147  { return OWeakAggObject::queryInterface( rType ); }
148  virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
149  { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
150  virtual void SAL_CALL acquire() throw ()
152  virtual void SAL_CALL release() throw ()
154  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
155  { return WeakAggImplHelper_getTypes( cd::get() ); }
156  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
157  { return ImplHelper_getImplementationId( cd::get() ); }
158  };
175  template< class BaseClass, class Ifc1 >
176  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper1
177  : public BaseClass
178  , public Ifc1
179  {
180  struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, ImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
181  protected:
182 #if (defined __SUNPRO_CC && __SUNPRO_CC <= 0x550)
183  // Hack, to get comphelper::service_decl to work for non-trivial impl classes
185  com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const& xContext ) : BaseClass(args,xContext) {}
186 #endif
187  template< typename T1 >
188  explicit ImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
189  template< typename T1, typename T2 >
190  ImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
191  BaseClass(arg1, arg2) {}
192  template< typename T1, typename T2, typename T3 >
194  T1 const & arg1, T2 const & arg2, T3 const & arg3):
195  BaseClass(arg1, arg2, arg3) {}
196  template< typename T1, typename T2, typename T3, typename T4 >
198  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
199  BaseClass(arg1, arg2, arg3, arg4) {}
200  template<
201  typename T1, typename T2, typename T3, typename T4, typename T5 >
203  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
204  T5 const & arg5):
205  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
206  template<
207  typename T1, typename T2, typename T3, typename T4, typename T5,
208  typename T6 >
210  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
211  T5 const & arg5, T6 const & arg6):
212  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
213  public:
215  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
216  {
217  com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
218  if (aRet.hasValue())
219  return aRet;
220  return BaseClass::queryInterface( rType );
221  }
222  virtual void SAL_CALL acquire() throw ()
223  { BaseClass::acquire(); }
224  virtual void SAL_CALL release() throw ()
225  { BaseClass::release(); }
226  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
227  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
228  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
229  { return ImplHelper_getImplementationId( cd::get() ); }
230  };
248  template< class BaseClass, class Ifc1 >
249  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper1
250  : public BaseClass
251  , public Ifc1
252  {
253  struct cd : public rtl::StaticAggregate< class_data, ImplClassData1< Ifc1, AggImplInheritanceHelper1< BaseClass, Ifc1 > > > {};
254  protected:
255  template< typename T1 >
256  explicit AggImplInheritanceHelper1(T1 const & arg1): BaseClass(arg1) {}
257  template< typename T1, typename T2 >
258  AggImplInheritanceHelper1(T1 const & arg1, T2 const & arg2):
259  BaseClass(arg1, arg2) {}
260  template< typename T1, typename T2, typename T3 >
262  T1 const & arg1, T2 const & arg2, T3 const & arg3):
263  BaseClass(arg1, arg2, arg3) {}
264  template< typename T1, typename T2, typename T3, typename T4 >
266  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4):
267  BaseClass(arg1, arg2, arg3, arg4) {}
268  template<
269  typename T1, typename T2, typename T3, typename T4, typename T5 >
271  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
272  T5 const & arg5):
273  BaseClass(arg1, arg2, arg3, arg4, arg5) {}
274  template<
275  typename T1, typename T2, typename T3, typename T4, typename T5,
276  typename T6 >
278  T1 const & arg1, T2 const & arg2, T3 const & arg3, T4 const & arg4,
279  T5 const & arg5, T6 const & arg6):
280  BaseClass(arg1, arg2, arg3, arg4, arg5, arg6) {}
281  public:
283  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
284  { return BaseClass::queryInterface( rType ); }
285  virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
286  {
287  com::sun::star::uno::Any aRet( ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
288  if (aRet.hasValue())
289  return aRet;
290  return BaseClass::queryAggregation( rType );
291  }
292  virtual void SAL_CALL acquire() throw ()
293  { BaseClass::acquire(); }
294  virtual void SAL_CALL release() throw ()
295  { BaseClass::release(); }
296  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
297  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
298  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
299  { return ImplHelper_getImplementationId( cd::get() ); }
300  };
301 }
302 
303 #endif
304 
305 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */