本文整理汇总了C++中KviKvsVariant::appendAsString方法的典型用法代码示例。如果您正苦于以下问题:C++ KviKvsVariant::appendAsString方法的具体用法?C++ KviKvsVariant::appendAsString怎么用?C++ KviKvsVariant::appendAsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KviKvsVariant
的用法示例。
在下文中一共展示了KviKvsVariant::appendAsString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evaluateReadOnly
bool KviKvsTreeNodeMultipleParameterIdentifier::evaluateReadOnly(KviKvsRunTimeContext * c,KviKvsVariant * pBuffer)
{
KviKvsVariant * v = c->parameterList()->at(m_iStart);
if(!v)
{
pBuffer->setNothing();
return true;
}
QString sz;
v->asString(sz);
if(m_iEnd >= m_iStart)
{
// only up to m_iEnd
int idx = m_iStart;
for(v = c->parameterList()->next(); v && (idx < m_iEnd); v = c->parameterList()->next())
{
sz += QChar(' ');
v->appendAsString(sz);
idx++;
}
} else {
// all up to the end of the list
for(v = c->parameterList()->next(); v; v = c->parameterList()->next())
{
sz += QChar(' ');
v->appendAsString(sz);
}
}
pBuffer->setString(sz);
return true;
}
示例2: allAsString
void KviKvsVariantList::allAsString(QString & szBuffer)
{
szBuffer = QString();
bool bFirst = true;
for(KviKvsVariant * v = first(); v; v = next())
{
if(bFirst)
bFirst = false;
else
szBuffer.append(' ');
v->appendAsString(szBuffer);
}
}
示例3: evaluateReadOnly
bool KviKvsTreeNodeCompositeData::evaluateReadOnly(KviKvsRunTimeContext * c, KviKvsVariant * pBuffer)
{
QString * pS = new QString();
pBuffer->setString(pS);
KviKvsVariant res;
// we need to use an iterator to accommodate recursion
KviPointerListIterator<KviKvsTreeNodeData> it(*m_pSubData);
while(KviKvsTreeNodeData * d = it.current())
{
if(!d->evaluateReadOnly(c, &res))
return false;
res.appendAsString(*pS);
++it;
}
return true;
}
示例4: process
bool process(KviKvsVariantList * pVariantList, KviKvsRunTimeContext * pContext, KviKvsParameterProcessor::ParameterFormat * pFmtArray)
{
KviKvsVariant * v = pVariantList->first();
while(pFmtArray->szName)
{
if(!v)
{
// parameter not present
// it MUST be optional
if(!(pFmtArray->uFlags & KVS_PF_OPTIONAL))
{
// bad luck
QString szError = QString(__tr2qs_ctx("Missing non-optional parameter \"%1\"", "kvs")).arg(pFmtArray->szName);
pContext->error(szError);
return false;
}
// ok, missing but optional (all the following are implicitly optional too)
// set to default values
do
{
setDefaultValue(pFmtArray);
pFmtArray++;
} while(pFmtArray->szName);
return true;
}
// here we do only "light" casts: hard ones must be done explicitly by the user
switch(pFmtArray->uType)
{
case KVS_PT_STRING:
v->asString(*((QString *)(pFmtArray->pContainer)));
if(pFmtArray->uFlags & KVS_PF_APPENDREMAINING)
{
v = pVariantList->next();
while(v)
{
*((QString *)(pFmtArray->pContainer)) += QChar(' ');
v->appendAsString(*((QString *)(pFmtArray->pContainer)));
v = pVariantList->next();
}
return true;
}
break;
case KVS_PT_STRINGLIST:
{
((QStringList *)(pFmtArray->pContainer))->clear();
QString pSz;
v->asString(pSz);
((QStringList *)(pFmtArray->pContainer))->append(pSz);
v = pVariantList->next();
while(v)
{
v->asString(pSz);
((QStringList *)(pFmtArray->pContainer))->append(pSz);
v = pVariantList->next();
}
return true;
}
break;
case KVS_PT_VARIANTLIST:
{
((KviKvsVariantList *)(pFmtArray->pContainer))->clear();
((KviKvsVariantList *)(pFmtArray->pContainer))->setAutoDelete(false);
((KviKvsVariantList *)(pFmtArray->pContainer))->append(v);
v = pVariantList->next();
while(v)
{
((KviKvsVariantList *)(pFmtArray->pContainer))->append(v);
v = pVariantList->next();
}
return true;
}
break;
case KVS_PT_NONEMPTYSTRING:
{
v->asString(*((QString *)(pFmtArray->pContainer)));
bool bDoReturn = false;
if(pFmtArray->uFlags & KVS_PF_APPENDREMAINING)
{
v = pVariantList->next();
while(v)
{
*((QString *)(pFmtArray->pContainer)) += QChar(' ');
v->appendAsString(*((QString *)(pFmtArray->pContainer)));
v = pVariantList->next();
}
bDoReturn = true;
}
if(((QString *)(pFmtArray->pContainer))->isEmpty())
{
QString szError = QString(__tr2qs_ctx("Invalid data type for parameter \"%1\": found empty string while a non empty one was expected", "kvs")).arg(pFmtArray->szName);
pContext->error(szError);
return false;
}
if(bDoReturn)
return true;
}
break;
case KVS_PT_CSTRING:
{
//.........这里部分代码省略.........