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 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 #5
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 #6
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 #7
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 #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 pgsRecord::pgs_modulo(const pgsVariable &rhs) const
{
	throw pgsArithmeticException(value(), rhs.value());
}
Beispiel #10
0
pgsOperand pgsString::pgs_modulo(const pgsVariable &rhs) const
{
	throw pgsArithmeticException(m_data, rhs.value());
}