| 377 | } |
| 378 | |
| 379 | Value icinga::operator%(const Value& lhs, const Value& rhs) |
| 380 | { |
| 381 | if (rhs.IsEmpty()) |
| 382 | BOOST_THROW_EXCEPTION(std::invalid_argument("Right-hand side argument for operator % is Empty.")); |
| 383 | else if ((rhs.IsNumber() || lhs.IsNumber()) && rhs.IsNumber()) { |
| 384 | if (static_cast<double>(rhs) == 0) |
| 385 | BOOST_THROW_EXCEPTION(std::invalid_argument("Right-hand side argument for operator % is 0.")); |
| 386 | |
| 387 | return static_cast<int>(lhs) % static_cast<int>(rhs); |
| 388 | } else |
| 389 | BOOST_THROW_EXCEPTION(std::invalid_argument("Operator % cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'")); |
| 390 | } |
| 391 | |
| 392 | Value icinga::operator%(const Value& lhs, double rhs) |
| 393 | { |
nothing calls this directly
no test coverage detected