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


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

本文整理汇总了C++中KviKvsVariant::asBoolean方法的典型用法代码示例。如果您正苦于以下问题:C++ KviKvsVariant::asBoolean方法的具体用法?C++ KviKvsVariant::asBoolean怎么用?C++ KviKvsVariant::asBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KviKvsVariant的用法示例。


在下文中一共展示了KviKvsVariant::asBoolean方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: execute

bool KviKvsTreeNodeSpecialCommandWhile::execute(KviKvsRunTimeContext * c)
{
	for(;;)
	{
		KviKvsVariant v;
		if(!m_pExpression->evaluateReadOnly(c, &v))
			return false;

		if(!v.asBoolean())
			break;

		if(m_pInstruction)
		{
			if(!m_pInstruction->execute(c))
			{
				if(c->error())
					return false;

				if(c->breakPending())
				{
					c->handleBreak();
					return true;
				}

				if(c->continuePending())
				{
					c->handleContinue();
					continue;
				}
				return false;
			}
		}
	}
	return true;
}
开发者ID:AndrioCelos,项目名称:KVIrc,代码行数:35,代码来源:KviKvsTreeNodeSpecialCommandWhile.cpp

示例2: execute

bool KviKvsTreeNodeSpecialCommandFor::execute(KviKvsRunTimeContext * c)
{
	if(m_pInitialization)
	{
		if(!m_pInitialization->execute(c))
		{
			// break allowed also here
			if(c->error())
				return false;

			if(c->breakPending())
			{
				c->handleBreak();
				return true;
			}

			return false; // propagate false ret value
		}
	}

	for(;;)
	{
		if(m_pCondition)
		{
			KviKvsVariant v;
			if(!m_pCondition->evaluateReadOnly(c, &v))
				return false;
			if(!v.asBoolean())
				return true;
		}

		if(m_pLoop)
		{
			if(!m_pLoop->execute(c))
			{
				if(c->error())
					return false;

				if(c->breakPending())
				{
					c->handleBreak();
					return true;
				}

				if(c->continuePending())
					c->handleContinue();
				else
					return false; // propagate false ret value
			}
		}

		if(m_pUpdate)
		{
			if(!m_pUpdate->execute(c))
			{
				// break allowed also here
				if(c->error())
					return false;

				if(c->breakPending())
				{
					c->handleBreak();
					return true;
				}

				if(c->continuePending())
					c->handleContinue();

				return false; // propagate false ret value
			}
		}
	}
	// not reached
	return false;
}
开发者ID:AndrioCelos,项目名称:KVIrc,代码行数:75,代码来源:KviKvsTreeNodeSpecialCommandFor.cpp

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