Make a lot of one-liner functions inline
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2019-07-04 19:08:13 +02:00
parent bb0a6aba19
commit 32836c6c58
53 changed files with 428 additions and 424 deletions

View File

@@ -16,7 +16,7 @@ namespace Porygon::Evaluation {
public:
virtual const bool IsFloat() const = 0;
const TypeClass GetTypeClass() const final {
inline const TypeClass GetTypeClass() const final {
return TypeClass::Number;
}
@@ -52,23 +52,23 @@ namespace Porygon::Evaluation {
explicit IntegerEvalValue(long value) : _value(value) {
}
const bool IsFloat() const final {
inline const bool IsFloat() const final {
return false;
}
const long EvaluateInteger() const final {
inline const long EvaluateInteger() const final {
return _value;
}
const std::u16string EvaluateString() const final{
inline const std::u16string EvaluateString() const final{
return Utilities::StringUtils::IntToString(_value);
}
const shared_ptr<EvalValue> Clone() const final {
inline const shared_ptr<EvalValue> Clone() const final {
return make_shared<IntegerEvalValue>(_value);
}
const std::size_t GetHashCode() const final {
inline const std::size_t GetHashCode() const final {
return std::hash<long>{}(_value);
}
};
@@ -76,29 +76,31 @@ namespace Porygon::Evaluation {
class FloatEvalValue : public NumericEvalValue {
const double _value;
const long GetIntegerValue() const final {
inline const long GetIntegerValue() const final {
throw EvaluationException("Attempting to retrieve float from int eval value.");
}
const double GetFloatValue() const final { return _value; }
inline const double GetFloatValue() const final {
return _value;
}
public:
explicit FloatEvalValue(double value) : _value(value) {
}
const bool IsFloat() const final {
inline const bool IsFloat() const final {
return true;
}
const double EvaluateFloat() const final {
inline const double EvaluateFloat() const final {
return _value;
}
const shared_ptr<EvalValue> Clone() const final {
inline const shared_ptr<EvalValue> Clone() const final {
return make_shared<FloatEvalValue>(_value);
}
const std::size_t GetHashCode() const final {
inline const std::size_t GetHashCode() const final {
return std::hash<double>{}(_value);
}
};