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

Function TypeRegisterAttributeHandler

lib/base/typetype-script.cpp:12–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace icinga;
11
12static void TypeRegisterAttributeHandler(const String& fieldName, const Function::Ptr& callback)
13{
14 ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
15 Type::Ptr self = static_cast<Type::Ptr>(vframe->Self);
16 REQUIRE_NOT_NULL(self);
17
18 int fid = self->GetFieldId(fieldName);
19 self->RegisterAttributeHandler(fid, [callback](const Object::Ptr& object, [[maybe_unused]] const Value& cookie) {
20 callback->Invoke({ object });
21 });
22}
23
24Object::Ptr TypeType::GetPrototype()
25{

Callers

nothing calls this directly

Calls 3

GetFieldIdMethod · 0.45
InvokeMethod · 0.45

Tested by

no test coverage detected