openmw/components/interpreter/types.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
693 B
C++
Raw Normal View History

#ifndef INTERPRETER_TYPES_H_INCLUDED
#define INTERPRETER_TYPES_H_INCLUDED
#include <stdexcept>
namespace Interpreter
{
typedef std::uint32_t Type_Code;
typedef std::int16_t Type_Short;
2022-09-22 21:26:05 +03:00
typedef std::int32_t Type_Integer;
2022-09-22 21:26:05 +03:00
typedef float Type_Float;
2022-09-22 21:26:05 +03:00
union Data
{
Type_Integer mInteger;
Type_Float mFloat;
};
2022-09-22 21:26:05 +03:00
template <typename T>
T& getData(Data& data)
{
throw std::runtime_error("unsupported data type");
}
2022-09-22 21:26:05 +03:00
template <>
inline Type_Integer& getData(Data& data)
{
return data.mInteger;
}
2022-09-22 21:26:05 +03:00
template <>
inline Type_Float& getData(Data& data)
{
return data.mFloat;
}
}
#endif