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

Function ArrayAll

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

Source from the content-addressed store, hash-verified

202}
203
204static bool ArrayAll(const Function::Ptr& function)
205{
206 ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
207 Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
208 REQUIRE_NOT_NULL(self);
209 REQUIRE_NOT_NULL(function);
210
211 if (vframe->Sandboxed && !function->IsSideEffectFree())
212 BOOST_THROW_EXCEPTION(ScriptError("Filter function must be side-effect free."));
213
214 ObjectLock olock(self);
215 for (const Value& item : self) {
216 if (!function->Invoke({ item }))
217 return false;
218 }
219
220 return true;
221}
222static Array::Ptr ArrayUnique()
223{
224 ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();

Callers

nothing calls this directly

Calls 3

ScriptErrorClass · 0.85
IsSideEffectFreeMethod · 0.80
InvokeMethod · 0.45

Tested by

no test coverage detected