X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftype.h;h=f40657eb14a07003a295cb979ae4813523183d17;hb=b39ce68f12c30eedb272b65fe78baec5864d89ca;hp=72d148a0e16631b2440747fd2c20a1556597b728;hpb=818ead7b6ccef1e4d2435cc959bc07f910fcde46;p=libs%2Fdatafile.git diff --git a/source/type.h b/source/type.h index 72d148a..f40657e 100644 --- a/source/type.h +++ b/source/type.h @@ -1,6 +1,7 @@ #ifndef MSP_DATAFILE_TYPE_H_ #define MSP_DATAFILE_TYPE_H_ +#include #include namespace Msp { @@ -10,8 +11,10 @@ struct Symbol { std::string name; + Symbol() { } + template - Symbol(const T &n): name(lexical_cast(n)) { } + Symbol(const T &n): name(lexical_cast(n)) { } template operator T() const { return lexical_cast(name); } }; @@ -19,11 +22,7 @@ struct Symbol struct IntType { static const char signature = 'i'; -#ifdef MSVC - typedef __int64 Store; -#else - typedef long long int Store; -#endif + typedef Int64 Store; typedef Store Load; }; @@ -55,6 +54,16 @@ struct SymbolType typedef Symbol Store; }; +const char valid_signatures[] = +{ + IntType::signature, + FloatType::signature, + BoolType::signature, + StringType::signature, + SymbolType::signature, + 0 +}; + template struct HasLoadType { @@ -90,13 +99,13 @@ struct TypeInfo: IntType { }; template<> struct TypeInfo: IntType { }; -#ifdef MSVC +#if defined(_MSC_VER) template<> struct TypeInfo<__int64, false>: IntType { }; template<> struct TypeInfo: IntType { }; -#else +#elif defined(__GNUC__) template<> struct TypeInfo: IntType { }; @@ -116,6 +125,12 @@ struct TypeInfo: BoolType { }; template<> struct TypeInfo: StringType { }; +template<> +struct TypeInfo: StringType { }; + +template<> +struct TypeInfo: StringType { }; + template struct TypeInfo: TypeInfo { };