1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com> |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the test suite of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | #ifndef TESTS_AUTO_CORELIB_TOOLS_MOC_CXX11_EXPLICIT_OVERRIDE_CONTROL_H |
29 | #define TESTS_AUTO_CORELIB_TOOLS_MOC_CXX11_EXPLICIT_OVERRIDE_CONTROL_H |
30 | |
31 | #include <QtCore/QObject> |
32 | |
33 | #ifndef Q_MOC_RUN // hide from moc |
34 | # define override |
35 | # define final |
36 | # define sealed |
37 | #endif |
38 | |
39 | class ExplicitOverrideControlBase : public QObject |
40 | { |
41 | Q_OBJECT |
42 | public: |
43 | explicit ExplicitOverrideControlBase(QObject *parent = 0) |
44 | : QObject(parent) {} |
45 | |
46 | private Q_SLOTS: |
47 | virtual void pureSlot0() = 0; |
48 | virtual void pureSlot1() = 0; |
49 | virtual void pureSlot2() const = 0; |
50 | virtual void pureSlot3() const = 0; |
51 | #if 0 // moc doesn't support volatile slots |
52 | virtual void pureSlot4() volatile = 0; |
53 | virtual void pureSlot5() volatile = 0; |
54 | virtual void pureSlot6() const volatile = 0; |
55 | virtual void pureSlot7() volatile const = 0; |
56 | virtual void pureSlot8() const volatile = 0; |
57 | virtual void pureSlot9() volatile const = 0; |
58 | #endif |
59 | }; |
60 | |
61 | class ExplicitOverrideControlFinalQt : public ExplicitOverrideControlBase |
62 | { |
63 | Q_OBJECT |
64 | public: |
65 | explicit ExplicitOverrideControlFinalQt(QObject *parent = 0) |
66 | : ExplicitOverrideControlBase(parent) {} |
67 | |
68 | private Q_SLOTS: |
69 | void pureSlot0() Q_DECL_FINAL {} |
70 | void pureSlot1() Q_DECL_FINAL {} |
71 | void pureSlot2() const Q_DECL_FINAL {} |
72 | void pureSlot3() Q_DECL_FINAL const {} |
73 | #if 0 // moc doesn't support volatile slots |
74 | void pureSlot4() volatile Q_DECL_FINAL {} |
75 | void pureSlot5() Q_DECL_FINAL volatile {} |
76 | void pureSlot6() const volatile Q_DECL_FINAL {} |
77 | void pureSlot7() volatile Q_DECL_FINAL const {} |
78 | void pureSlot8() const Q_DECL_FINAL volatile {} |
79 | void pureSlot9() Q_DECL_FINAL volatile const {} |
80 | #endif |
81 | }; |
82 | |
83 | class ExplicitOverrideControlFinalCxx11 : public ExplicitOverrideControlBase |
84 | { |
85 | Q_OBJECT |
86 | public: |
87 | explicit ExplicitOverrideControlFinalCxx11(QObject *parent = 0) |
88 | : ExplicitOverrideControlBase(parent) {} |
89 | |
90 | private Q_SLOTS: |
91 | void pureSlot0() final {} |
92 | void pureSlot1() final {} |
93 | void pureSlot2() const final {} |
94 | void pureSlot3() final const {} |
95 | #if 0 // moc doesn't support volatile slots |
96 | void pureSlot4() volatile final {} |
97 | void pureSlot5() final volatile {} |
98 | void pureSlot6() const volatile final {} |
99 | void pureSlot7() volatile final const {} |
100 | void pureSlot8() const final volatile {} |
101 | void pureSlot9() final volatile const {} |
102 | #endif |
103 | }; |
104 | |
105 | class ExplicitOverrideControlSealed : public ExplicitOverrideControlBase |
106 | { |
107 | Q_OBJECT |
108 | public: |
109 | explicit ExplicitOverrideControlSealed(QObject *parent = 0) |
110 | : ExplicitOverrideControlBase(parent) {} |
111 | |
112 | private Q_SLOTS: |
113 | void pureSlot0() sealed {} |
114 | void pureSlot1() sealed {} |
115 | void pureSlot2() const sealed {} |
116 | void pureSlot3() sealed const {} |
117 | #if 0 // moc doesn't support volatile slots |
118 | void pureSlot4() volatile sealed {} |
119 | void pureSlot5() sealed volatile {} |
120 | void pureSlot6() const volatile sealed {} |
121 | void pureSlot7() volatile sealed const {} |
122 | void pureSlot8() const sealed volatile {} |
123 | void pureSlot9() sealed volatile const {} |
124 | #endif |
125 | }; |
126 | |
127 | class ExplicitOverrideControlOverrideQt : public ExplicitOverrideControlBase |
128 | { |
129 | Q_OBJECT |
130 | public: |
131 | explicit ExplicitOverrideControlOverrideQt(QObject *parent = 0) |
132 | : ExplicitOverrideControlBase(parent) {} |
133 | |
134 | private Q_SLOTS: |
135 | void pureSlot0() override {} |
136 | void pureSlot1() override {} |
137 | void pureSlot2() const override {} |
138 | void pureSlot3() override const {} |
139 | #if 0 // moc doesn't support volatile slots |
140 | void pureSlot4() volatile override {} |
141 | void pureSlot5() override volatile {} |
142 | void pureSlot6() const volatile override {} |
143 | void pureSlot7() volatile override const {} |
144 | void pureSlot8() const override volatile {} |
145 | void pureSlot9() override volatile const {} |
146 | #endif |
147 | }; |
148 | |
149 | class ExplicitOverrideControlOverrideCxx11 : public ExplicitOverrideControlBase |
150 | { |
151 | Q_OBJECT |
152 | public: |
153 | explicit ExplicitOverrideControlOverrideCxx11(QObject *parent = 0) |
154 | : ExplicitOverrideControlBase(parent) {} |
155 | |
156 | private Q_SLOTS: |
157 | void pureSlot0() override {} |
158 | void pureSlot1() override {} |
159 | void pureSlot2() const override {} |
160 | void pureSlot3() override const {} |
161 | #if 0 // moc doesn't support volatile slots |
162 | void pureSlot4() volatile override {} |
163 | void pureSlot5() override volatile {} |
164 | void pureSlot6() const volatile override {} |
165 | void pureSlot7() volatile override const {} |
166 | void pureSlot8() const override volatile {} |
167 | void pureSlot9() override volatile const {} |
168 | #endif |
169 | }; |
170 | |
171 | class ExplicitOverrideControlFinalQtOverrideQt : public ExplicitOverrideControlBase |
172 | { |
173 | Q_OBJECT |
174 | public: |
175 | explicit ExplicitOverrideControlFinalQtOverrideQt(QObject *parent = 0) |
176 | : ExplicitOverrideControlBase(parent) {} |
177 | |
178 | private Q_SLOTS: |
179 | void pureSlot0() Q_DECL_FINAL override {} |
180 | void pureSlot1() override Q_DECL_FINAL {} |
181 | void pureSlot2() override const Q_DECL_FINAL {} |
182 | void pureSlot3() Q_DECL_FINAL const override {} |
183 | #if 0 // moc doesn't support volatile slots |
184 | void pureSlot4() volatile Q_DECL_FINAL override {} |
185 | void pureSlot5() override Q_DECL_FINAL volatile {} |
186 | void pureSlot6() override const volatile Q_DECL_FINAL {} |
187 | void pureSlot7() volatile override Q_DECL_FINAL const {} |
188 | void pureSlot8() const Q_DECL_FINAL override volatile {} |
189 | void pureSlot9() Q_DECL_FINAL volatile const override {} |
190 | #endif |
191 | }; |
192 | |
193 | class ExplicitOverrideControlFinalCxx11OverrideCxx11 : public ExplicitOverrideControlBase |
194 | { |
195 | Q_OBJECT |
196 | public: |
197 | explicit ExplicitOverrideControlFinalCxx11OverrideCxx11(QObject *parent = 0) |
198 | : ExplicitOverrideControlBase(parent) {} |
199 | |
200 | private Q_SLOTS: |
201 | void pureSlot0() final override {} |
202 | void pureSlot1() override final {} |
203 | void pureSlot2() override const final {} |
204 | void pureSlot3() final const override {} |
205 | #if 0 // moc doesn't support volatile slots |
206 | void pureSlot4() volatile final override {} |
207 | void pureSlot5() override final volatile {} |
208 | void pureSlot6() const volatile final override {} |
209 | void pureSlot7() volatile final override const {} |
210 | void pureSlot8() const override final volatile {} |
211 | void pureSlot9() override final volatile const {} |
212 | #endif |
213 | }; |
214 | |
215 | class ExplicitOverrideControlSealedOverride : public ExplicitOverrideControlBase |
216 | { |
217 | Q_OBJECT |
218 | public: |
219 | explicit ExplicitOverrideControlSealedOverride(QObject *parent = 0) |
220 | : ExplicitOverrideControlBase(parent) {} |
221 | |
222 | private Q_SLOTS: |
223 | void pureSlot0() sealed override {} |
224 | void pureSlot1() override sealed {} |
225 | void pureSlot2() override const sealed {} |
226 | void pureSlot3() sealed const override {} |
227 | #if 0 // moc doesn't support volatile slots |
228 | void pureSlot4() volatile sealed override {} |
229 | void pureSlot5() sealed override volatile {} |
230 | void pureSlot6() const override volatile sealed {} |
231 | void pureSlot7() volatile sealed override const {} |
232 | void pureSlot8() const sealed volatile override {} |
233 | void pureSlot9() override sealed volatile const {} |
234 | #endif |
235 | }; |
236 | |
237 | #ifndef Q_MOC_RUN |
238 | # undef final |
239 | # undef sealed |
240 | # undef override |
241 | #endif |
242 | |
243 | #endif // TESTS_AUTO_CORELIB_TOOLS_MOC_CXX11_EXPLICIT_OVERRIDE_CONTROL_H |
244 | |