MCPcopy Create free account
hub / github.com/Icinga/icinga2 / operator/

Method operator/

lib/base/value-operators.cpp:346–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346Value 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
359Value icinga::operator/(const Value& lhs, double rhs)
360{

Callers

nothing calls this directly

Calls 4

IsNumberMethod · 0.80
ValueClass · 0.70
IsEmptyMethod · 0.45
GetTypeNameMethod · 0.45

Tested by

no test coverage detected