本文整理汇总了C++中anyatomictype::Ptr::castAsNoCheck方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::castAsNoCheck方法的具体用法?C++ Ptr::castAsNoCheck怎么用?C++ Ptr::castAsNoCheck使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类anyatomictype::Ptr
的用法示例。
在下文中一共展示了Ptr::castAsNoCheck方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: staticResolution
ASTNode* XQCastAs::staticResolution(StaticContext *context)
{
XPath2MemoryManager *mm = context->getMemoryManager();
_exprType->staticResolution(context);
const SequenceType::ItemType *itemType = _exprType->getItemType();
if(itemType != NULL) {
if((XPath2Utils::equals(itemType->getTypeURI(), XERCES_CPP_NAMESPACE_QUALIFIER SchemaSymbols::fgURI_SCHEMAFORSCHEMA) &&
XPath2Utils::equals(itemType->getType()->getName(), szNOTATION)) ||
(XPath2Utils::equals(itemType->getTypeURI(), FunctionConstructor::XMLChXPath2DatatypesURI) &&
XPath2Utils::equals(itemType->getType()->getName(), AnyAtomicType::fgDT_ANYATOMICTYPE)))
XQThrow(TypeErrorException,X("XQCastAs::CastAsResult::getSingleResult"),
X("The target type of a cast expression must be an atomic type that is in the in-scope schema types and is not xs:NOTATION or xdt:anyAtomicType [err:XPST0080]"));
}
if(_exprType->getItemTestType() != SequenceType::ItemType::TEST_ATOMIC_TYPE)
XQThrow(TypeErrorException,X("XQCastAs::staticResolution"),X("Cannot cast to a non atomic type"));
_typeIndex = context->getItemFactory()->
getPrimitiveTypeIndex(_exprType->getTypeURI(),
_exprType->getConstrainingType()->getName(), _isPrimitive);
// If this is a cast to xs:QName or xs:NOTATION and the argument is a string literal
// evaluate immediately, since they aren't allowed otherwise
if((_typeIndex == AnyAtomicType::QNAME || _typeIndex == AnyAtomicType::NOTATION) &&
_expr->getType() == LITERAL &&
((XQLiteral*)_expr)->getPrimitiveType() == AnyAtomicType::STRING) {
AutoDelete<DynamicContext> dContext(context->createDynamicContext());
dContext->setMemoryManager(mm);
AnyAtomicType::Ptr item = (AnyAtomicType*)_expr->createResult(dContext)->next(dContext).get();
try {
if(_isPrimitive) {
item = item->castAsNoCheck(_typeIndex, 0, 0, dContext);
}
else {
item = item->castAsNoCheck(_typeIndex, _exprType->getTypeURI(),
_exprType->getConstrainingType()->getName(), dContext);
}
}
catch(XQException &e) {
if(e.getXQueryLine() == 0)
e.setXQueryPosition(this);
throw;
}
return XQLiteral::create(item, dContext, mm, this)->staticResolution(context);
}
_expr = new (mm) XQAtomize(_expr, mm);
_expr->setLocationInfo(this);
_expr = _expr->staticResolution(context);
return this;
}