当前位置: 首页>>代码示例>>C++>>正文


C++ KviKvsVariant::appendAsString方法代码示例

本文整理汇总了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;
}
开发者ID:philouvb,项目名称:KVIrc,代码行数:33,代码来源:KviKvsTreeNodeMultipleParameterIdentifier.cpp

示例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);
	}
}
开发者ID:DINKIN,项目名称:KVIrc,代码行数:13,代码来源:KviKvsVariantList.cpp

示例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;
}
开发者ID:AndrioCelos,项目名称:KVIrc,代码行数:20,代码来源:KviKvsTreeNodeCompositeData.cpp

示例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:
				{
//.........这里部分代码省略.........
开发者ID:AndrioCelos,项目名称:KVIrc,代码行数:101,代码来源:KviKvsParameterProcessor.cpp


注:本文中的KviKvsVariant::appendAsString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。