summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/expr.cc3
-rw-r--r--src/value.cc15
-rw-r--r--src/value.h15
3 files changed, 3 insertions, 30 deletions
diff --git a/src/expr.cc b/src/expr.cc
index 2e069f0..8500d13 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -105,8 +105,7 @@ Value Expression::evaluate(const Context *context) const
if (this->type == ">")
return this->children[0]->evaluate(context) > this->children[1]->evaluate(context);
if (this->type == "?:") {
- Value v = this->children[0]->evaluate(context);
- return this->children[v.toBool() ? 1 : 2]->evaluate(context);
+ return this->children[this->children[0]->evaluate(context) ? 1 : 2]->evaluate(context);
}
if (this->type == "[]") {
return this->children[0]->evaluate(context)[this->children[1]->evaluate(context)];
diff --git a/src/value.cc b/src/value.cc
index ebb825d..8fbde44 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -297,11 +297,6 @@ Value &Value::operator=(const Value &v)
return *this;
}
-Value Value::operator!() const
-{
- return Value(!this->toBool());
-}
-
class equals_visitor : public boost::static_visitor<bool>
{
public:
@@ -324,16 +319,6 @@ bool Value::operator!=(const Value &v) const
return !(*this == v);
}
-bool Value::operator&&(const Value &v) const
-{
- return this->toBool() && v.toBool();
-}
-
-bool Value::operator||(const Value &v) const
-{
- return this->toBool() || v.toBool();
-}
-
class less_visitor : public boost::static_visitor<bool>
{
public:
diff --git a/src/value.h b/src/value.h
index 0445ff4..24e1b45 100644
--- a/src/value.h
+++ b/src/value.h
@@ -80,12 +80,11 @@ public:
bool getVec3(double &x, double &y, double &z, double defaultval = 0.0) const;
RangeType toRange() const;
+ operator bool() const { return this->toBool(); }
+
Value &operator=(const Value &v);
- Value operator!() const;
bool operator==(const Value &v) const;
bool operator!=(const Value &v) const;
- bool operator&&(const Value &v) const;
- bool operator||(const Value &v) const;
bool operator<(const Value &v) const;
bool operator<=(const Value &v) const;
bool operator>=(const Value &v) const;
@@ -98,16 +97,6 @@ public:
Value operator/(const Value &v) const;
Value operator%(const Value &v) const;
- /*
- bool getnum(double &v) const;
- bool getv2(double &x, double &y) const;
- bool getv3(double &x, double &y, double &z, double defaultval = 0.0) const;
-
- bool toBool() const;
-
- void append(Value *val);
- */
-
friend std::ostream &operator<<(std::ostream &stream, const Value &value) {
if (value.type() == Value::STRING) stream << QuotedString(value.toString());
else stream << value.toString();
contact: Jan Huwald // Impressum