本文整理汇总了C++中FrameInjection::getClassName方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameInjection::getClassName方法的具体用法?C++ FrameInjection::getClassName怎么用?C++ FrameInjection::getClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameInjection
的用法示例。
在下文中一共展示了FrameInjection::getClassName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetClassName
CStrRef FrameInjection::GetClassName(bool skip /* = false */) {
FrameInjection *t = ThreadInfo::s_threadInfo->m_top;
if (t && skip) {
t = t->m_prev;
}
// If we have included a file inside a class method or called a builtin
// function, we should walk up to find that class
if (t) {
while (t->m_prev && t->getClassName().empty() &&
t->m_flags & (PseudoMain | BuiltinFunction)) {
t = t->m_prev;
}
CStrRef name = t->getClassName();
if (!name.empty()) {
return name;
}
}
return empty_string;
}
示例2: GetBacktrace
Array FrameInjection::GetBacktrace(bool skip /* = false */,
bool withSelf /* = false */,
bool withThis /* = true */) {
Array bt = Array::Create();
FrameInjection *t = ThreadInfo::s_threadInfo->m_top;
if (skip && t) {
t = t->m_prev;
}
// This is used by onError with extended exceptions
if (withSelf && t) {
String filename = t->getFileName();
// If the top frame is not an extension function,
// add it to the trace
if (filename != "") {
Array frame = Array::Create();
frame.set(s_file, filename, true);
frame.set(s_line, t->m_line, true);
bt.append(frame);
}
}
while (t && (RuntimeOption::InjectedStackTraceLimit < 0
|| bt.size() < RuntimeOption::InjectedStackTraceLimit)) {
Array frame = Array::Create();
if (t->m_prev) {
String file = t->m_prev->getFileName();
if (!file.empty() && t->m_prev->m_line) {
frame.set(s_file, file, true);
frame.set(s_line, t->m_prev->m_line, true);
}
} else if (t->m_flags & PseudoMain) {
// Stop at top, don't include top file
break;
}
if (t->m_flags & PseudoMain) {
frame.set(s_function, "include", true);
frame.set(s_args, Array::Create(t->getFileName()), true);
} else {
const char *c = strstr(t->m_name, "::");
if (c) {
frame.set(s_function, String(c + 2), true);
frame.set(s_class, t->getClassName()->copy(), true);
if (ObjectData *obj = t->getObjectV()) {
if (withThis) {
frame.set(s_object, Object(obj), true);
}
frame.set(s_type, "->", true);
} else {
frame.set(s_type, "::", true);
}
} else {
frame.set(s_function, t->m_name, true);
}
Array args = t->getArgs();
if (!args.isNull()) {
frame.set(s_args, args, true);
} else {
frame.set(s_args, Array::Create(), true);
}
}
bt.append(frame);
t = t->m_prev;
}
return bt;
}