Beispiel #1
0
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());
	}
}
Beispiel #2
0
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());
	}
}
Beispiel #3
0
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());
	}
}
Beispiel #4
0
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());
	}
}
Beispiel #5
0
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());
	}
}
Beispiel #6
0
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());
	}
}
Beispiel #7
0
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());
	}
}
Beispiel #8
0
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());
	}
}
Beispiel #9
0
pgsOperand operator==(const pgsVariable &lhs, const pgsVariable &rhs)
{
	return lhs.pgs_equal(rhs);
}
Beispiel #10
0
pgsOperand pgsRecord::pgs_modulo(const pgsVariable &rhs) const
{
	throw pgsArithmeticException(value(), rhs.value());
}
Beispiel #11
0
pgsOperand operator>=(const pgsVariable &lhs, const pgsVariable &rhs)
{
	return lhs.pgs_greater_equal(rhs);
}
Beispiel #12
0
pgsOperand pgsString::pgs_modulo(const pgsVariable &rhs) const
{
	throw pgsArithmeticException(m_data, rhs.value());
}
Beispiel #13
0
pgsOperand operator!(const pgsVariable &lhs)
{
	return lhs.pgs_not();
}
Beispiel #14
0
pgsOperand operator-(const pgsVariable &lhs, const pgsVariable &rhs)
{
	return lhs.pgs_minus(rhs);
}
Beispiel #15
0
pgsOperand operator+(const pgsVariable &lhs, const pgsVariable &rhs)
{
	return lhs.pgs_plus(rhs);
}
Beispiel #16
0
pgsOperand operator<(const pgsVariable &lhs, const pgsVariable &rhs)
{
	return lhs.pgs_lower(rhs);
}
Beispiel #17
0
pgsOperand operator!=(const pgsVariable &lhs, const pgsVariable &rhs)
{
	return lhs.pgs_different(rhs);
}
Beispiel #18
0
pgsOperand operator*(const pgsVariable &lhs, const pgsVariable &rhs)
{
	return lhs.pgs_times(rhs);
}
Beispiel #19
0
pgsOperand operator%(const pgsVariable &lhs, const pgsVariable &rhs)
{
	return lhs.pgs_modulo(rhs);
}
Beispiel #20
0
pgsOperand operator/(const pgsVariable &lhs, const pgsVariable &rhs)
{
	return lhs.pgs_over(rhs);
}