本文整理汇总了C++中CVariant::Merge方法的典型用法代码示例。如果您正苦于以下问题:C++ CVariant::Merge方法的具体用法?C++ CVariant::Merge怎么用?C++ CVariant::Merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVariant
的用法示例。
在下文中一共展示了CVariant::Merge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddCallRes
CVariant CKadOperation::AddCallRes(const CVariant& CallRes, CKadNode* pNode)
{
SOpProgress* pProgress = GetProgress(pNode);
CVariant FilteredRes = CallRes.Clone(false); // Make a Shellow Copy
const CVariant& Results = CallRes["RET"];
CVariant Filtered;
for(uint32 i=0; i < Results.Count(); i++)
{
CVariant Result = Results.At(i).Clone(false); // Make a Shellow Copy
const CVariant& XID = Result["XID"];
// this checks if this particular response is the last and and if this node is done
if(pProgress) // might be NULL if we filter our own index response right now
{
SOpStatus &Status = pProgress->Calls[XID];
Status.Results++;
if(!Result.Get("MORE"))
Status.Done = true; // this marks that no more results are to be expected form this node
}
SOpStatus* pStatus = NULL;
TCallOpMap::iterator I = m_CallMap.find(XID);
if(I != m_CallMap.end())
{
pStatus = &I->second.Status;
pStatus->Results++; // count the response even if it gets filtered lateron
if(!pStatus->Done)
pStatus->Done = IsDone(SOpProgress::GetCalls, XID);
}
if(m_pOperator)
{
CKadOperator::TRequestMap& ResuestMap = m_pOperator->GetRequests();
CKadOperator::TRequestMap::iterator I = ResuestMap.find(XID);
if(I != ResuestMap.end()) // this should not fail
{
SOpStatus* pAuxStatus = &I->second.Status;
pAuxStatus->Results++; // count the response even if it gets filtered lateron
if(!pAuxStatus->Done)
pAuxStatus->Done = IsDone(SOpProgress::GetCalls, XID);
}
}
if(!Result.Has("ERR"))
{
if(m_pOperator && m_pOperator->IsValid())
{
try
{
if(m_pOperator->AddCallRes(Result["RET"], XID))
continue; // intercepted response - Note: if we add a response to this request now it wil be marked as no more results if thats so
}
catch(const CJSException& Exception)
{
LogReport(Exception.GetFlag(), Exception.GetLine(), Exception.GetError());
}
}
}
//else
// LogLine(LOG_ERROR | LOG_DEBUG, L"Got Execution Error %s", Result["ERR"].To<wstring>().c_str());
// check if this is a call we issued, that is one not present in the call map, in that case its never to be relayed
if(pStatus)
{
// UpdateMore sets the "MORE" flag on the packet we relay further down to the source, and checks if we considder this request done
if(!pStatus->Done)
Result.Insert("MORE", true);
else
Result.Remove("MORE");
Filtered.Append(Result);
}
}
if(m_pOperator) // add new result to the filtered list
Filtered.Merge(m_pOperator->GetResponses());
FilteredRes.Insert("RET", Filtered);
return FilteredRes;
}