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 12 struct AType 13 { 14 15 // Type 16 17 typedef int AnIntType; 18 struct AStructType 19 { 20 template <class> struct MStrMemberTemplate { }; StatFuncTemplateAType::AStructType21 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 { }; SomeFuncTemplateAType::BType::CType36 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; CMemberFunction(int)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 VoidFunctionAType104 void VoidFunction() { } IntFunctionAType105 int IntFunction() { return 0; } 106 107 // Const function 108 AConstFunctionAType109 double AConstFunction(long, char) const { return 2.57; } WFunctionAType110 void WFunction(float, double = 4.3) const { } 111 112 // Volatile function 113 AVolatileFunctionAType114 double AVolatileFunction(long, char = 'c') volatile { return 2.58; } VolFunctionAType115 void VolFunction(float, double) volatile { } 116 117 // Const Volatile function 118 ACVFunctionAType119 double ACVFunction(long, char) const volatile { return 2.59; } ConstVolFunctionAType120 void ConstVolFunction(float, double) const volatile { } 121 122 // Function Templates 123 AFuncTemplateAType124 template<class X,int Y> int AFuncTemplate(const X &) { return Y; } AFuncTemplateAType125 template<class X,class Y,class Z> void AFuncTemplate(X *,Y,Z &) { } FTHasDefAType126 template<class X> double FTHasDef(X, long, char = 'a') { return 3.58; } 127 128 // Const function template 129 AConstFunctionTemplateAType130 template<class X,class Y> double AConstFunctionTemplate(X, Y y) const { return (static_cast<double>(y)); } WFunctionTmpAType131 template<class X,class Y,class Z> void WFunctionTmp(X **, Y &, Z) const { } 132 133 // Volatile function template 134 AVolatileFTAType135 template<class X> double AVolatileFT(X, long, char) volatile { return 2.58; } VolFTemAType136 template<class X,int Y> void VolFTem(X &) volatile { } 137 138 // Const Volatile function template 139 ACVFunTemplateAType140 template<class X,class Y> double ACVFunTemplate(X, Y) const volatile { return 2.59; } ConstVolTTFunAType141 template<int Y> void ConstVolTTFun(float, double) const volatile { } 142 143 // Static Data 144 145 static short DSMember; 146 147 // Static Function 148 SIntFunctionAType149 static int SIntFunction(long,double) { return 2; } 150 151 // Static Function Template 152 AnotherFuncTemplateAType153 template<class X,class Y,class Z> static void AnotherFuncTemplate(X,Y &,const Z &) { } 154 155 }; 156 157 struct 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 { }; UnionStaticMemberFunction()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 aFunctionAnotherType220 AType aFunction(int = 7) { return AType(); } anotherFunctionAnotherType221 int anotherFunction(AType) { return 0; } sFunctionAnotherType222 AType::AnIntType sFunction(int,long = 88,double = 1.0) { return 0; } IntFunctionAnotherType223 double IntFunction(int = 9922) { return 0; } 224 225 // Const function 226 AnotherConstFunctionAnotherType227 int AnotherConstFunction(AType *, short) const { return 0; } StillSameAnotherType228 AType StillSame(int) const { return OtherAT; } 229 230 // Volatile function 231 AnotherVolatileFunctionAnotherType232 int AnotherVolatileFunction(AType *, short) volatile { return 0; } StillVolatileAnotherType233 bool StillVolatile(int) volatile { return false; } 234 235 // Const Volatile function 236 AnotherConstVolatileFunctionAnotherType237 int AnotherConstVolatileFunction(AType *, short) const volatile { return 0; } StillCVAnotherType238 short StillCV(int = 3) const volatile { return 32; } 239 240 // Function Templates 241 MyFuncTemplateAnotherType242 template<class X> long MyFuncTemplate(X &) { return 0; } VWithDefaultAnotherType243 template<int Y> void VWithDefault(float, double d = 2.67) volatile { } 244 245 // Static Function 246 TIntFunctionAnotherType247 static AType TIntFunction(long,double = 3.0) { return AType(); } TSFunctionAnotherType248 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 YetAnotherFuncTemplateAnotherType256 template<class X,class Y> static void YetAnotherFuncTemplate(const X &,Y &) { } StaticFTWithDefaultAnotherType257 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 263 struct MarkerType 264 { 265 }; 266 267 short AType::DSMember(5622); 268 AType::AStructType AnotherType::AnStat; 269 270 #if !defined(BOOST_NO_CXX11_UNRESTRICTED_UNION) 271 272 float AType::AnUnion::USMember(893.53); 273 char AnotherType::AnotherUnion::ASCData('e'); 274 275 #endif 276 277 #endif // TEST_STRUCTS_HPP 278