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


C++ KviKvsVariantList::allAsString方法代码示例

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


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

示例1: execute

bool KviKvsTreeNodeParameterReturn::execute(KviKvsRunTimeContext * c)
{
	KviKvsVariantList lBuffer;
	if(!m_pDataList->evaluate(c, &lBuffer))
		return false;
	if(lBuffer.count() == 0)
	{
		c->returnValue()->setNothing();
		return true;
	}
	if(lBuffer.count() == 1)
	{
		c->returnValue()->copyFrom(*(lBuffer.first()));
		return true;
	}

	QString all;
	lBuffer.allAsString(all);
	c->returnValue()->setString(all);
	return true;
}
开发者ID:AndrioCelos,项目名称:KVIrc,代码行数:21,代码来源:KviKvsTreeNodeParameterReturn.cpp

示例2: execute

bool KviKvsTreeNodeAliasSimpleCommand::execute(KviKvsRunTimeContext * c)
{
	KviKvsVariantList l;
	if(!m_pParams->evaluate(c, &l))
		return false;

	KviKvsSwitchList swl;
	if(m_pSwitches)
	{
		if(!(m_pSwitches->evaluate(c, &swl)))
			return false;
	}

	const KviKvsScript * s = KviKvsAliasManager::instance()->lookup(m_szCmdName);
	if(!s)
	{
		if(KVI_OPTION_BOOL(KviOption_boolSendUnknownCommandsAsRaw))
		{
			QString szAll;
			l.allAsString(szAll);

			if(!szAll.isEmpty())
				szAll.prepend(" ");
			szAll.prepend(m_szCmdName);

			QByteArray szData;

			if(!c->window()->context())
				goto no_way_to_send_as_raw;
			if(!c->window()->connection())
				goto no_way_to_send_as_raw;

			szData = c->window()->connection()->encodeText(szAll);
			if(!szData.data())
				szData = "";

			if(!c->window()->connection()->sendData(szData.data()))
				goto no_way_to_send_as_raw;

			c->window()->output(KVI_OUT_RAW, __tr2qs_ctx("[RAW]: %Q", "kvs"), &szAll);
			return true;
		no_way_to_send_as_raw:
			c->warning(this, __tr2qs_ctx("Failed to send an unknown command as /RAW", "kvs"));
			c->error(this, __tr2qs_ctx("Call to undefined command '%Q'", "kvs"), &m_szCmdName);
			return false;
		}
		else
		{
			c->error(this, __tr2qs_ctx("Call to undefined command '%Q'", "kvs"), &m_szCmdName);
			return false;
		}
	}

	KviKvsScript copy(*s); // quick reference
	// FIXME: the ExtRTData could be a member structure
	//        it would avoid the constructor call each time
	KviKvsExtendedRunTimeData extData(&swl);

	if(!copy.run(c->window(), &l, nullptr, KviKvsScript::PreserveParams, &extData))
	{
		c->error(this, __tr2qs_ctx("Error in inner alias command call '%Q', called from this context", "kvs"), &m_szCmdName);
		return false;
	}
	return true;
}
开发者ID:CardinalSins,项目名称:KVIrc,代码行数:65,代码来源:KviKvsTreeNodeAliasSimpleCommand.cpp


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