LibreOffice Module cppuhelper (master)  1
implbase_ex_post.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 
20 /*
21  * This file is part of LibreOffice published API.
22  */
23 #ifndef INCLUDED_CPPUHELPER_IMPLBASE_EX_POST_HXX
24 #define INCLUDED_CPPUHELPER_IMPLBASE_EX_POST_HXX
25 
27 
28 #define __DEF_CLASS_DATA_INIT_EX( N, class_cast ) \
29 { \
30 N +1, sal_False, sal_False, \
31 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, \
32 { \
33 __IFC_EX_TYPE_INIT##N( class_cast ), \
34 __IFC_EX_TYPE_INIT_NAME( class_cast, css::lang::XTypeProvider ) \
35 } \
36 }
37 
38 #define __DEF_IMPLHELPER_EX( N ) \
39 namespace cppu \
40 { \
41 struct class_data##N \
42 { \
43  sal_Int16 m_nTypes; \
44  sal_Bool m_storedTypeRefs; \
45  sal_Bool m_storedId; \
46  sal_Int8 m_id[ 16 ]; \
47  type_entry m_typeEntries[ N + 1 ]; \
48 }; \
49 template< __CLASS_IFC##N > \
50 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelper##N \
51  : public css::lang::XTypeProvider \
52  , __PUBLIC_IFC##N \
53 { \
54  static class_data##N s_cd; \
55 public: \
56  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE \
57  { return ImplHelper_query( rType, (class_data *)&s_cd, this ); } \
58  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE \
59  { return ImplHelper_getTypes( (class_data *)&s_cd ); } \
60  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE \
61  { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
62 }; \
63 template< __CLASS_IFC##N > \
64 class_data##N ImplHelper##N< __IFC##N >::s_cd = \
65 __DEF_CLASS_DATA_INIT_EX( N, (ImplHelper##N< __IFC##N > *) ); \
66 template< __CLASS_IFC##N > \
67 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakImplHelper##N \
68  : public OWeakObject \
69  , public css::lang::XTypeProvider \
70  , __PUBLIC_IFC##N \
71 { \
72  static class_data##N s_cd; \
73 public: \
74  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE \
75  { return WeakImplHelper_query( rType, (class_data *)&s_cd, this, static_cast<OWeakObject *>(this) ); } \
76  virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE \
77  { OWeakObject::acquire(); } \
78  virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE \
79  { OWeakObject::release(); } \
80  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE \
81  { return WeakImplHelper_getTypes( (class_data *)&s_cd ); } \
82  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE \
83  { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
84 }; \
85 template< __CLASS_IFC##N > \
86 class_data##N WeakImplHelper##N< __IFC##N >::s_cd = \
87 __DEF_CLASS_DATA_INIT_EX( N, (WeakImplHelper##N< __IFC##N > *) ); \
88 template< __CLASS_IFC##N > \
89 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE WeakAggImplHelper##N \
90  : public OWeakAggObject \
91  , public css::lang::XTypeProvider \
92  , __PUBLIC_IFC##N \
93 { \
94  static class_data##N s_cd; \
95 public: \
96  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) SAL_OVERRIDE \
97  { return OWeakAggObject::queryInterface( rType ); } \
98  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) SAL_OVERRIDE \
99  { return WeakAggImplHelper_queryAgg( rType, (class_data *)&s_cd, this, static_cast<OWeakAggObject *>(this) ); } \
100  virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE \
101  { OWeakAggObject::acquire(); } \
102  virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE \
103  { OWeakAggObject::release(); } \
104  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE \
105  { return WeakAggImplHelper_getTypes( (class_data *)&s_cd ); } \
106  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE \
107  { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
108 }; \
109 template< __CLASS_IFC##N > \
110 class_data##N WeakAggImplHelper##N< __IFC##N >::s_cd = \
111 __DEF_CLASS_DATA_INIT_EX( N, (WeakAggImplHelper##N< __IFC##N > *) ); \
112 template< class BaseClass, __CLASS_IFC##N > \
113 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplInheritanceHelper##N \
114  : public BaseClass \
115  , __PUBLIC_IFC##N \
116 { \
117  static class_data##N s_cd; \
118 public: \
119  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) \
120  { \
121  css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, (class_data *)&s_cd, this ) ); \
122  if (aRet.hasValue()) \
123  return aRet; \
124  return BaseClass::queryInterface( rType ); \
125  } \
126  virtual void SAL_CALL acquire() SAL_NOEXCEPT \
127  { BaseClass::acquire(); } \
128  virtual void SAL_CALL release() SAL_NOEXCEPT \
129  { BaseClass::release(); } \
130  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() \
131  { return ImplInhHelper_getTypes( (class_data *)&s_cd, BaseClass::getTypes() ); } \
132  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() \
133  { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
134 }; \
135 template< class BaseClass, __CLASS_IFC##N > \
136 class_data##N ImplInheritanceHelper##N< BaseClass, __IFC##N >::s_cd = \
137 __DEF_CLASS_DATA_INIT_EX( N, (ImplInheritanceHelper##N< BaseClass, __IFC##N > *) ); \
138 template< class BaseClass, __CLASS_IFC##N > \
139 class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE AggImplInheritanceHelper##N \
140  : public BaseClass \
141  , __PUBLIC_IFC##N \
142 { \
143  static class_data##N s_cd; \
144 public: \
145  virtual css::uno::Any SAL_CALL queryInterface( css::uno::Type const & rType ) \
146  { return BaseClass::queryInterface( rType ); } \
147  virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) \
148  { \
149  css::uno::Any aRet( ImplHelper_queryNoXInterface( rType, (class_data *)&s_cd, this ) ); \
150  if (aRet.hasValue()) \
151  return aRet; \
152  return BaseClass::queryAggregation( rType ); \
153  } \
154  virtual void SAL_CALL acquire() SAL_NOEXCEPT \
155  { BaseClass::acquire(); } \
156  virtual void SAL_CALL release() SAL_NOEXCEPT \
157  { BaseClass::release(); } \
158  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() \
159  { return ImplInhHelper_getTypes( (class_data *)&s_cd, BaseClass::getTypes() ); } \
160  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() \
161  { return ImplHelper_getImplementationId( (class_data *)&s_cd ); } \
162 }; \
163 template< class BaseClass, __CLASS_IFC##N > \
164 class_data##N AggImplInheritanceHelper##N< BaseClass, __IFC##N >::s_cd = \
165 __DEF_CLASS_DATA_INIT_EX( N, (AggImplInheritanceHelper##N< BaseClass, __IFC##N > *) ); \
166 }
167 
169 
170 #endif
171 
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */