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

Function ArrayAny

lib/base/array-script.cpp:185–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185static bool ArrayAny(const Function::Ptr& function)
186{
187 ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
188 Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
189 REQUIRE_NOT_NULL(self);
190 REQUIRE_NOT_NULL(function);
191
192 if (vframe->Sandboxed && !function->IsSideEffectFree())
193 BOOST_THROW_EXCEPTION(ScriptError("Filter function must be side-effect free."));
194
195 ObjectLock olock(self);
196 for (const Value& item : self) {
197 if (function->Invoke({ item }))
198 return true;
199 }
200
201 return false;
202}
203
204static bool ArrayAll(const Function::Ptr& function)
205{

Callers

nothing calls this directly

Calls 3

ScriptErrorClass · 0.85
IsSideEffectFreeMethod · 0.80
InvokeMethod · 0.45

Tested by

no test coverage detected