ConfigItem::ConfigItem(const String& type, const String& name,
bool abstract, const ExpressionList::Ptr& exprl,
const std::vector<String>& parents, const DebugInfo& debuginfo)
- : m_Type(type), m_Name(name), m_Abstract(abstract),
+ : m_Type(type), m_Name(name), m_Abstract(abstract), m_Validated(false),
m_ExpressionList(exprl), m_ParentNames(parents), m_DebugInfo(debuginfo)
{
}
void ConfigItem::ValidateItem(void)
{
+ if (m_Validated)
+ return;
+
ConfigType::Ptr ctype = ConfigType::GetByName(GetType());
if (!ctype) {
}
ctype->ValidateItem(GetSelf());
+
+ m_Validated = true;
}
bool ConfigItem::ActivateItems(bool validateOnly)
item->Link();
}
+ if (ConfigCompilerContext::GetInstance()->HasErrors())
+ return false;
+
+ Log(LogInformation, "config", "Validating config items (step 1)...");
+
+ BOOST_FOREACH(boost::tie(boost::tuples::ignore, item), m_Items) {
+ item->ValidateItem();
+ }
+
if (ConfigCompilerContext::GetInstance()->HasErrors())
return false;
object->OnConfigLoaded();
}
+ Log(LogInformation, "config", "Validating config items (step 2)...");
+
BOOST_FOREACH(boost::tie(boost::tuples::ignore, item), m_Items) {
item->ValidateItem();
}
String m_Type; /**< The object type. */
String m_Name; /**< The name. */
bool m_Abstract; /**< Whether this is a template. */
+ bool m_Validated; /** Whether this object has been validated. */
ExpressionList::Ptr m_ExpressionList;
std::vector<String> m_ParentNames; /**< The names of parent configuration