Esempio n. 1
0
static ZTuple sCriterionUnionToTuple(const ZTBSpec::CriterionUnion& iCriterionUnion)
	{
	ZTuple result;

	vector<ZTupleValue>& outerVector = result.SetMutableVector("Criteria");
	outerVector.reserve(iCriterionUnion.size());
	outerVector.resize(iCriterionUnion.size());
	vector<ZTupleValue>::iterator outerIter = outerVector.begin();

	for (ZTBSpec::CriterionUnion::const_iterator critListIter = iCriterionUnion.begin(),
		critListEnd = iCriterionUnion.end();
		critListIter != critListEnd;
		++critListIter, ++outerIter)
		{
		vector<ZTupleValue>& innerVector = (*outerIter).SetMutableVector();
		for (ZTBSpec::CriterionSect::const_iterator i = (*critListIter).begin(),
			theEnd = (*critListIter).end();
			i != theEnd; ++i)
			{
			ZTuple aTuple = (*i).AsTuple();
			innerVector.push_back(aTuple);
			}
		}
	return result;
	}
Esempio n. 2
0
ZTuple ZTBQueryNode_Combo::Intersection::AsTuple() const
	{
	ZTuple result;
	result.SetTuple("Filter", fFilter.AsTuple());
	vector<ZTupleValue>& destVec = result.SetMutableVector("Nodes");
	for (vector<ZRef<ZTBQueryNode> >::const_iterator i = fNodes.begin(); i != fNodes.end(); ++i)
		destVec.push_back(sTupleFromNode(*i));
	return result;
	}
Esempio n. 3
0
ZTuple ZTBQueryNode_Combo::AsTuple()
	{
	ZTuple result;
	result.SetString("Kind", "Combo");

	if (!fSort.empty())
		{
		vector<ZTupleValue>& sortVector = result.SetMutableVector("Sort");
		for (vector<ZTBQuery::SortSpec>::iterator i = fSort.begin(); i != fSort.end(); ++i)
			{
			ZTuple theTuple;
			theTuple.SetString("PropName", (*i).fPropName.AsString());
			theTuple.SetBool("Ascending", (*i).fAscending);
			theTuple.SetInt32("Strength", (*i).fStrength);
			sortVector.push_back(theTuple);
			}
		}

	vector<ZTupleValue>& sectVector = result.SetMutableVector("Intersections");
	for (vector<Intersection>::iterator i = fIntersections.begin(); i != fIntersections.end(); ++i)
		sectVector.push_back((*i).AsTuple());

	return result;
	}