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


C++ ZTuple类代码示例

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


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

示例1: sHandle_PROPFIND_Some

static void sHandle_PROPFIND_Some(const ZTrail& iPrefix, const ZNode& iRoot, const ZNode& iNode, int iDepth, const vector<string>& iPropNames, ZTuple& ioTuple)
	{
	for (DAVIter i = DAVIter(iNode, iDepth); i; i.Advance())
		{
		ZNode theNode = i.Current();
		if (theNode.Exists())
			{
			ZTuple goodT, badT;
			sGetProperties(theNode, iPropNames, goodT, badT);

			ZTuple responseT;
			responseT.SetString("D:href", sMakeHREF(iPrefix, iRoot, theNode));

			if (goodT)
				{
				goodT.SetString("D:status", "HTTP/1.1 200 OK");
				responseT.AppendTuple("D:propstat", goodT);
				}

			if (badT)
				{
				badT.SetString("D:status", "HTTP/1.1 404 Not Found");
				responseT.AppendTuple("D:propstat", badT);
				}
			
			ioTuple.AppendTuple("D:response", responseT);
			}
		}
	}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例2: sHandle_PROPFIND_All

static void sHandle_PROPFIND_All(const ZTrail& iPrefix, const ZNode& iRoot, const ZNode& iNode, int iDepth, ZTuple& ioTuple)
	{
	vector<string> thePropNames;
	thePropNames.push_back("D:resourcetype");
	thePropNames.push_back("D:getcontenttype");
	thePropNames.push_back("D:creationdate");
	thePropNames.push_back("D:getlastmodified");
	thePropNames.push_back("D:getcontentlength");

	for (DAVIter i = DAVIter(iNode, iDepth); i; i.Advance())
		{
		ZNode theNode = i.Current();
		if (theNode.Exists())
			{
			ZTuple goodT, badT;
			sGetProperties(theNode, thePropNames, goodT, badT);

			ZTuple responseT;
			responseT.SetString("D:href", sMakeHREF(iPrefix, iRoot, theNode));

			if (goodT)
				{
				goodT.SetString("D:status", "HTTP/1.1 200 OK");
				responseT.AppendTuple("D:propstat", goodT);
				}
			
			ioTuple.AppendTuple("D:response", responseT);
			}
		}
	}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例3: sCriterionUnionToTuple

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;
	}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例4: AsTuple

ZTuple ZTBQueryNode_ID_Constant::AsTuple()
	{
	ZTuple theTuple;
	theTuple.SetString("Kind", "ID_Constant");
	theTuple.SetVector_T("IDs", fIDs.begin(), fIDs.end());
	return theTuple;
	}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例5: switch

bool ZUITextEngine::MenuMessage(const ZMessage& inMessage)
	{
	switch (inMessage.GetInt32("menuCommand"))
		{
		case mcCopy:
		case mcCut:
			{
			size_t selectStart, selectLength;
			this->GetSelection(selectStart, selectLength);
			if (selectLength != 0)
				{
				if (inMessage.GetInt32("menuCommand") == mcCopy || this->IsRangeEditable(selectStart, selectLength))
					{
					ZTuple theTuple = this->GetTuple(selectStart, selectLength);
					ZClipboard::sSet(theTuple);
					if (inMessage.GetInt32("menuCommand") == mcCut)
						this->DeleteText(selectStart, selectLength);
					}
				}
			return true;
			break;
			}
		case mcClear:
			{
			size_t selectStart, selectLength;
			this->GetSelection(selectStart, selectLength);
			if (selectLength != 0 && this->IsRangeEditable(selectStart, selectLength))
				{
				this->DeleteText(selectStart, selectLength);
				return true;
				}
			return true;
			break;
			}
		case mcPaste:
			{
			size_t selectStart, selectLength;
			this->GetSelection(selectStart, selectLength);
			if (this->IsRangeEditable(selectStart, selectLength))
				{
				ZTuple theTuple = ZClipboard::sGet();
				if (theTuple.Has("text/plain"))
					{
					this->ReplaceSelection(theTuple.GetString("text/plain"));
					return true;
					}
				}
			return true;
			break;
			}
		case mcSelectAll:
			{
			this->SetSelection(0, this->GetTextLength());
			return true;
			}
		}
	return false;
	}
开发者ID:,项目名称:,代码行数:58,代码来源:

示例6:

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;
	}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例7: ZTBSpec

ZTBQueryNode_Combo::Intersection::Intersection(const ZTuple& iTuple)
	{
	fFilter = ZTBSpec(iTuple.GetTuple("Filter"));
	const vector<ZTupleValue>& nodes = iTuple.GetVector("Nodes");
	for (vector<ZTupleValue>::const_iterator i = nodes.begin(); i != nodes.end(); ++i)
		{
		if (ZRef<ZTBQueryNode> aNode = sNodeFromTuple((*i).GetTuple()))
			fNodes.push_back(aNode);
		}
	}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例8: sGetProperties

static void sGetProperties(const ZNode& iNode, const vector<string>& iPropNames, ZTuple& oGoodT, ZTuple& oBadT)
	{
 	for (vector<string>::const_iterator i = iPropNames.begin(); i != iPropNames.end(); ++i)
 		{
 		if (ZTuple propT = sGetProp(iNode, *i))
			oGoodT.AppendTuple("D:prop", propT);
 		else
 			oBadT.AppendTuple("D:prop", ZTuple().SetNull(*i));
 		}
	}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例9: sGetStringAt

static bool sGetStringAt(const ZTuple& iTuple, const string& iName, string& oString)
	{
	if (iTuple.GetString(iName, oString))
		return true;

	const vector<ZTupleValue>& theVector = iTuple.GetVector(iName);
	if (!theVector.empty())
		return theVector[0].GetString(oString);

	return false;
	}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例10: AcceptsDragDrop

bool ZUITextEngine::AcceptsDragDrop(const ZDragDropBase& inDragDrop)
	{
	bool gotIt = inDragDrop.GetDragSource() == this;
	for (size_t currentTupleIndex = 0; !gotIt && currentTupleIndex < inDragDrop.CountTuples(); ++currentTupleIndex)
		{
		ZTuple currentTuple = inDragDrop.GetTuple(currentTupleIndex);
		if (currentTuple.Has("text/plain"))
			gotIt = true;
		}
	return gotIt;
	}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例11: sStringFromRel

ZTuple ZTBSpec::Criterion::Rep::AsTuple() const
	{
	ZTuple result;
	result.SetString("PropName", fPropName.AsString());
	result.SetString("Rel", sStringFromRel(fComparator.fRel));
	if (fComparator.fStrength)
		result.SetInt32("Strength", fComparator.fStrength);
	if (fTupleValue)
		result.SetValue("Value", fTupleValue);
	return result;
	}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例12: InvalidateAllMenuBars

void ZApp::InvalidateAllMenuBars()
	{
	// We don't need to be locked to broadcast this message
	ZTuple theTuple;
	theTuple.SetString("what", "zoolib:InvalidateAllMenuBars");

	ZMessage envelope;
	envelope.SetString("what", "zoolib:Owner");
	envelope.SetTuple("message", theTuple);

	fOSApp->BroadcastMessageToAllWindows(envelope);
	}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例13: sGetDepth

bool ZWebDAV::sHandle_PROPFIND(const ZTrail& iPrefix, ZNode iRoot, const ZStreamR& iStreamR, const ZStreamW& iStreamW, const ZTuple& iHeader, const ZTrail& iTrail, const ZTuple& iParam)
	{
	int depth = sGetDepth(iHeader);

	ZRef<ZStrimmerR> theStrimmerR = sMakeStrimmer(iHeader, iStreamR);
	const ZStrimR& theStrimR = theStrimmerR->GetStrimR();

	ZHTTP::Response r;
	r.Set("Date", sAsString_WebDAV(ZTime::sNow()));

	ZNode theNode = iRoot.Trail(iTrail);
	if (!theNode.Exists())
		{
		theStrimR.SkipAll();
		r.Set("Content-Length", 0);
		r.SetResult(404);
		r.Send(iStreamW);
		}
	else
		{		
		ZTuple t = sReadTuple(theStrimR);
		
		ZTuple results;
		if (t.Empty() || t.Has("D:allprop"))
			{
			sHandle_PROPFIND_All(iPrefix, iRoot, theNode, depth, results);
			}
		else
			{
			ZTuple propT = t.GetTuple("D:prop");
			vector<string> thePropNames;
			for (ZTuple::const_iterator i = propT.begin(); i != propT.end(); ++i)
				thePropNames.push_back(propT.NameOf(i));
			sHandle_PROPFIND_Some(iPrefix, iRoot, theNode, depth, thePropNames, results);
			}

		if (const ZLog::S& s = ZLog::S(ZLog::eDebug, "ZWebDAV"))
			{
			s << "PropFind Request:" << t << "\n";
			s << "PropFind Results:" << results << "\n";
			}

		r.SetResult(207, "Multi-Status");
		r.Set("Content-Type", "text/xml; charset=\"utf-8\"");
		r.Set("Transfer-Encoding", "chunked");		
		r.Send(iStreamW);

		ZHTTP::StreamW_Chunked chunkedStream(iStreamW);
		ZStrimW_StreamUTF8 theStrimW(chunkedStream);
		ZStrimW_ML s(false, theStrimW);
		s.PI("xml");
			s.Attr("version", "1.0");
			s.Attr("encoding", "utf-8");
		s.Begin("D:multistatus");
			s.Attr("xmlns:D", "DAV:");
			sWriteAsXML(s, results);
		s.End("D:multistatus");
		}
	return true;
	}
开发者ID:,项目名称:,代码行数:60,代码来源:

示例14: sHandle_MOVE

bool ZWebDAV::sHandle_MOVE(const ZTrail& iPrefix, ZNode iRoot, const ZStreamR&, const ZStreamW& iStreamW, const ZTuple& iHeader, const ZTrail& iTrail, const ZTuple& iParam)
	{
	ZHTTP::Response r;
	r.Set("date", sAsString_WebDAV(ZTime::sNow()));
	r.Set("Content-Length", 0);


	ZNode theNode = iRoot.Trail(iTrail);
	if (!theNode.Exists())
		{
		r.SetResult(404);
		}
	else
		{
		string thePath = sGetPathFromURL(ZHTTP::sGetString0(iHeader.GetValue("destination")));
		ZTrail theTrail = sStripPrefix(iPrefix, ZHTTP::sDecodeTrail(thePath));
		ZNode theDestNode = iRoot.Trail(theTrail);

		if (const ZLog::S& s = ZLog::S(ZLog::eInfo, "ZWebDAV::sHandle_MOVE"))
			{
			s << "thePath: " << thePath << "\n";
			s << "theTrail: " << theTrail.AsString() << "\n";
			}

		bool doneIt = false;
		if (!doneIt)
			doneIt = theNode.MoveTo(theDestNode);

//		if (!doneIt)
//			doneIt = theDestNode.MoveFrom(theNode);

		if (!doneIt)
			{
			if (ZRef<ZStreamerR> sourceStreamer = theNode.OpenR(false))
				{
				if (const ZLog::S& s = ZLog::S(ZLog::eInfo, "ZWebDAV::sHandle_MOVE"))
					s << "Got a source streamer, ";
				const ZStreamR& source = sourceStreamer->GetStreamR();
				if (ZRef<ZStreamerWPos> destStreamer = theDestNode.CreateWPos(true, false))
					{
					if (const ZLog::S& s = ZLog::S(ZLog::eInfo, "ZWebDAV::sHandle_MOVE"))
						s << "and a dest streamer";
					const ZStreamWPos& dest = destStreamer->GetStreamWPos();
					dest.Truncate();
					dest.CopyAllFrom(source);
					theNode.Delete();
					doneIt = true;
					}
				}
			}

		if (doneIt)
			r.SetResult(204);
		else
			r.SetResult(400);
		}

	r.Send(iStreamW);
	return true;
	}
开发者ID:,项目名称:,代码行数:60,代码来源:

示例15: sFromStrim_BodyOfTuple

static void sFromStrim_BodyOfTuple(const ZStrimU& iStrimU, ZTuple& oTuple)
{
    using namespace ZUtil_Strim;
    for (;;)
    {
        sSkip_WSAndCPlusPlusComments(iStrimU);

        string propertyName;
        if (!sTryRead_EscapedString(iStrimU, '"', propertyName))
        {
            if (!sTryRead_EscapedString(iStrimU, '\'', propertyName))
            {
                if (!ZUtil_Tuple::sRead_Identifier(iStrimU, nil, &propertyName))
                    break;
            }
        }

        sSkip_WSAndCPlusPlusComments(iStrimU);

        if (!sTryRead_CP(iStrimU, '='))
            throw ParseException("Expected '=' after property name");

        sSkip_WSAndCPlusPlusComments(iStrimU);

        ZTupleValue& theTupleValue = oTuple.SetMutableNull(propertyName);
        if (!sFromStrim_TupleValue(iStrimU, theTupleValue))
            throw ParseException("Expected a property value after '='");

        sSkip_WSAndCPlusPlusComments(iStrimU);

        if (!sTryRead_CP(iStrimU, ';') && !sTryRead_CP(iStrimU, ','))
            throw ParseException("Expected a ';' or a ',' after property value");
    }
}
开发者ID:,项目名称:,代码行数:34,代码来源:


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