00001 #ifndef TYPEKIT_SIMPLE_SIMPLE_H 00002 #define TYPEKIT_SIMPLE_SIMPLE_H 00003 00004 #include <stdint.h> 00005 #include <vector> 00006 00007 namespace Test { 00008 enum BASIC_ENUM { 00009 VALUE_0, 00010 VALUE_1, 00011 VALUE_20 = 20, 00012 VALUE_100 = 100 00013 }; 00014 00015 struct BaseTypes { 00016 bool v0; 00017 char v1; 00018 unsigned char v2; 00019 short v3; 00020 unsigned short v4; 00021 int v5; 00022 unsigned int v6; 00023 00024 BASIC_ENUM e; 00025 char a[20]; 00026 00027 bool operator == (BaseTypes const& other) const 00028 { 00029 if (other.v0 != v0) return false; 00030 if (other.v1 != v1) return false; 00031 if (other.v2 != v2) return false; 00032 if (other.v3 != v3) return false; 00033 if (other.v4 != v4) return false; 00034 if (other.v5 != v5) return false; 00035 if (other.v6 != v6) return false; 00036 00037 if (other.e != e) return false; 00038 00039 for (int it = 0; it < 20; ++it) 00040 { 00041 if (other.a[it] != a[it]) 00042 return false; 00043 } 00044 return true; 00045 } 00046 }; 00047 00048 struct TestArrayOfDifferentSizes 00049 { 00050 int a[10]; 00051 int b[20]; 00052 }; 00053 00054 struct Test64BitHandling 00055 { 00056 BaseTypes base; 00057 long long ll; 00058 unsigned long long ull; 00059 00060 bool operator == (Test64BitHandling const& other) const 00061 { 00062 if (!(other.base == base)) return false; 00063 if (other.ll != ll) return false; 00064 if (other.ull != ull) return false; 00065 return true; 00066 } 00067 00068 }; 00069 00070 struct SimpleVector { 00071 uint32_t field; 00072 std::vector<uint8_t> data; 00073 bool operator == (SimpleVector const& other) const 00074 { return field == other.field && data == other.data; } 00075 bool operator != (SimpleVector const& other) const 00076 { return !(*this == other); } 00077 }; 00078 00079 struct ComplexVector 00080 { 00081 uint32_t field; 00082 std::vector<SimpleVector> data; 00083 bool operator == (ComplexVector const& other) const 00084 { 00085 return field == other.field && data == other.data; 00086 } 00087 }; 00088 00089 struct ComplexArray 00090 { 00091 uint32_t field; 00092 SimpleVector data[10]; 00093 bool operator == (ComplexArray const& other) const 00094 { 00095 if (field != other.field) return false; 00096 for (int i = 0; i < 10; ++i) 00097 if (!(data[i] == other.data[i])) return false; 00098 return true; 00099 } 00100 }; 00101 } 00102 00103 #endif