1 #ifndef MSP_DATAFILE_TYPE_H_
2 #define MSP_DATAFILE_TYPE_H_
4 #include <msp/strings/lexicalcast.h>
14 Symbol(const T &n): name(lexical_cast(n)) { }
16 template<typename T> operator T() const { return lexical_cast<T>(name); }
21 static const char signature = 'i';
23 typedef __int64 Store;
25 typedef long long int Store;
32 static const char signature = 'f';
39 static const char signature = 'b';
46 static const char signature = 's';
47 typedef std::string Store;
53 // For backward compatibility
54 static const char signature = 'e';
61 struct Yes { char c[2]; };
62 struct No { char c; };
65 static Yes f(typename U::LoadType *);
69 enum { value = (sizeof(f<T>(0))==sizeof(Yes)) };
72 template<typename T, bool lt = HasLoadType<T>::value>
76 struct TypeInfo<short int, false>: IntType { };
79 struct TypeInfo<unsigned short int, false>: IntType { };
82 struct TypeInfo<int, false>: IntType { };
85 struct TypeInfo<unsigned int, false>: IntType { };
88 struct TypeInfo<long int, false>: IntType { };
91 struct TypeInfo<unsigned long int, false>: IntType { };
95 struct TypeInfo<__int64, false>: IntType { };
98 struct TypeInfo<unsigned __int64, false>: IntType { };
101 struct TypeInfo<long long int, false>: IntType { };
104 struct TypeInfo<unsigned long long int, false>: IntType { };
108 struct TypeInfo<float, false>: FloatType { };
111 struct TypeInfo<double, false>: FloatType { };
114 struct TypeInfo<bool, false>: BoolType { };
117 struct TypeInfo<std::string, false>: StringType { };
120 struct TypeInfo<const T, false>: TypeInfo<T> { };
123 struct TypeInfo<T &, false>: TypeInfo<T> { };
126 struct TypeInfo<T, true>: TypeInfo<typename T::LoadType>
127 { typedef typename T::LoadType Load; };
130 struct TypeInfo<T, false>: SymbolType
133 } // namespace DataFile