本文整理汇总了C++中Threads::reserve方法的典型用法代码示例。如果您正苦于以下问题:C++ Threads::reserve方法的具体用法?C++ Threads::reserve怎么用?C++ Threads::reserve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Threads
的用法示例。
在下文中一共展示了Threads::reserve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseGdbmiThreads
Threads ThreadsHandler::parseGdbmiThreads(const GdbMi &data, int *currentThread)
{
// ^done,threads=[{id="1",target-id="Thread 0xb7fdc710 (LWP 4264)",
// frame={level="0",addr="0x080530bf",func="testQString",args=[],
// file="/.../app.cpp",fullname="/../app.cpp",line="1175"},
// state="stopped",core="0"}],current-thread-id="1"
const QList<GdbMi> items = data.findChild("threads").children();
const int n = items.size();
Threads threads;
threads.reserve(n);
for (int index = 0; index != n; ++index) {
bool ok = false;
const GdbMi item = items.at(index);
const GdbMi frame = item.findChild("frame");
ThreadData thread;
thread.id = item.findChild("id").data().toInt();
thread.targetId = QString::fromLatin1(item.findChild("target-id").data());
thread.core = QString::fromLatin1(item.findChild("core").data());
thread.state = QString::fromLatin1(item.findChild("state").data());
thread.address = frame.findChild("addr").data().toULongLong(&ok, 0);
thread.function = QString::fromLatin1(frame.findChild("func").data());
thread.fileName = QString::fromLatin1(frame.findChild("fullname").data());
thread.lineNumber = frame.findChild("line").data().toInt();
thread.module = QString::fromLocal8Bit(frame.findChild("from").data());
// Non-GDB (Cdb2) output name here.
thread.name = QString::fromLatin1(frame.findChild("name").data());
threads.append(thread);
}
if (currentThread)
*currentThread = data.findChild("current-thread-id").data().toInt();
return threads;
}