mirror of https://github.com/Icinga/icinga2.git
parent
701961b73b
commit
783b58536f
|
@ -46,17 +46,32 @@ int PrimitiveType::GetAttributes(void) const
|
||||||
|
|
||||||
int PrimitiveType::GetFieldId(const String& name) const
|
int PrimitiveType::GetFieldId(const String& name) const
|
||||||
{
|
{
|
||||||
return -1;
|
Type::Ptr base = GetBaseType();
|
||||||
|
|
||||||
|
if (base)
|
||||||
|
return base->GetFieldId(name);
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Field PrimitiveType::GetFieldInfo(int id) const
|
Field PrimitiveType::GetFieldInfo(int id) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Invalid field ID.");
|
Type::Ptr base = GetBaseType();
|
||||||
|
|
||||||
|
if (base)
|
||||||
|
return base->GetFieldInfo(id);
|
||||||
|
else
|
||||||
|
throw std::runtime_error("Invalid field ID.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int PrimitiveType::GetFieldCount(void) const
|
int PrimitiveType::GetFieldCount(void) const
|
||||||
{
|
{
|
||||||
return 0;
|
Type::Ptr base = GetBaseType();
|
||||||
|
|
||||||
|
if (base)
|
||||||
|
return Object::TypeInstance->GetFieldCount();
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectFactory PrimitiveType::GetFactory(void) const
|
ObjectFactory PrimitiveType::GetFactory(void) const
|
||||||
|
|
|
@ -121,7 +121,7 @@ Value Type::GetField(int id) const
|
||||||
else if (id == 2)
|
else if (id == 2)
|
||||||
return GetBaseType();
|
return GetBaseType();
|
||||||
|
|
||||||
return Object::GetField(id);
|
return Object::GetField(id - 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<String> Type::GetLoadDependencies(void) const
|
std::vector<String> Type::GetLoadDependencies(void) const
|
||||||
|
@ -169,11 +169,11 @@ Field TypeType::GetFieldInfo(int id) const
|
||||||
if (real_id < 0)
|
if (real_id < 0)
|
||||||
return GetBaseType()->GetFieldInfo(id);
|
return GetBaseType()->GetFieldInfo(id);
|
||||||
|
|
||||||
if (id == 0)
|
if (real_id == 0)
|
||||||
return Field(0, "String", "name", "", NULL, 0, 0);
|
return Field(0, "String", "name", "", NULL, 0, 0);
|
||||||
else if (id == 1)
|
else if (real_id == 1)
|
||||||
return Field(1, "Object", "prototype", "", NULL, 0, 0);
|
return Field(1, "Object", "prototype", "", NULL, 0, 0);
|
||||||
else if (id == 2)
|
else if (real_id == 2)
|
||||||
return Field(2, "Type", "base", "", NULL, 0, 0);
|
return Field(2, "Type", "base", "", NULL, 0, 0);
|
||||||
|
|
||||||
throw std::runtime_error("Invalid field ID.");
|
throw std::runtime_error("Invalid field ID.");
|
||||||
|
|
Loading…
Reference in New Issue