pgsOperand pgsString::pgs_plus(const pgsVariable &rhs) const { if (rhs.is_string()) { return pnew pgsString(m_data + rhs.value()); } else { throw pgsArithmeticException(m_data, rhs.value()); } }
pgsOperand pgsString::pgs_different(const pgsVariable &rhs) const { if (rhs.is_string()) { return pnew pgsNumber(m_data != rhs.value() ? wxT("1") : wxT("0")); } else { throw pgsArithmeticException(m_data, rhs.value()); } }
pgsOperand pgsString::pgs_almost_equal(const pgsVariable &rhs) const { if (rhs.is_string()) { return pnew pgsNumber(m_data.CmpNoCase(rhs.value()) == 0 ? wxT("1") : wxT("0")); } else { throw pgsArithmeticException(m_data, rhs.value()); } }
pgsOperand pgsRecord::pgs_different(const pgsVariable &rhs) const { if (rhs.is_record()) { const pgsRecord &rhs_op = dynamic_cast<const pgsRecord &>(rhs); return pnew pgsNumber(*this != rhs_op ? wxT("1") : wxT("0")); } else { throw pgsArithmeticException(value(), rhs.value()); } }
pgsOperand pgsNumber::pgs_plus(const pgsVariable &rhs) const { if (rhs.is_number()) { return pnew pgsNumber(pgsMapm::pgs_mapm_str(num(m_data) + num(rhs.value())), is_real() || rhs.is_real()); } else { throw pgsArithmeticException(m_data, rhs.value()); } }
pgsOperand pgsNumber::pgs_greater_equal(const pgsVariable &rhs) const { if (rhs.is_number()) { return pnew pgsNumber(num(m_data) >= num(rhs.value()) ? wxT("1") : wxT("0")); } else { throw pgsArithmeticException(m_data, rhs.value()); } }
pgsOperand pgsRecord::pgs_almost_equal(const pgsVariable &rhs) const { if (rhs.is_record()) { const pgsRecord &rhs_op = dynamic_cast<const pgsRecord &>(rhs); return pnew pgsNumber(this->almost_equal(rhs_op) ? wxT("1") : wxT("0")); } else { throw pgsArithmeticException(value(), rhs.value()); } }
pgsOperand pgsNumber::pgs_over(const pgsVariable &rhs) const { if (rhs.is_number()) { if (num(rhs.value()) != 0) { if (is_real() || rhs.is_real()) return pnew pgsNumber(pgsMapm::pgs_mapm_str(num(m_data) / num(rhs.value())), is_real() || rhs.is_real()); else return pnew pgsNumber(pgsMapm::pgs_mapm_str(num(m_data) .div(num(rhs.value()))), is_real() || rhs.is_real()); } else { throw pgsArithmeticException(m_data, rhs.value()); } } else { throw pgsArithmeticException(m_data, rhs.value()); } }
pgsOperand operator==(const pgsVariable &lhs, const pgsVariable &rhs) { return lhs.pgs_equal(rhs); }
pgsOperand pgsRecord::pgs_modulo(const pgsVariable &rhs) const { throw pgsArithmeticException(value(), rhs.value()); }
pgsOperand operator>=(const pgsVariable &lhs, const pgsVariable &rhs) { return lhs.pgs_greater_equal(rhs); }
pgsOperand pgsString::pgs_modulo(const pgsVariable &rhs) const { throw pgsArithmeticException(m_data, rhs.value()); }
pgsOperand operator!(const pgsVariable &lhs) { return lhs.pgs_not(); }
pgsOperand operator-(const pgsVariable &lhs, const pgsVariable &rhs) { return lhs.pgs_minus(rhs); }
pgsOperand operator+(const pgsVariable &lhs, const pgsVariable &rhs) { return lhs.pgs_plus(rhs); }
pgsOperand operator<(const pgsVariable &lhs, const pgsVariable &rhs) { return lhs.pgs_lower(rhs); }
pgsOperand operator!=(const pgsVariable &lhs, const pgsVariable &rhs) { return lhs.pgs_different(rhs); }
pgsOperand operator*(const pgsVariable &lhs, const pgsVariable &rhs) { return lhs.pgs_times(rhs); }
pgsOperand operator%(const pgsVariable &lhs, const pgsVariable &rhs) { return lhs.pgs_modulo(rhs); }
pgsOperand operator/(const pgsVariable &lhs, const pgsVariable &rhs) { return lhs.pgs_over(rhs); }