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

Method GetPrototypeField

lib/base/object.cpp:184–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184Value icinga::GetPrototypeField(const Value& context, const String& field, bool not_found_error, const DebugInfo& debugInfo)
185{
186 Type::Ptr ctype = context.GetReflectionType();
187 Type::Ptr type = ctype;
188
189 do {
190 Object::Ptr object = type->GetPrototype();
191
192 if (object && object->HasOwnField(field))
193 return object->GetFieldByName(field, false, debugInfo);
194
195 type = type->GetBaseType();
196 } while (type);
197
198 if (not_found_error)
199 BOOST_THROW_EXCEPTION(ScriptError("Invalid field access (for value of type '" + ctype->GetName() + "'): '" + field + "'", debugInfo));
200 else
201 return Empty;
202}
203
204#ifdef I2_LEAK_DEBUG
205void icinga::TypeAddObject(const Object *object)

Callers

nothing calls this directly

Calls 7

ScriptErrorClass · 0.85
GetReflectionTypeMethod · 0.45
GetPrototypeMethod · 0.45
HasOwnFieldMethod · 0.45
GetFieldByNameMethod · 0.45
GetBaseTypeMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected