Implement field attribute to hide fields in command auto-completion

fixes #7403
This commit is contained in:
Gunnar Beutner 2014-10-31 08:53:25 +01:00
parent 9f7c97051e
commit 3fc3f05bb4
5 changed files with 9 additions and 9 deletions

View File

@ -35,7 +35,7 @@ public:
abstract class DynamicObject
{
[config] String __name (Name);
[config, internal] String __name (Name);
[config] String name (ShortName) {
get {{{
if (m_ShortName.IsEmpty())
@ -44,9 +44,9 @@ abstract class DynamicObject
return m_ShortName;
}}}
};
[config, get_protected] String type (TypeName);
[config, internal, get_protected] String type (TypeName);
[config] String zone;
[config, get_protected] Array::Ptr templates;
[config, internal, get_protected] Array::Ptr templates;
[config] Dictionary::Ptr methods;
[config] Dictionary::Ptr vars (VarsRaw);
[get_protected] bool active;

View File

@ -33,7 +33,8 @@ namespace icinga
enum FieldAttribute
{
FAConfig = 1,
FAState = 2
FAState = 2,
FAInternal = 32
};
class Type;

View File

@ -75,7 +75,7 @@ std::vector<String> icinga::GetFieldCompletionSuggestions(const Type *type, cons
for (int i = 0; i < type->GetFieldCount(); i++) {
Field field = type->GetFieldInfo(i);
if (!(field.Attributes & FAConfig))
if (!(field.Attributes & FAConfig) || field.Attributes & FAInternal)
continue;
if (field.FType != Type::GetByName("int") && field.FType != Type::GetByName("double")
@ -84,9 +84,6 @@ std::vector<String> icinga::GetFieldCompletionSuggestions(const Type *type, cons
String fname = field.Name;
if (fname == "__name" || fname == "templates" || fname == "type")
continue;
String suggestion = fname + "=";
if (suggestion.Find(word) == 0)

View File

@ -139,6 +139,7 @@ enum { yylval->num = FAEnum; return T_FIELD_ATTRIBUTE; }
get_protected { yylval->num = FAGetProtected; return T_FIELD_ATTRIBUTE; }
set_protected { yylval->num = FASetProtected; return T_FIELD_ATTRIBUTE; }
protected { yylval->num = FAGetProtected | FASetProtected; return T_FIELD_ATTRIBUTE; }
internal { yylval->num = FAInternal; return T_FIELD_ATTRIBUTE; }
default { yylval->num = FTDefault; return T_FIELD_ACCESSOR_TYPE; }
get { yylval->num = FTGet; return T_FIELD_ACCESSOR_TYPE; }
set { yylval->num = FTSet; return T_FIELD_ACCESSOR_TYPE; }

View File

@ -60,7 +60,8 @@ enum FieldAttribute
FAState = 2,
FAEnum = 4,
FAGetProtected = 8,
FASetProtected = 16
FASetProtected = 16,
FAInternal = 32
};
struct Field