Reworked evaluation to use internal type instead of boost::any
This commit is contained in:
28
src/Evaluator/EvalValues/EvalValue.hpp
Normal file
28
src/Evaluator/EvalValues/EvalValue.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
#ifndef PORYGONLANG_EVALVALUE_HPP
|
||||
#define PORYGONLANG_EVALVALUE_HPP
|
||||
|
||||
#include "../../ScriptType.hpp"
|
||||
#include "../EvaluationException.hpp"
|
||||
#include <string>
|
||||
|
||||
class EvalValue{
|
||||
public:
|
||||
virtual ~EvalValue() = default;
|
||||
virtual ScriptType* GetType() = 0;
|
||||
|
||||
virtual long EvaluateInteger(){
|
||||
throw EvaluationException("Can't evaluate this EvalValue as integer.");
|
||||
}
|
||||
virtual double EvaluateFloat(){
|
||||
throw EvaluationException("Can't evaluate this EvalValue as float.");
|
||||
}
|
||||
virtual bool EvaluateBool(){
|
||||
throw EvaluationException("Can't evaluate this EvalValue as bool.");
|
||||
}
|
||||
virtual std::string EvaluateString(){
|
||||
throw EvaluationException("Can't evaluate this EvalValue as string.");
|
||||
}
|
||||
};
|
||||
|
||||
#endif //PORYGONLANG_EVALVALUE_HPP
|
||||
Reference in New Issue
Block a user