1
2// (C) Copyright Edward Diener 2011,2012,2019
3// Use, modification and distribution are subject to the Boost Software License,
4// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt).
6
7#if !defined(TEST_STRUCTS_HPP)
8#define TEST_STRUCTS_HPP
9
10#include <boost/config.hpp>
11
12struct AType
13 {
14
15 // Type
16
17 typedef int AnIntType;
18 struct AStructType
19 {
20 template <class> struct MStrMemberTemplate { };
21 template<class X,class Y,short AA> static int StatFuncTemplate(X *,Y) { int ret(AA); return ret; }
22 };
23 typedef int & AnIntTypeReference;
24 struct BType
25 {
26 typedef int AnIntegerType;
27 enum BTypeEnum
28 {
29 BTypeEnum1,
30 BTypeEnum2
31 };
32 struct CType
33 {
34 typedef int AnotherIntegerType;
35 template <class,class,int,short,class,template <class,int> class,class> struct CTManyParameters { };
36 template<class X,class Y,class Z,short AA> double SomeFuncTemplate(X,Y *,Z &) { double ret(AA); return ret; }
37 union CTypeUnion
38 {
39 long l;
40 bool b;
41 void CMemberFunction(int) { }
42 };
43 };
44 };
45
46 // Enum
47
48 enum AnEnumTtype
49 {
50 AnEnumTtype1,
51 AnEnumTtype2
52 };
53
54#if !defined(BOOST_NO_CXX11_SCOPED_ENUMS)
55
56 enum class AnEnumClassType
57 {
58 AnEnumClassType1,
59 AnEnumClassType2
60 };
61
62#endif
63
64 // Union
65
66 union AnUnion
67 {
68 int i;
69 double d;
70 struct UNStruct
71 {
72 short sh;
73 };
74 enum UEnumV
75 {
76 UEnumV1,
77 UEnumV2
78 };
79 template <int,class,long> struct NestedMemberTemplate { };
80
81#if !defined(BOOST_NO_CXX11_UNRESTRICTED_UNION)
82
83 static float USMember;
84
85#endif
86
87 };
88
89 // Template
90
91 template <class> struct ATPMemberTemplate { };
92 template <int> struct AMemberTemplate { };
93 template <int,int> struct AnotherMemberTemplate { };
94 template <class,class> struct CLMemberTemplate { };
95
96 // Data
97
98 int AnInt;
99 BType IntBT;
100 BType::CType NestedCT;
101
102 // Function
103
104 void VoidFunction() { }
105 int IntFunction() { return 0; }
106
107 // Const function
108
109 double AConstFunction(long, char) const { return 2.57; }
110 void WFunction(float, double = 4.3) const { }
111
112 // Volatile function
113
114 double AVolatileFunction(long, char = 'c') volatile { return 2.58; }
115 void VolFunction(float, double) volatile { }
116
117 // Const Volatile function
118
119 double ACVFunction(long, char) const volatile { return 2.59; }
120 void ConstVolFunction(float, double) const volatile { }
121
122 // Function Templates
123
124 template<class X,int Y> int AFuncTemplate(const X &) { return Y; }
125 template<class X,class Y,class Z> void AFuncTemplate(X *,Y,Z &) { }
126 template<class X> double FTHasDef(X, long, char = 'a') { return 3.58; }
127
128 // Const function template
129
130 template<class X,class Y> double AConstFunctionTemplate(X, Y y) const { return (static_cast<double>(y)); }
131 template<class X,class Y,class Z> void WFunctionTmp(X **, Y &, Z) const { }
132
133 // Volatile function template
134
135 template<class X> double AVolatileFT(X, long, char) volatile { return 2.58; }
136 template<class X,int Y> void VolFTem(X &) volatile { }
137
138 // Const Volatile function template
139
140 template<class X,class Y> double ACVFunTemplate(X, Y) const volatile { return 2.59; }
141 template<int Y> void ConstVolTTFun(float, double) const volatile { }
142
143 // Static Data
144
145 static short DSMember;
146
147 // Static Function
148
149 static int SIntFunction(long,double) { return 2; }
150
151 // Static Function Template
152
153 template<class X,class Y,class Z> static void AnotherFuncTemplate(X,Y &,const Z &) { }
154
155 };
156
157struct AnotherType
158 {
159
160 // Type
161
162 typedef AType::AnIntType someOtherType;
163
164 // Enum
165
166 enum AnotherEnumTtype
167 {
168 AnotherEnumType1,
169 AnotherEnumType2
170 };
171
172#if !defined(BOOST_NO_CXX11_SCOPED_ENUMS)
173
174 enum class AnotherEnumClassType
175 {
176 AnotherEnumClassType1,
177 AnotherEnumClassType2
178 };
179
180#endif
181
182 // Union
183
184 union AnotherUnion
185 {
186 short s;
187 char ch;
188 template <class,class> struct UnionMemberTemplate { };
189 static void UnionStaticMemberFunction() { }
190 union InnerUnion
191 {
192 int i;
193 char ch;
194 };
195
196#if !defined(BOOST_NO_CXX11_UNRESTRICTED_UNION)
197
198 static char ASCData;
199
200#endif
201
202 };
203
204 // Template
205
206 template <class,class,class,class,class,class> struct SomeMemberTemplate { };
207 template <class,class,int,class,template <class> class,class,long> struct ManyParameters { };
208 template <class,class,class,class> struct SimpleTMP { };
209
210 // Data
211
212 bool aMember;
213 bool cMem;
214 long AnInt;
215 AType OtherAT;
216 AType::AStructType ONestStr;
217
218 // Function
219
220 AType aFunction(int = 7) { return AType(); }
221 int anotherFunction(AType) { return 0; }
222 AType::AnIntType sFunction(int,long = 88,double = 1.0) { return 0; }
223 double IntFunction(int = 9922) { return 0; }
224
225 // Const function
226
227 int AnotherConstFunction(AType *, short) const { return 0; }
228 AType StillSame(int) const { return OtherAT; }
229
230 // Volatile function
231
232 int AnotherVolatileFunction(AType *, short) volatile { return 0; }
233 bool StillVolatile(int) volatile { return false; }
234
235 // Const Volatile function
236
237 int AnotherConstVolatileFunction(AType *, short) const volatile { return 0; }
238 short StillCV(int = 3) const volatile { return 32; }
239
240 // Function Templates
241
242 template<class X> long MyFuncTemplate(X &) { return 0; }
243 template<int Y> void VWithDefault(float, double d = 2.67) volatile { }
244
245 // Static Function
246
247 static AType TIntFunction(long,double = 3.0) { return AType(); }
248 static AType::AStructType TSFunction(AType::AnIntType,double) { return AType::AStructType(); }
249
250 // Static Data
251
252 static AType::AStructType AnStat;
253
254 // Static Function Template
255
256 template<class X,class Y> static void YetAnotherFuncTemplate(const X &,Y &) { }
257 template<class X,class Y,class Z> static void StaticFTWithDefault(const X &,Y &,Z*,long = 27) { }
258
259 static const int CIntValue = 10;
260
261 };
262
263struct MarkerType
264 {
265 };
266
267short AType::DSMember(5622);
268AType::AStructType AnotherType::AnStat;
269
270#if !defined(BOOST_NO_CXX11_UNRESTRICTED_UNION)
271
272float AType::AnUnion::USMember(893.53f);
273char AnotherType::AnotherUnion::ASCData('e');
274
275#endif
276
277#endif // TEST_STRUCTS_HPP
278

source code of boost/libs/tti/test/test_structs.hpp