本文整理汇总了C++中configobject::Ptr::Validate方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::Validate方法的具体用法?C++ Ptr::Validate怎么用?C++ Ptr::Validate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configobject::Ptr
的用法示例。
在下文中一共展示了Ptr::Validate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Commit
//.........这里部分代码省略.........
ScriptFrame frame(dobj);
if (m_Scope)
m_Scope->CopyTo(frame.Locals);
try {
m_Expression->Evaluate(frame, &debugHints);
} catch (const std::exception& ex) {
if (m_IgnoreOnError) {
Log(LogWarning, "ConfigObject")
<< "Ignoring config object '" << m_Name << "' of type '" << m_Type << "' due to errors: " << DiagnosticInformation(ex);
return ConfigObject::Ptr();
}
throw;
}
if (discard)
m_Expression.reset();
String item_name;
String short_name = dobj->GetShortName();
if (!short_name.IsEmpty()) {
item_name = short_name;
dobj->SetName(short_name);
} else
item_name = m_Name;
String name = item_name;
NameComposer *nc = dynamic_cast<NameComposer *>(type.get());
if (nc) {
name = nc->MakeName(name, dobj);
if (name.IsEmpty())
BOOST_THROW_EXCEPTION(std::runtime_error("Could not determine name for object"));
}
if (name != item_name)
dobj->SetShortName(item_name);
dobj->SetName(name);
try {
dobj->OnConfigLoaded();
} catch (const std::exception& ex) {
if (m_IgnoreOnError) {
Log(LogWarning, "ConfigObject")
<< "Ignoring config object '" << m_Name << "' of type '" << m_Type << "' due to errors: " << DiagnosticInformation(ex);
return ConfigObject::Ptr();
}
throw;
}
Dictionary::Ptr persistentItem = new Dictionary();
persistentItem->Set("type", GetType());
persistentItem->Set("name", GetName());
persistentItem->Set("properties", Serialize(dobj, FAConfig));
Dictionary::Ptr dhint = debugHints.ToDictionary();
persistentItem->Set("debug_hints", dhint);
Array::Ptr di = new Array();
di->Add(m_DebugInfo.Path);
di->Add(m_DebugInfo.FirstLine);
di->Add(m_DebugInfo.FirstColumn);
di->Add(m_DebugInfo.LastLine);
di->Add(m_DebugInfo.LastColumn);
persistentItem->Set("debug_info", di);
try {
DefaultValidationUtils utils;
dobj->Validate(FAConfig, utils);
} catch (ValidationError& ex) {
if (m_IgnoreOnError) {
Log(LogWarning, "ConfigObject")
<< "Ignoring config object '" << m_Name << "' of type '" << m_Type << "' due to errors: " << DiagnosticInformation(ex);
return ConfigObject::Ptr();
}
ex.SetDebugHint(dhint);
throw;
}
ConfigCompilerContext::GetInstance()->WriteObject(persistentItem);
persistentItem.reset();
dhint.reset();
dobj->Register();
m_Object = dobj;
return dobj;
}