Large overhaul of pointers to shared_ptrs, implemented function evaluation

This commit is contained in:
2019-06-01 19:20:31 +02:00
parent 8b70eed516
commit 4408cf00cd
17 changed files with 261 additions and 129 deletions

View File

@@ -6,12 +6,13 @@
#include "../EvaluationException.hpp"
#include <string>
#include <sstream>
#include <memory>
class EvalValue{
public:
EvalValue() = default;
virtual ~EvalValue() = default;
virtual ScriptType* GetType() = 0;
virtual std::shared_ptr<ScriptType> GetType() = 0;
virtual bool operator ==(EvalValue* b) = 0;
@@ -37,22 +38,18 @@ public:
class BooleanEvalValue : public EvalValue{
bool _value;
ScriptType* _type;
std::shared_ptr<ScriptType> _type;
public:
explicit BooleanEvalValue(bool val){
_value = val;
_type = new ScriptType(TypeClass::Bool);
_type = std::make_shared<ScriptType>(TypeClass::Bool);
}
EvalValue* Clone() final{
return new BooleanEvalValue(_value);
}
~BooleanEvalValue() final{
delete _type;
}
ScriptType* GetType() final{
std::shared_ptr<ScriptType> GetType() final{
return _type;
};