Mark evalValues as const
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -12,40 +12,40 @@ class EvalValue{
|
||||
public:
|
||||
EvalValue() = default;
|
||||
virtual ~EvalValue() = default;
|
||||
virtual const TypeClass GetTypeClass() = 0;
|
||||
virtual const TypeClass GetTypeClass() const = 0;
|
||||
|
||||
virtual bool operator ==(EvalValue* b) = 0;
|
||||
virtual const bool operator ==(EvalValue* b) const = 0;
|
||||
|
||||
virtual bool operator !=(EvalValue*b){
|
||||
virtual const bool operator !=(EvalValue*b) const{
|
||||
return ! (this->operator==(b));
|
||||
}
|
||||
|
||||
virtual shared_ptr<EvalValue> Clone() = 0;
|
||||
virtual const shared_ptr<EvalValue> Clone() const = 0;
|
||||
|
||||
virtual long EvaluateInteger() const{
|
||||
virtual const long EvaluateInteger() const{
|
||||
throw EvaluationException("Can't evaluate this EvalValue as integer.");
|
||||
}
|
||||
virtual double EvaluateFloat() const{
|
||||
virtual const double EvaluateFloat() const{
|
||||
throw EvaluationException("Can't evaluate this EvalValue as float.");
|
||||
}
|
||||
virtual bool EvaluateBool() const{
|
||||
virtual const bool EvaluateBool() const{
|
||||
throw EvaluationException("Can't evaluate this EvalValue as bool.");
|
||||
}
|
||||
virtual const std::u16string* EvaluateString() const {
|
||||
throw EvaluationException("Can't evaluate this EvalValue as string.");
|
||||
}
|
||||
|
||||
virtual std::size_t GetHashCode() = 0;
|
||||
virtual const std::size_t GetHashCode() const = 0;
|
||||
|
||||
virtual shared_ptr<EvalValue> IndexValue(EvalValue* val){
|
||||
virtual const shared_ptr<EvalValue> IndexValue(EvalValue* val) const{
|
||||
throw EvaluationException("Can't index this EvalValue");
|
||||
}
|
||||
|
||||
virtual shared_ptr<EvalValue> IndexValue(uint32_t hash){
|
||||
virtual const shared_ptr<EvalValue> IndexValue(uint32_t hash) const{
|
||||
throw EvaluationException("Can't index this EvalValue");
|
||||
}
|
||||
|
||||
virtual void SetIndexValue(EvalValue *key, shared_ptr<EvalValue> value){
|
||||
virtual void SetIndexValue(EvalValue *key, const shared_ptr<EvalValue>& value) const{
|
||||
throw EvaluationException("Can't index this EvalValue");
|
||||
}
|
||||
};
|
||||
@@ -58,25 +58,25 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
shared_ptr<EvalValue> Clone() final{
|
||||
const shared_ptr<EvalValue> Clone() const final{
|
||||
return make_shared<BooleanEvalValue>(_value);
|
||||
}
|
||||
|
||||
const TypeClass GetTypeClass() final{
|
||||
const TypeClass GetTypeClass() const final{
|
||||
return TypeClass ::Bool;
|
||||
}
|
||||
|
||||
bool EvaluateBool() const final{
|
||||
const bool EvaluateBool() const final{
|
||||
return _value;
|
||||
}
|
||||
|
||||
bool operator ==(EvalValue* b) final{
|
||||
const bool operator ==(EvalValue* b) const final{
|
||||
if (b->GetTypeClass() != TypeClass::Bool)
|
||||
return false;
|
||||
return this->EvaluateBool() == b->EvaluateBool();
|
||||
};
|
||||
|
||||
std::size_t GetHashCode() final{
|
||||
const std::size_t GetHashCode() const final{
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user