本文整理汇总了C++中configobject::Ptr::GetDebugInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::GetDebugInfo方法的具体用法?C++ Ptr::GetDebugInfo怎么用?C++ Ptr::GetDebugInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configobject::Ptr
的用法示例。
在下文中一共展示了Ptr::GetDebugInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RegisterObject
void ConfigType::RegisterObject(const ConfigObject::Ptr& object)
{
String name = object->GetName();
{
ObjectLock olock(this);
ObjectMap::iterator it = m_ObjectMap.find(name);
if (it != m_ObjectMap.end()) {
if (it->second == object)
return;
BOOST_THROW_EXCEPTION(ScriptError("An object with type '" + m_Name + "' and name '" + name + "' already exists (" +
Convert::ToString(it->second->GetDebugInfo()) + "), new declaration: " + Convert::ToString(object->GetDebugInfo()),
object->GetDebugInfo()));
}
m_ObjectMap[name] = object;
m_ObjectVector.push_back(object);
}
}
示例2: RegisterObject
void ConfigType::RegisterObject(const ConfigObject::Ptr& object)
{
String name = object->GetName();
{
boost::mutex::scoped_lock lock(m_Mutex);
auto it = m_ObjectMap.find(name);
if (it != m_ObjectMap.end()) {
if (it->second == object)
return;
Type *type = dynamic_cast<Type *>(this);
BOOST_THROW_EXCEPTION(ScriptError("An object with type '" + type->GetName() + "' and name '" + name + "' already exists (" +
Convert::ToString(it->second->GetDebugInfo()) + "), new declaration: " + Convert::ToString(object->GetDebugInfo()),
object->GetDebugInfo()));
}
m_ObjectMap[name] = object;
m_ObjectVector.push_back(object);
}
}
示例3: DiagnosticInformation
String icinga::DiagnosticInformation(const std::exception& ex, bool verbose, StackTrace *stack, ContextTrace *context)
{
std::ostringstream result;
String message = ex.what();
const ValidationError *vex = dynamic_cast<const ValidationError *>(&ex);
if (message.IsEmpty())
result << boost::diagnostic_information(ex);
else
result << "Error: " << message;
const ScriptError *dex = dynamic_cast<const ScriptError *>(&ex);
if (dex && !dex->GetDebugInfo().Path.IsEmpty()) {
result << "\nLocation:\n";
ShowCodeFragment(result, dex->GetDebugInfo());
}
if (vex) {
DebugInfo di;
ConfigObject::Ptr dobj = vex->GetObject();
if (dobj)
di = dobj->GetDebugInfo();
Dictionary::Ptr currentHint = vex->GetDebugHint();
Array::Ptr messages;
if (currentHint) {
BOOST_FOREACH(const String& attr, vex->GetAttributePath()) {
Dictionary::Ptr props = currentHint->Get("properties");
if (!props)
break;
currentHint = props->Get(attr);
if (!currentHint)
break;
messages = currentHint->Get("messages");
}
}
if (messages && messages->GetLength() > 0) {
Array::Ptr message = messages->Get(messages->GetLength() - 1);
di.Path = message->Get(1);
di.FirstLine = message->Get(2);
di.FirstColumn = message->Get(3);
di.LastLine = message->Get(4);
di.LastColumn = message->Get(5);
}
if (!di.Path.IsEmpty()) {
result << "\nLocation:\n";
ShowCodeFragment(result, di);
}
}
const user_error *uex = dynamic_cast<const user_error *>(&ex);
const posix_error *pex = dynamic_cast<const posix_error *>(&ex);
if (!uex && !pex && verbose) {
const StackTrace *st = boost::get_error_info<StackTraceErrorInfo>(ex);
if (st) {
result << *st;
} else {
result << std::endl;
if (!stack)
stack = GetLastExceptionStack();
if (stack)
result << *stack;
}
if (boost::get_error_info<ContextTraceErrorInfo>(ex) == NULL) {
result << std::endl;
if (!context)
context = GetLastExceptionContext();
if (context)
result << *context;
}
}
return result.str();
}