You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3coop/components/interpreter/types.hpp

45 lines
797 B
C++

#ifndef INTERPRETER_TYPES_H_INCLUDED
#define INTERPRETER_TYPES_H_INCLUDED
#include <stdexcept>
namespace Interpreter
{
typedef unsigned int Type_Code; // 32 bit
typedef unsigned int Type_Data; // 32 bit
typedef short Type_Short; // 16 bit
typedef int Type_Integer; // 32 bit
typedef float Type_Float; // 32 bit
union Data
{
Type_Integer mInteger;
Type_Float mFloat;
};
template<typename T>
T& getData (Data& data)
{
throw std::runtime_error ("unsupported data type");
}
template<>
inline Type_Integer& getData (Data& data)
{
return data.mInteger;
}
template<>
inline Type_Float& getData (Data& data)
{
return data.mFloat;
}
}
#endif