本文整理汇总了C++中AsyncOp::values方法的典型用法代码示例。如果您正苦于以下问题:C++ AsyncOp::values方法的具体用法?C++ AsyncOp::values怎么用?C++ AsyncOp::values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AsyncOp
的用法示例。
在下文中一共展示了AsyncOp::values方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onSoapFinished
void DiscoverRouterSoapOp::onSoapFinished()
{
if (!m_mac.isNull())
{
AsyncOp *op = qobject_cast<AsyncOp*>(sender());
if (op)
{
int index = -1;
for (int i = 0; i < m_opList.count(); i++)
{
if (m_opList.at(i) == op)
{
index = i;
break;
}
}
if (index >= 0)
{
QString mac = op->values().value(QLatin1String("newwlanmacaddress")).toString().toUpper();
if (mac.compare(m_mac, Qt::CaseInsensitive) == 0)
{
LOG_DEBUG(QString::fromUtf8("DiscoverRouterSoapOp fast path for %1 %2").arg(mac).arg(m_ls.at(index)));
for (int i = 0; i < m_opList.count(); i++)
{
AsyncOp *op = m_opList.at(i);
disconnect(op, SIGNAL(finished()), this, SLOT(onSoapFinished()));
op->abort();
}
QVariantMap varMap = op->values();
varMap.insert(QLatin1String("soapHostName"), m_ls.at(index));
QVariantList fullList;
fullList.push_back(varMap);
setValue("fullList", fullList);
setValue("matchIndex", 0);
return notifyFinished(NoError);
}
}
}
}
if (m_count++ == m_opList.count())
{
process();
}
}
示例2: process
void DiscoverRouterSoapOp::process()
{
QStringList ls1;
QList<QVariantMap> ls2;
for (int i = 0; i < m_opList.count(); i++)
{
AsyncOp *op = m_opList.at(i);
if (op->isFinished() && op->result() == NoError)
{
ls1.append(m_ls.at(i));
ls2.append(op->values());
}
}
if (ls1.isEmpty())
{
LOG_DEBUG(QString::fromUtf8("No router found!"));
notifyFinished(UnknownError);
return;
}
QSet<QString> set1;
int count = ls1.count();
int i = 0;
while (i < count)
{
const QVariantMap& varMap = ls2.at(i);
QString mac = varMap.value(QLatin1String("newwlanmacaddress")).toString().toUpper();
if (set1.find(mac) == set1.end())
{
set1.insert(mac);
i++;
}
else
{
ls1.removeAt(i);
ls2.removeAt(i);
count--;
}
}
int matchIndex = -1;
QVariantList fullList;
LOG_DEBUG(QString::fromUtf8("found %1 router(s)").arg(ls1.count()));
for (int i = 0; i < ls1.count(); i++)
{
QString hostName = ls1.at(i);
QVariantMap varMap = ls2.at(i);
varMap.insert(QLatin1String("soapHostName"), hostName);
QString mac = varMap.value(QLatin1String("newwlanmacaddress")).toString().toUpper();
fullList.push_back(varMap);
m_mac = mac;
//if (!m_mac.isNull() && mac.compare(m_mac, Qt::CaseInsensitive) == 0) {
matchIndex = i;
//}
LOG_DEBUG(QString::fromUtf8("%1 [%2]").arg(hostName).arg(mac));
}
setValue("fullList", fullList);
setValue("matchIndex", matchIndex);
notifyFinished(NoError);
}