本文整理汇总了C++中KviKvsVariant::isNothing方法的典型用法代码示例。如果您正苦于以下问题:C++ KviKvsVariant::isNothing方法的具体用法?C++ KviKvsVariant::isNothing怎么用?C++ KviKvsVariant::isNothing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KviKvsVariant
的用法示例。
在下文中一共展示了KviKvsVariant::isNothing方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evaluateReadOnlyInObjectScope
bool KviKvsTreeNodeHashElement::evaluateReadOnlyInObjectScope(KviKvsObject *o,KviKvsRunTimeContext * c,KviKvsVariant * pBuffer)
{
KviKvsVariant key;
if(!m_pKey->evaluateReadOnly(c,&key))return false;
QString szKey;
key.asString(szKey);
if(szKey.isEmpty())
{
c->warning(this,__tr2qs_ctx("Hash key evaluated to empty string: fix the script","kvs"));
pBuffer->setNothing();
return true;
}
KviKvsVariant val;
if(o)
{
if(!m_pSource->evaluateReadOnlyInObjectScope(o,c,&val))return false;
} else {
if(!m_pSource->evaluateReadOnly(c,&val))return false;
}
if(!val.isHash())
{
if(!val.isNothing())
{
QString szType;
val.getTypeName(szType);
c->warning(this,__tr2qs_ctx("The argument of the {} subscript didn't evaluate to a hash: automatic conversion from type '%Q' supplied","kvs"),&szType);
}
pBuffer->setNothing();
return true;
}
KviKvsVariant * v = val.hash()->find(szKey);
if(!v)
{
pBuffer->setNothing();
return true;
}
pBuffer->copyFrom(v);
return true;
}
示例2: trigger
bool KviKvsProcessAsyncOperation::trigger(CallbackEvent e, const QString & szData)
{
if(m_bDeletePending)
return false;
if(!g_pApp->windowExists(m_pData->pWnd))
{
if(m_pData->iFlags & KVI_KVS_PROCESSDESCRIPTOR_KILLIFNOWINDOW)
{
return true;
}
m_pData->pWnd = g_pApp->activeConsole();
}
if(m_pData->pCallback)
{
KviKvsVariantList params;
params.setAutoDelete(true);
switch(e)
{
case EventStdout:
params.append(new KviKvsVariant(QString("stdout")));
break;
case EventStderr:
params.append(new KviKvsVariant(QString("stderr")));
break;
case EventTerminated:
params.append(new KviKvsVariant(QString("terminated")));
break;
case EventStarted:
params.append(new KviKvsVariant(QString("started")));
break;
case EventPing:
params.append(new KviKvsVariant(QString("ping")));
break;
default:
qDebug("Oops! Unknown trigger() CallbackEvent parameter in QProcessDescriptor::trigger()");
return false;
break;
}
params.append(new KviKvsVariant(szData));
if(m_pData->pMagic)
{
KviKvsVariant * pTmp = new KviKvsVariant();
pTmp->copyFrom(m_pData->pMagic);
params.append(pTmp);
}
KviKvsVariant retVal;
int iRet = m_pData->pCallback->run(m_pData->pWnd, ¶ms, &retVal, KviKvsScript::PreserveParams, m_pExtendedRunTimeData);
if(!iRet)
{
m_pData->pWnd->output(KVI_OUT_PARSERERROR,
__tr2qs_ctx("Error triggered from process callback handler: killing process", "kvs"));
return true;
}
if(!retVal.isNothing())
{
QString sz;
retVal.asString(sz);
m_pProcess->write(sz.toUtf8().data());
}
if(iRet & KviKvsScript::HaltEncountered)
{
// halt encountered: kill the process
return true;
}
}
return false;
}