metaforce/Runtime/GuiSys/CGuiFuncParm.hpp

45 lines
856 B
C++
Raw Normal View History

2016-03-11 05:32:18 +00:00
#ifndef __URDE_CGUIFUNCPARM_HPP__
#define __URDE_CGUIFUNCPARM_HPP__
#include "RetroTypes.hpp"
namespace urde
{
class CGuiFuncParm
{
2016-03-14 23:32:44 +00:00
friend class CGuiMessage;
2016-03-11 05:32:18 +00:00
public:
enum class Type
{
Null = -1,
Int = 0,
Float = 1,
IntrusivePointer = 2
};
private:
Type x0_type = Type::Null;
union
{
2016-03-15 04:55:57 +00:00
intptr_t x4_int;
2016-03-11 05:32:18 +00:00
float x4_float;
void* x4_ptr = nullptr;
};
public:
CGuiFuncParm() = default;
2016-03-15 04:55:57 +00:00
CGuiFuncParm(intptr_t arg) : x0_type(Type::Int), x4_int(arg) {}
2016-03-11 05:32:18 +00:00
CGuiFuncParm(float arg) : x0_type(Type::Float), x4_float(arg) {}
CGuiFuncParm(void* arg) : x0_type(Type::IntrusivePointer), x4_ptr(arg) {}
~CGuiFuncParm()
{
if (x0_type == Type::IntrusivePointer)
delete static_cast<u8*>(x4_ptr);
}
};
}
#endif // __URDE_CGUIFUNCPARM_HPP__