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