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