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


C++ ZTuple::SetValue方法代码示例

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


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

示例1: 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,代码来源:

示例2: sReadTV

static ZTupleValue sReadTV(ZML::Reader& ml, const string& iName)
	{
	// We're sitting just after the begin tag. If there is any
	// text, suck it into a string and move on.
	if (ml.Current() == ZML::eToken_Text)
		{
		string allText;
		ZStrimW_String(allText).CopyAllFrom(ml.Text());
		ml.Advance();
		if (ml.Current() == ZML::eToken_TagEnd)
			{
			// We've hit an end tag, so the begin/end tags were wrapping a text value.
			if (iName != ml.Name())
				throw runtime_error("Tags don't match. Wanted: " + iName + ", Got: " + ml.Name());
			ml.Advance();
			return allText;
			}
		// The text following the begin tag was spurious -- it's not representable
		// in the simplified tuple we're building, so we'll just ignore it.
		}

	// Accumulate all child tags into a tuple to be returned.
	ZTuple result;
	for (;;)
		{
		if (ml.Current() == ZML::eToken_TagBegin)
			{
			// We have a nested begin tag. Grab its name and recurse.
			string name = ml.Name();
			ml.Advance();
			ZTupleValue theTV = sReadTV(ml, name);
			result.SetValue(name, theTV);
			}
		else if (ml.Current() == ZML::eToken_TagEmpty)
			{
			// We have a nested empty tag -- we represent them as null values.
			string name = ml.Name();
			ml.Advance();
			result.SetValue(name, ZTupleValue());
			}
		else if (ml.Current() == ZML::eToken_Text)
			{
			// We've got some text, but it's interspersed with other
			// tags and thus doesn't fit our model -- ignore it.
			ml.Advance();
			}
		else if (ml.Current() == ZML::eToken_TagEnd)
			{
			if (iName != ml.Name())
				throw runtime_error("Tags don't match. Wanted: " + iName + ", Got: " + ml.Name());
			// We've hit the end tag for the tuple, so we
			// consume it and break out of the loop.
			ml.Advance();
			break;
			}
		else
			{
			// We've hit the end of the reader, so we also exit the loop.
			break;
			}
		}
	return result;
	}
开发者ID:,项目名称:,代码行数:63,代码来源:


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