本文整理汇总了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;
}
示例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;
}