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;
|
2019-06-01 17:20:31 +00:00
|
|
|
std::shared_ptr<ScriptType> _type;
|
2019-05-25 14:15:20 +00:00
|
|
|
public:
|
|
|
|
explicit StringEvalValue(string s){
|
|
|
|
_value = move(s);
|
2019-06-01 17:20:31 +00:00
|
|
|
_type = std::make_shared<ScriptType>(TypeClass::String);
|
2019-05-25 14:15:20 +00:00
|
|
|
}
|
|
|
|
|
2019-06-01 17:20:31 +00:00
|
|
|
std::shared_ptr<ScriptType> GetType() final{
|
2019-05-25 14:15:20 +00:00
|
|
|
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
|