From 0e79abb8f24ae327d9faab0283b9342a3e31ad18 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 28 Mar 2014 14:46:19 +0100 Subject: [PATCH] Implement instance variable "templates" for config objects. Refs #5884 --- lib/base/dynamicobject.ti | 1 + lib/config/base-type.conf | 4 ++++ lib/config/configitembuilder.cpp | 3 +++ 3 files changed, 8 insertions(+) diff --git a/lib/base/dynamicobject.ti b/lib/base/dynamicobject.ti index eaab51266..682eb228d 100644 --- a/lib/base/dynamicobject.ti +++ b/lib/base/dynamicobject.ti @@ -5,6 +5,7 @@ abstract class DynamicObject { [config] String name (Name); [config, get_protected] String type (TypeName); + [config, get_protected] Array::Ptr templates; [config] Dictionary::Ptr methods; [config] Dictionary::Ptr custom; [config] Array::Ptr domains; diff --git a/lib/config/base-type.conf b/lib/config/base-type.conf index 1dfdd0a77..66411d726 100644 --- a/lib/config/base-type.conf +++ b/lib/config/base-type.conf @@ -24,6 +24,10 @@ %require "type", %attribute %string "type", + %attribute %array "templates" { + %attribute %string "*" + }, + %attribute %dictionary "methods", %attribute %dictionary "custom" { diff --git a/lib/config/configitembuilder.cpp b/lib/config/configitembuilder.cpp index 0a730b2af..56383b7ef 100644 --- a/lib/config/configitembuilder.cpp +++ b/lib/config/configitembuilder.cpp @@ -86,6 +86,9 @@ ConfigItem::Ptr ConfigItemBuilder::Compile(void) } Array::Ptr exprs = make_shared(); + Array::Ptr templateArray = make_shared(); + templateArray->Add(m_Name); + exprs->Add(make_shared(&AExpression::OpSetPlus, "templates", make_shared(&AExpression::OpLiteral, templateArray, m_DebugInfo), m_DebugInfo)); exprs->Add(make_shared(&AExpression::OpSet, "type", make_shared(&AExpression::OpLiteral, m_Type, m_DebugInfo), m_DebugInfo)); exprs->Add(make_shared(&AExpression::OpDict, m_Expressions, true, m_DebugInfo)); exprs->Add(make_shared(&AExpression::OpSet, "name", make_shared(&AExpression::OpLiteral, m_Name, m_DebugInfo), m_DebugInfo));