本文整理汇总了C++中item::Ptr::isAtomicValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::isAtomicValue方法的具体用法?C++ Ptr::isAtomicValue怎么用?C++ Ptr::isAtomicValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类item::Ptr
的用法示例。
在下文中一共展示了Ptr::isAtomicValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: next
Item::Ptr PromoteAnyURIResult::next(DynamicContext *context)
{
Item::Ptr item = parent_->next(context);
if(item.notNull()) {
assert(item->isAtomicValue());
const AnyAtomicType *atomic = (const AnyAtomicType *)item.get();
// 4. For each item of type xs:anyURI in the atomic sequence that can be promoted to the expected atomic
// type using URI promotion as described in B.1 Type Promotion, the promotion is done.
if(atomic->getPrimitiveTypeIndex() == AnyAtomicType::ANY_URI) {
try {
item = atomic->castAs(AnyAtomicType::STRING, context);
} catch (XPath2TypeCastException &e) {
XQThrow(XPath2ErrorException, X("SequenceType::AtomicTypeConvertFunctionArgResult::next"),
X("AnyURI type promotion failed (for promotable type)"));
} catch (const XMLException& e) {
XQThrow(XPath2ErrorException, X("SequenceType::AtomicTypeConvertFunctionArgResult::next"),
X("AnyURI type promotion failed (for promotable type)"));
}
}
}
else {
parent_ = 0;
}
return item;
}
示例2: getNumericParam
Numeric::Ptr NumericFunction::getNumericParam(unsigned int number, DynamicContext *context, int flags) const
{
Result arg = XQFunction::getParamNumber(number, context, flags);
Item::Ptr item = arg->next(context);
if(item.isNull()) {
return 0;
}
else if(item->isAtomicValue() && ((const AnyAtomicType *)item.get())->isNumericValue()) {
return (const Numeric *)item.get();
} else {
XQThrow(FunctionException,X("NumericFunction::getParamNumber"), X("Non-numeric argument in numeric function [err:XPTY0004]"));
}
}
示例3: matches
bool SequenceType::ItemType::matches(const Item::Ptr &toBeTested, DynamicContext* context) const
{
if(toBeTested->isNode())
return matches((const Node::Ptr)toBeTested, context);
switch(m_nTestType) {
case TEST_ELEMENT:
case TEST_ATTRIBUTE:
case TEST_SCHEMA_ELEMENT:
case TEST_SCHEMA_ATTRIBUTE:
case TEST_NODE:
case TEST_PI:
case TEST_COMMENT:
case TEST_TEXT:
case TEST_DOCUMENT:
case TEST_SCHEMA_DOCUMENT:
{
return false;
}
case TEST_ANYTHING:
{
return true;
}
case TEST_ATOMIC_TYPE:
{
if(!toBeTested->isAtomicValue()) return false;
return matchesNameType(toBeTested, context);
}
case TEST_FUNCTION:
{
if(!toBeTested->isFunction()) return false;
if(returnType_ == 0) return true;
FunctionRef *func = (FunctionRef*)toBeTested.get();
if(func->getNumArgs() != argTypes_->size()) return false;
return true;
}
}
return true;
}
示例4: return
bool SequenceType::ItemType::matchesNameType(const Item::Ptr &toBeTested, const DynamicContext* context) const
{
// Check name constraint
if(m_pName) {
if(toBeTested->isNode()) {
ATQNameOrDerived::Ptr name = ((const Node*)(const Item*)toBeTested)->dmNodeName(context);
if(name.isNull()) return false;
// Match node name
if(!(XPath2Utils::equals(m_pName->getName(), ((const ATQNameOrDerived*)name.get())->getName())))
return false;
// Match node uri
if(!(XPath2Utils::equals(m_NameURI, ((const ATQNameOrDerived*)name.get())->getURI())))
return false;
}
else return false;
}
//A named atomic type matches a value if the dynamic type of the
//value is the same as the named atomic type or is derived from the
//named atomic type by restriction. For example, the ItemType
//xs:decimal matches the value 12.34 (a decimal literal); it also
//matches a value whose dynamic type is shoesize, if shoesize is an
//atomic type derived from xs:decimal.
if(m_pType) {
if(toBeTested->isAtomicValue()) {
return ((AnyAtomicType*)toBeTested.get())->isInstanceOfType(m_TypeURI, m_pType->getName(), context);
} else if (toBeTested->isNode()) {
return ((Node*)toBeTested.get())->hasInstanceOfType(m_TypeURI, m_pType->getName(), context);
}
return false;
}
return true;
}
示例5: equals
/*static*/ bool Equals::equals(const Item::Ptr &arg1, const Item::Ptr &arg2, Collation* collation, DynamicContext* context, const LocationInfo *info)
{
assert(arg1->isAtomicValue() && arg2->isAtomicValue());
return equals((const AnyAtomicType::Ptr)arg1, (const AnyAtomicType::Ptr)arg2, collation, context, info);
}