2019-05-25 14:15:20 +00:00
|
|
|
|
|
|
|
#ifndef PORYGONLANG_STRINGEVALVALUE_HPP
|
|
|
|
#define PORYGONLANG_STRINGEVALVALUE_HPP
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "EvalValue.hpp"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class StringEvalValue : public EvalValue{
|
|
|
|
string _value;
|
|
|
|
ScriptType* _type;
|
|
|
|
public:
|
|
|
|
explicit StringEvalValue(string s){
|
|
|
|
_value = move(s);
|
|
|
|
_type = new ScriptType(TypeClass::String);
|
|
|
|
}
|
|
|
|
~StringEvalValue() final{
|
|
|
|
delete _type;
|
|
|
|
}
|
|
|
|
|
|
|
|
ScriptType* GetType() final{
|
|
|
|
return _type;
|
|
|
|
};
|
|
|
|
bool operator ==(EvalValue* b) final{
|
|
|
|
if (b->GetType()->GetClass() != TypeClass::String)
|
|
|
|
return false;
|
|
|
|
return this->_value == b->EvaluateString();
|
|
|
|
};
|
|
|
|
|
|
|
|
string EvaluateString() final{
|
|
|
|
return _value;
|
|
|
|
}
|
|
|
|
|
2019-05-30 13:23:48 +00:00
|
|
|
EvalValue* Clone() final{
|
|
|
|
return new StringEvalValue(_value);
|
|
|
|
}
|
2019-05-25 14:15:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //PORYGONLANG_STRINGEVALVALUE_HPP
|