Mark evalValues as const
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-17 17:43:54 +02:00
parent d91caa7f32
commit 21d3329c55
14 changed files with 204 additions and 215 deletions

View File

@@ -17,11 +17,11 @@ public:
_hash = HashedString::ConstHash (_value.c_str());
}
const TypeClass GetTypeClass() final{
const TypeClass GetTypeClass() const final{
return TypeClass ::String;
}
bool operator ==(EvalValue* b) final{
const bool operator ==(EvalValue* b) const final{
if (b->GetTypeClass() != TypeClass::String)
return false;
return this->_hash == b->GetHashCode();
@@ -31,17 +31,17 @@ public:
return &_value;
}
shared_ptr<EvalValue> Clone() final{
const shared_ptr<EvalValue> Clone() const final{
return make_shared<StringEvalValue>(_value);
}
shared_ptr<EvalValue> IndexValue(EvalValue* val) final{
const shared_ptr<EvalValue> IndexValue(EvalValue* val) const final{
// Porygon is 1-indexed, so we convert to that.
auto l = val->EvaluateInteger() - 1;
return make_shared<StringEvalValue>(u16string(1, _value[l]));
}
std::size_t GetHashCode() final{
const std::size_t GetHashCode() const final{
return _hash;
}
};