My Project
UDK 3.2.7 C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  *
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_IMPLBASE2_HXX_
29 #define _CPPUHELPER_IMPLBASE2_HXX_
30 
32 #include <rtl/instance.hxx>
33 
34 namespace cppu
35 {
37 
38  struct class_data2
39  {
40  sal_Int16 m_nTypes;
41  sal_Bool m_storedTypeRefs;
42  sal_Bool m_storedId;
43  sal_Int8 m_id[ 16 ];
44  type_entry m_typeEntries[ 2 + 1 ];
45  };
46 
47  template< typename Ifc1, typename Ifc2, typename Impl > struct ImplClassData2
48  {
49  class_data* operator ()()
50  {
51  static class_data2 s_cd =
52  {
53  2 +1, sal_False, sal_False,
54  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
55  {
56  { { Ifc1::static_type }, ((sal_IntPtr)(Ifc1 *) (Impl *) 16) - 16 },
57  { { Ifc2::static_type }, ((sal_IntPtr)(Ifc2 *) (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, class Ifc2 >
76  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper2
77  : public com::sun::star::lang::XTypeProvider
78  , public Ifc1, public Ifc2
79  {
80  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplHelper2<Ifc1, Ifc2> > > {};
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  ~ImplHelper2() throw () {}
93  };
102  template< class Ifc1, class Ifc2 >
103  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper2
104  : public OWeakObject
105  , public com::sun::star::lang::XTypeProvider
106  , public Ifc1, public Ifc2
107  {
108  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakImplHelper2<Ifc1, Ifc2> > > {};
109  public:
110  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
111  { return WeakImplHelper_query( rType, cd::get(), this, (OWeakObject *)this ); }
112  virtual void SAL_CALL acquire() throw ()
113  { OWeakObject::acquire(); }
114  virtual void SAL_CALL release() throw ()
115  { OWeakObject::release(); }
116  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
117  { return WeakImplHelper_getTypes( cd::get() ); }
118  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
119  { return ImplHelper_getImplementationId( cd::get() ); }
120  };
134  template< class Ifc1, class Ifc2 >
135  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper2
136  : public OWeakAggObject
137  , public com::sun::star::lang::XTypeProvider
138  , public Ifc1, public Ifc2
139  {
140  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, WeakAggImplHelper2<Ifc1, Ifc2> > > {};
141  public:
142  virtual com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
143  { return OWeakAggObject::queryInterface( rType ); }
144  virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
145  { return WeakAggImplHelper_queryAgg( rType, cd::get(), this, (OWeakAggObject *)this ); }
146  virtual void SAL_CALL acquire() throw ()
148  virtual void SAL_CALL release() throw ()
150  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
151  { return WeakAggImplHelper_getTypes( cd::get() ); }
152  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
153  { return ImplHelper_getImplementationId( cd::get() ); }
154  };
171  template< class BaseClass, class Ifc1, class Ifc2 >
172  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper2
173  : public BaseClass
174  , public Ifc1, public Ifc2
175  {
176  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, ImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
177  protected:
178  template< typename T1 >
179  explicit ImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
180  template< typename T1, typename T2 >
181  ImplInheritanceHelper2(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 com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
207  {
208  com::sun::star::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 ()
214  { BaseClass::acquire(); }
215  virtual void SAL_CALL release() throw ()
216  { BaseClass::release(); }
217  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
218  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
219  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
220  { return ImplHelper_getImplementationId( cd::get() ); }
221  };
239  template< class BaseClass, class Ifc1, class Ifc2 >
240  class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper2
241  : public BaseClass
242  , public Ifc1, public Ifc2
243  {
244  struct cd : public rtl::StaticAggregate< class_data, ImplClassData2 < Ifc1, Ifc2, AggImplInheritanceHelper2<BaseClass, Ifc1, Ifc2> > > {};
245  protected:
246  template< typename T1 >
247  explicit AggImplInheritanceHelper2(T1 const & arg1): BaseClass(arg1) {}
248  template< typename T1, typename T2 >
249  AggImplInheritanceHelper2(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 com::sun::star::uno::Any SAL_CALL queryInterface( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
275  { return BaseClass::queryInterface( rType ); }
276  virtual com::sun::star::uno::Any SAL_CALL queryAggregation( com::sun::star::uno::Type const & rType ) throw (com::sun::star::uno::RuntimeException)
277  {
278  com::sun::star::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 ()
284  { BaseClass::acquire(); }
285  virtual void SAL_CALL release() throw ()
286  { BaseClass::release(); }
287  virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes() throw (com::sun::star::uno::RuntimeException)
288  { return ImplInhHelper_getTypes( cd::get(), BaseClass::getTypes() ); }
289  virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (com::sun::star::uno::RuntimeException)
290  { return ImplHelper_getImplementationId( cd::get() ); }
291  };
292 }
293 
294 #endif
295 
296 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */