3 This file is part of libmspdatafile
4 Copyright © 2010 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_DATAFILE_TYPE_H_
9 #define MSP_DATAFILE_TYPE_H_
11 #include <msp/strings/lexicalcast.h>
20 Symbol(const std::string &n): name(n) { }
22 template<typename T> operator T() const { return lexical_cast<T>(name); }
27 static const char signature = 'i';
28 typedef long long int Store;
33 static const char signature = 'f';
39 static const char signature = 'b';
45 static const char signature = 's';
46 typedef std::string Store;
51 // For backward compatibility
52 static const char signature = 'e';
57 struct TypeInfo: SymbolType { };
60 struct TypeInfo<short int>: IntType { };
63 struct TypeInfo<unsigned short int>: IntType { };
66 struct TypeInfo<int>: IntType { };
69 struct TypeInfo<unsigned int>: IntType { };
72 struct TypeInfo<long int>: IntType { };
75 struct TypeInfo<unsigned long int>: IntType { };
78 struct TypeInfo<long long int>: IntType { };
81 struct TypeInfo<unsigned long long int>: IntType { };
84 struct TypeInfo<float>: FloatType { };
87 struct TypeInfo<double>: FloatType { };
90 struct TypeInfo<bool>: BoolType { };
93 struct TypeInfo<std::string>: StringType { };
96 struct TypeInfo<const T>: TypeInfo<T> { };
99 struct TypeInfo<T &>: TypeInfo<T> { };
101 } // namespace DataFile