本文整理汇总了C++中ZTuple::TypeOf方法的典型用法代码示例。如果您正苦于以下问题:C++ ZTuple::TypeOf方法的具体用法?C++ ZTuple::TypeOf怎么用?C++ ZTuple::TypeOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZTuple
的用法示例。
在下文中一共展示了ZTuple::TypeOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pTranslate_LocalToGlobal
void ZTS_Umbrella::pTranslate_LocalToGlobal(size_t iChildIndex, ZTuple& ioTuple)
{
for (ZTuple::const_iterator i = ioTuple.begin(), theEnd = ioTuple.end();
i != theEnd; ++i)
{
switch (ioTuple.TypeOf(i))
{
case eZType_ID:
{
uint64 globalID = this->pLocalToGlobal(iChildIndex, ioTuple.GetID(i));
ioTuple.SetID(i, globalID);
break;
}
case eZType_Tuple:
{
this->pTranslate_LocalToGlobal(iChildIndex, ioTuple.GetMutableTuple(i));
break;
}
case eZType_Vector:
{
vector<ZTupleValue>& theVector = ioTuple.GetMutableVector(i);
for (vector<ZTupleValue>::iterator j = theVector.begin(); j != theVector.end(); ++j)
{
if (eZType_ID == (*j).TypeOf())
{
uint64 globalID = this->pLocalToGlobal(iChildIndex, ioTuple.GetID(i));
(*j).SetID(globalID);
}
}
}
}
}
}
示例2: int
bool ZTBSpec::Criterion::Matches(const ZTuple& iTuple) const
{
ZTuple::const_iterator propIter = iTuple.IteratorOf(this->GetPropName());
if (propIter == iTuple.end())
{
// iTuple does not have a property named fPropName. For
// 'Lacks' and 'LacksOfType' relationships that means
// we match iTuple, for all other relationships we don't.
return this->GetComparator().fRel == eRel_Lacks
|| this->GetComparator().fRel == eRel_LacksOfType;
}
switch (this->GetComparator().fRel)
{
case eRel_Has:
{
return true;
}
case eRel_HasOfType:
{
return iTuple.TypeOf(propIter) == this->GetTupleValue().GetType();
}
case eRel_Lacks:
{
// iTuple has a property named fPropName,
// so it doesn't lack a property named fPropName.
return false;
}
case eRel_LacksOfType:
{
return iTuple.TypeOf(propIter) != this->GetTupleValue().GetType();
}
case eRel_VectorContains:
{
if (iTuple.TypeOf(propIter) != eZType_Vector)
return false;
const vector<ZTupleValue>& theVector = iTuple.GetVector(propIter);
for (vector<ZTupleValue>::const_iterator i = theVector.begin();
i != theVector.end(); ++i)
{
if (*i == this->GetTupleValue())
return true;
#if 0 //##
if ((*i).TypeOf() == this->GetTupleValue().TypeOf())
{
if ((*i).UncheckedEqual(this->GetTupleValue()))
return true;
}
#endif
}
return false;
}
case eRel_StringContains:
{
string pattern;
if (!this->GetTupleValue().GetString(pattern) || pattern.empty())
return true;
string target;
if (!iTuple.GetString(propIter, target) || target.empty())
return false;
if (!fRep->fTextCollator)
{
fRep->fTextCollator =
ZTextCollator(this->GetComparator().fStrength);
}
return fRep->fTextCollator.Contains(pattern, target);
}
case eRel_Regex:
{
#if ZCONFIG_API_Enabled(Regex)
string target;
if (!iTuple.GetString(propIter, target) || target.empty())
return false;
if (!fRep->fRegex)
{
fRep->fRegex =
ZRegex(this->GetTupleValue().GetString(), this->GetComparator().fStrength);
}
if (!fRep->fRegex)
return false;
return fRep->fRegex.Matches(target);
#else
return false;
#endif
}
default:
{
const ZTupleValue& leftValue = iTuple.GetValue(propIter);
ZType leftType = leftValue.TypeOf();
ZType rightType = this->GetTupleValue().TypeOf();
if (this->GetComparator().fRel == eRel_Equal)
{
if (leftType != rightType)
//.........这里部分代码省略.........