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>
21 Symbol(const T &n): name(lexical_cast(n)) { }
23 template<typename T> operator T() const { return lexical_cast<T>(name); }
28 static const char signature = 'i';
29 typedef long long int Store;
34 static const char signature = 'f';
40 static const char signature = 'b';
46 static const char signature = 's';
47 typedef std::string Store;
52 // For backward compatibility
53 static const char signature = 'e';
58 struct TypeInfo: SymbolType { };
61 struct TypeInfo<short int>: IntType { };
64 struct TypeInfo<unsigned short int>: IntType { };
67 struct TypeInfo<int>: IntType { };
70 struct TypeInfo<unsigned int>: IntType { };
73 struct TypeInfo<long int>: IntType { };
76 struct TypeInfo<unsigned long int>: IntType { };
79 struct TypeInfo<long long int>: IntType { };
82 struct TypeInfo<unsigned long long int>: IntType { };
85 struct TypeInfo<float>: FloatType { };
88 struct TypeInfo<double>: FloatType { };
91 struct TypeInfo<bool>: BoolType { };
94 struct TypeInfo<std::string>: StringType { };
97 struct TypeInfo<const T>: TypeInfo<T> { };
100 struct TypeInfo<T &>: TypeInfo<T> { };
102 } // namespace DataFile