| 344 | } |
| 345 | |
| 346 | Value icinga::operator/(const Value& lhs, const Value& rhs) |
| 347 | { |
| 348 | if (rhs.IsEmpty()) |
| 349 | BOOST_THROW_EXCEPTION(std::invalid_argument("Right-hand side argument for operator / is Empty.")); |
| 350 | else if ((lhs.IsEmpty() || lhs.IsNumber()) && rhs.IsNumber()) { |
| 351 | if (static_cast<double>(rhs) == 0) |
| 352 | BOOST_THROW_EXCEPTION(std::invalid_argument("Right-hand side argument for operator / is 0.")); |
| 353 | |
| 354 | return static_cast<double>(lhs) / static_cast<double>(rhs); |
| 355 | } else |
| 356 | BOOST_THROW_EXCEPTION(std::invalid_argument("Operator / cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'")); |
| 357 | } |
| 358 | |
| 359 | Value icinga::operator/(const Value& lhs, double rhs) |
| 360 | { |
nothing calls this directly
no test coverage detected