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


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

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


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

示例1: lookupTerminated

void KviKvsAsyncDnsOperation::lookupTerminated(KviDnsResolver *)
{
	KviWindow * pWnd = window();
	if(!g_pApp->windowExists(pWnd))
		pWnd = g_pActiveWindow;

	if(m_pCallback)
	{
		KviKvsVariantList params;
		params.setAutoDelete(true);
		if(m_pDns->state() == KviDnsResolver::Failure)
		{
			params.append(new KviKvsVariant(m_szQuery));
			params.append(new KviKvsVariant((kvs_int_t)0));
			params.append(new KviKvsVariant(m_pDns->errorString()));
			params.append(new KviKvsVariant());
			params.append(new KviKvsVariant(*m_pMagic));
		}
		else
		{
			QString szHostName = m_pDns->hostName();
			const auto & strL = m_pDns->ipAddressList();
			const QString & fi = strL.empty() ? QString("?.?.?.?") : strL.front();

			params.append(new KviKvsVariant(m_szQuery));
			params.append(new KviKvsVariant((kvs_int_t)1));
			params.append(new KviKvsVariant(fi));
			params.append(new KviKvsVariant(szHostName.isEmpty() ? QString("?.?") : szHostName));
			params.append(new KviKvsVariant(*m_pMagic));
		}

		m_pCallback->run(pWnd, &params, nullptr, KviKvsScript::PreserveParams);

		delete this;
		return;
	}

	// we have no callback : output the results
	QString szQuery = m_pDns->query();
	pWnd->output(KVI_OUT_HOSTLOOKUP, __tr2qs_ctx("DNS lookup result for query \"%Q\"", "kvs"), &szQuery);

	if(m_pDns->state() == KviDnsResolver::Failure)
	{
		QString strDescription(m_pDns->errorString());
		pWnd->output(KVI_OUT_HOSTLOOKUP, __tr2qs_ctx("Error: %Q", "kvs"), &strDescription);
	}
	else
	{
		QString szHostName = m_pDns->hostName();
		pWnd->output(KVI_OUT_HOSTLOOKUP, __tr2qs_ctx("Hostname: %Q", "kvs"), &szHostName);
		int idx = 1;
		for(const auto & a : m_pDns->ipAddressList())
		{
			pWnd->output(KVI_OUT_HOSTLOOKUP, __tr2qs_ctx("IP address %d: %Q", "kvs"), idx, &a);
			idx++;
		}
	}

	delete this;
}
开发者ID:AndrioCelos,项目名称:KVIrc,代码行数:60,代码来源:KviKvsAsyncDnsOperation.cpp

示例2: characters

	bool characters(const QString & szChars) override
	{
		KviKvsVariant ret;
		KviKvsVariantList par;
		par.setAutoDelete(true);
		par.append(new KviKvsVariant(szChars));
		if(!m_pReader->callFunction(m_pReader, "onText", &ret, &par))
			return kvsCodeFailure();
		return handleKvsCallReturnValue(&ret);
	}
开发者ID:CardinalSins,项目名称:KVIrc,代码行数:10,代码来源:KvsObject_xmlreader.cpp

示例3: endElement

	bool endElement(const QString & szNamespaceUri, const QString & szLocalName, const QString & szQualifiedName) override
	{
		KviKvsVariant ret;
		KviKvsVariantList par;
		par.setAutoDelete(true);
		par.append(new KviKvsVariant(szQualifiedName));
		par.append(new KviKvsVariant(szNamespaceUri));
		par.append(new KviKvsVariant(szLocalName));
		if(!m_pReader->callFunction(m_pReader, "onElementEnd", &ret, &par))
			return kvsCodeFailure();
		return handleKvsCallReturnValue(&ret);
	}
开发者ID:CardinalSins,项目名称:KVIrc,代码行数:12,代码来源:KvsObject_xmlreader.cpp

示例4: error

	bool error(const QXmlParseException & exception) override
	{
		// recoverable
		QString szMsg;
		decodeException(szMsg, false, exception);

		KviKvsVariant ret;
		KviKvsVariantList par;
		par.setAutoDelete(true);
		par.append(new KviKvsVariant(szMsg));
		if(!m_pReader->callFunction(m_pReader, "onWarning", &ret, &par))
			return kvsCodeFailure();
		return handleKvsCallReturnValue(&ret);
	}
开发者ID:CardinalSins,项目名称:KVIrc,代码行数:14,代码来源:KvsObject_xmlreader.cpp

示例5: execute

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

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

	c->setDefaultReportLocation(this);

	return m_pExecRoutine->proc(c,&l,&swl);
}
开发者ID:namikaze90,项目名称:KVIrc-old,代码行数:16,代码来源:KviKvsTreeNodeCoreSimpleCommand.cpp

示例6: startElement

	bool startElement(const QString & szNamespaceUri, const QString & szLocalName, const QString & szQualifiedName, const QXmlAttributes & attrs) override
	{
		KviKvsVariant ret;
		KviKvsVariantList par;
		par.setAutoDelete(true);
		par.append(new KviKvsVariant(szQualifiedName));
		KviKvsHash * pHash = new KviKvsHash();
		par.append(new KviKvsVariant(pHash));
		par.append(new KviKvsVariant(szNamespaceUri));
		par.append(new KviKvsVariant(szLocalName));
		int c = attrs.count();
		for(int i = 0; i < c; i++)
			pHash->set(attrs.qName(i), new KviKvsVariant(attrs.value(i)));
		if(!m_pReader->callFunction(m_pReader, "onElementStart", &ret, &par))
			return kvsCodeFailure();
		return handleKvsCallReturnValue(&ret);
	}
开发者ID:CardinalSins,项目名称:KVIrc,代码行数:17,代码来源:KvsObject_xmlreader.cpp

示例7:

KviKvsObject * KviKvsObjectClass::allocateInstance(KviKvsObject * pParent,const QString &szName,KviKvsRunTimeContext * pContext,KviKvsVariantList * pParams)
{
	if(!m_allocProc)
		return 0;

	KviKvsObject * pObject = m_allocProc(this,pParent,szName);
	if(!pObject)
		return 0;

	if(!pObject->init(pContext,pParams))
	{
		// internal init failure : abort
		pObject->dieNow();
		return 0;
	}

	// copy params
	KviKvsVariantList copy;
	copy.setAutoDelete(false);

	KviKvsVariant * v = pParams->first();

	while(v)
	{
		copy.append(v);
		v = pParams->next();
	}
	KviKvsVariant ret;

	if(!pObject->callFunction(pObject,"constructor",QString(),pContext,&ret,&copy))
	{
		// ops...constructor failed (script error!)
		pObject->dieNow();
		return 0;
	}
	
	if(!ret.isEmpty())
		pContext->warning(__tr2qs_ctx("It's not allowed to return values in the constructor","kvs"));

	return pObject;
}
开发者ID:netrunner-debian-kde-extras,项目名称:kvirc,代码行数:41,代码来源:KviKvsObjectClass.cpp

示例8: execute

bool KviKvsTreeNodeSpecialCommandForeach::execute(KviKvsRunTimeContext * c)
{
    KviKvsVariantList l;
    l.setAutoDelete(true);
    if(!m_pIterationData->evaluate(c,&l))
        return false;

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

    bool bIncludeEmptyScalars = swl.find('a',"all") != 0;

    for(KviKvsVariant * pArg = l.first(); pArg; pArg = l.next())
    {
        switch(pArg->type())
        {
        case KviKvsVariantData::Array:
        {
            unsigned int uCnt = pArg->array()->size();
            unsigned int idx = 0;
            while(idx < uCnt)
            {
                // we evaluate this each time (as it may actually be killed at each iteration)
                // FIXME: maybe some kind of reference counting or a observer pattern might be a bit more efficient here
                //        (but might be far less efficient everywhere else...)
                KviKvsRWEvaluationResult * v = m_pIterationVariable->evaluateReadWrite(c);
                if(!v)
                    return false;
                KviKvsVariant * pOne = pArg->array()->at(idx);
                if(pOne)
                {
                    if(bIncludeEmptyScalars || (!pOne->isEmpty()))
                    {
                        v->result()->copyFrom(*pOne);
                    } else {
                        delete v; // we're done with it for this iteration
                        idx++;
                        continue;
                    }
                } else {
                    if(bIncludeEmptyScalars)
                    {
                        v->result()->setNothing();
                    } else {
                        delete v; // we're done with it for this iteration
                        idx++;
                        continue;
                    }

                }
                delete v; // we're done with it for this iteration

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

                    // break allowed!
                    if(c->breakPending())
                    {
                        c->handleBreak();
                        return true;
                    }

                    if(c->continuePending())
                    {
                        c->handleContinue();
                        idx++;
                        continue;
                    }

                    return false; // propagate the false return value
                }

                idx++;
            }
        }
        break;
        case KviKvsVariantData::Hash:
        {
            KviKvsHashIterator it(*(pArg->hash()->dict()));
            while(KviKvsVariant * pOne = it.current())
            {
                // we evaluate this each time (as it may actually be killed at each iteration)
                // FIXME: maybe some kind of reference counting or a observer pattern might be a bit more efficient here
                //        (but might be far less efficient everywhere else...)
                KviKvsRWEvaluationResult * v = m_pIterationVariable->evaluateReadWrite(c);
                if(!v)
                    return false;

                if(bIncludeEmptyScalars || (!pOne->isEmpty()))
                {
                    v->result()->copyFrom(*pOne);
                } else {
                    delete v; // we're done with it for this iteration
                    ++it;
//.........这里部分代码省略.........
开发者ID:kartagis,项目名称:KVIrc,代码行数:101,代码来源:KviKvsTreeNodeSpecialCommandForeach.cpp

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


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