CreatureLib/CInterface/Library/EffectParameter.cpp

20 lines
1.2 KiB
C++
Raw Permalink Normal View History

2020-05-02 19:46:16 +00:00
#include "../../src/Library/EffectParameter.hpp"
#include "../Core.hpp"
2020-05-02 19:46:16 +00:00
using namespace CreatureLib::Library;
2022-04-02 10:33:26 +00:00
export_func EffectParameter* CreatureLib_EffectParameter_FromBool(bool b) { return new EffectParameter(b); }
export_func EffectParameter* CreatureLib_EffectParameter_FromInt(i64 i) { return new EffectParameter(i); }
export_func EffectParameter* CreatureLib_EffectParameter_FromFloat(float f) { return new EffectParameter(f); }
export_func EffectParameter* CreatureLib_EffectParameter_FromString(const char* c) {
2020-06-26 15:08:23 +00:00
return new EffectParameter(ArbUt::StringView(c));
2020-05-02 19:46:16 +00:00
}
2022-04-02 10:33:26 +00:00
export_func void CreatureLib_EffectParameter_Destruct(const EffectParameter* p) { delete p; }
export_func EffectParameterType CreatureLib_EffectParameter_GetType(const EffectParameter* p) { return p->GetType(); }
export_func u8 CreatureLib_EffectParameter_AsBool(const EffectParameter* p, bool& out) { Try(out = p->AsBool();) }
export_func u8 CreatureLib_EffectParameter_AsInt(const EffectParameter* p, i64& out) { Try(out = p->AsInt();) }
export_func u8 CreatureLib_EffectParameter_AsFloat(const EffectParameter* p, float& out) { Try(out = p->AsFloat();) }
export_func u8 CreatureLib_EffectParameter_AsString(const EffectParameter* p, const char*& out) {
2020-05-02 19:46:16 +00:00
Try(out = p->AsString().c_str();)
}