Implements EffectParameter C Interface
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-05-02 21:46:16 +02:00
parent 40e80d8100
commit 293386ac0d
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#include "../../src/Library/EffectParameter.hpp"
#include "../Core.hpp"
using namespace CreatureLib::Library;
export EffectParameter* CreatureLib_EffectParameter_FromBool(bool b) { return new EffectParameter(b); }
export EffectParameter* CreatureLib_EffectParameter_FromInt(int64_t i) { return new EffectParameter(i); }
export EffectParameter* CreatureLib_EffectParameter_FromFloat(float f) { return new EffectParameter(f); }
export EffectParameter* CreatureLib_EffectParameter_FromString(const char* c) {
return new EffectParameter(Arbutils::CaseInsensitiveConstString(c));
}
export void CreatureLib_EffectParameter_Destruct(const EffectParameter* p) { delete p; }
export EffectParameterType CreatureLib_EffectParameter_GetType(const EffectParameter* p) { return p->GetType(); }
export uint8_t CreatureLib_EffectParameter_AsBool(const EffectParameter* p, bool& out) { Try(out = p->AsBool();) }
export uint8_t CreatureLib_EffectParameter_AsInt(const EffectParameter* p, int64_t& out) { Try(out = p->AsInt();) }
export uint8_t CreatureLib_EffectParameter_AsFloat(const EffectParameter* p, float& out) { Try(out = p->AsFloat();) }
export uint8_t CreatureLib_EffectParameter_AsString(const EffectParameter* p, const char*& out) {
Try(out = p->AsString().c_str();)
}