mirror of https://github.com/Icinga/icinga2.git
parent
acc9eb20fa
commit
65be09215f
|
@ -41,12 +41,12 @@ class Type;
|
||||||
struct Field
|
struct Field
|
||||||
{
|
{
|
||||||
int ID;
|
int ID;
|
||||||
intrusive_ptr<Type> FType;
|
const char *TypeName;
|
||||||
const char *Name;
|
const char *Name;
|
||||||
int Attributes;
|
int Attributes;
|
||||||
|
|
||||||
Field(int id, const intrusive_ptr<Type>& type, const char *name, int attributes)
|
Field(int id, const char *type, const char *name, int attributes)
|
||||||
: ID(id), FType(type), Name(name), Attributes(attributes)
|
: ID(id), TypeName(type), Name(name), Attributes(attributes)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,8 @@ std::vector<String> icinga::GetFieldCompletionSuggestions(const Type::Ptr& type,
|
||||||
if (!(field.Attributes & FAConfig) || field.Attributes & FAInternal)
|
if (!(field.Attributes & FAConfig) || field.Attributes & FAInternal)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (field.FType != Type::GetByName("int") && field.FType != Type::GetByName("double")
|
if (strcmp(field.TypeName, "int") != 0 && strcmp(field.TypeName, "double") != 0
|
||||||
&& field.FType != Type::GetByName("bool") && field.FType != Type::GetByName("String"))
|
&& strcmp(field.TypeName, "bool") != 0 && strcmp(field.TypeName, "String") != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String fname = field.Name;
|
String fname = field.Name;
|
||||||
|
|
|
@ -373,7 +373,7 @@ Value IndexerExpression::DoEvaluate(const Object::Ptr& context, DebugHint *dhint
|
||||||
} else if (value.IsObjectType<Array>()) {
|
} else if (value.IsObjectType<Array>()) {
|
||||||
Array::Ptr arr = value;
|
Array::Ptr arr = value;
|
||||||
return arr->Get(index);
|
return arr->Get(index);
|
||||||
} else if (value.IsObjectType<Object>()) {
|
} else if (value.IsObject()) {
|
||||||
Object::Ptr object = value;
|
Object::Ptr object = value;
|
||||||
Type::Ptr type = object->GetReflectionType();
|
Type::Ptr type = object->GetReflectionType();
|
||||||
|
|
||||||
|
|
|
@ -299,14 +299,14 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
||||||
for (it = klass.Fields.begin(); it != klass.Fields.end(); it++) {
|
for (it = klass.Fields.begin(); it != klass.Fields.end(); it++) {
|
||||||
std::string ftype = it->Type;
|
std::string ftype = it->Type;
|
||||||
|
|
||||||
if (ftype.find("::Ptr") == ftype.size() - strlen("::Ptr"))
|
if (ftype.find("::Ptr") != std::string::npos)
|
||||||
ftype = ftype.substr(0, ftype.size() - strlen("::Ptr"));
|
ftype = ftype.substr(0, ftype.size() - strlen("::Ptr"));
|
||||||
|
|
||||||
if (it->Attributes & FAEnum)
|
if (it->Attributes & FAEnum)
|
||||||
ftype = "int";
|
ftype = "int";
|
||||||
|
|
||||||
std::cout << "\t\t\t" << "case " << num << ":" << std::endl
|
std::cout << "\t\t\t" << "case " << num << ":" << std::endl
|
||||||
<< "\t\t\t\t" << "return Field(" << num << ", Type::GetByName(\"" << ftype << "\"), \"" << it->Name << "\", " << it->Attributes << ");" << std::endl;
|
<< "\t\t\t\t" << "return Field(" << num << ", \"" << ftype << "\", \"" << it->Name << "\", " << it->Attributes << ");" << std::endl;
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue