openmw/components/interpreter/types.hpp

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

43 lines
712 B
C++
Raw Normal View History

#ifndef INTERPRETER_TYPES_H_INCLUDED
#define INTERPRETER_TYPES_H_INCLUDED
2023-04-17 23:39:38 +03:00
#include <cstdint>
2023-04-18 20:23:03 +02:00
#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