本文整理汇总了C++中staticcontext::Ptr::wrapExpressionWith方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::wrapExpressionWith方法的具体用法?C++ Ptr::wrapExpressionWith怎么用?C++ Ptr::wrapExpressionWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类staticcontext::Ptr
的用法示例。
在下文中一共展示了Ptr::wrapExpressionWith方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wrapAround
Expression::Ptr NodeSortExpression::wrapAround(const Expression::Ptr &operand,
const StaticContext::Ptr &context)
{
Q_ASSERT(operand);
Q_ASSERT(context);
const Expression::Ptr sort(new NodeSortExpression(operand));
context->wrapExpressionWith(operand.data(), sort);
return sort;
}
示例2: create
Expression::Ptr EmptySequence::create(const Expression *const replacementFor,
const StaticContext::Ptr &context)
{
Q_ASSERT(replacementFor);
Q_ASSERT(context);
const Expression::Ptr retval(new EmptySequence());
context->wrapExpressionWith(replacementFor, retval);
return retval;
}
示例3: typeCheck
Expression::Ptr IdFN::typeCheck(const StaticContext::Ptr &context,
const SequenceType::Ptr &reqType)
{
if(m_hasCreatedSorter)
return FunctionCall::typeCheck(context, reqType);
else
{
const Expression::Ptr newMe(new NodeSortExpression(Expression::Ptr(this)));
context->wrapExpressionWith(this, newMe);
m_hasCreatedSorter = true;
return newMe->typeCheck(context, reqType);
}
}
示例4: typeCheck
Expression::Ptr FunctionCall::typeCheck(const StaticContext::Ptr &context,
const SequenceType::Ptr &reqType)
{
/* We don't cache properties() at some stages because it can be invalidated
* by the typeCheck(). */
const FunctionSignature::Arity maxArgs = signature()->maximumArguments();
/* We do this before the typeCheck() such that the appropriate conversions
* are applied to the ContextItem. */
if(m_operands.count() < maxArgs &&
has(UseContextItem))
{
m_operands.append(Expression::Ptr(new ContextItem()));
context->wrapExpressionWith(this, m_operands.last());
}
const Expression::Ptr me(UnlimitedContainer::typeCheck(context, reqType));
if(me != this)
return me;
const Properties props(properties());
if(props.testFlag(RewriteToEmptyOnEmpty) &&
*CommonSequenceTypes::Empty == *m_operands.first()->staticType()->itemType())
{
return EmptySequence::create(this, context);
}
if(props.testFlag(LastOperandIsCollation) &&
m_operands.count() == maxArgs)
{
m_operands.last() = Expression::Ptr(new CollationChecker(m_operands.last()));
context->wrapExpressionWith(this, m_operands.last());
}
return me;
}
示例5: create
Expression::Ptr ByIDCreator::create(const Expression::ID id,
const Expression::List &operands,
const StaticContext::Ptr &context,
const SourceLocationReflection *const r)
{
Q_ASSERT(context);
QXmlName::LocalNameCode fnName;
switch(id)
{
case Expression::IDExistsFN:
{
fnName = StandardLocalNames::exists;
break;
}
case Expression::IDEmptyFN:
{
fnName = StandardLocalNames::empty;
break;
}
default:
{
Q_ASSERT_X(false, Q_FUNC_INFO,
"Cannot create an expression of requested type; m_id is wrong.");
return Expression::Ptr();
}
}
/* The reason we don't simply do 'new ExistsFN()' ourselves, is that all FunctionCall
* instances needs their FunctionSignature in order to function, and the FunctionFactories
* sets that. */
const QXmlName qName(StandardNamespaces::fn, fnName);
const Expression::Ptr result(context->functionSignatures()->createFunctionCall(qName, operands, context, r));
context->wrapExpressionWith(r, result);
return result;
}
示例6: verifyType
//.........这里部分代码省略.........
{
/* Atomization was sufficient. Either the expected type is xs:anyAtomicType
* or the type the Atomizer knows it returns, matches the required type. */
return result;
}
const bool compatModeEnabled = context->compatModeEnabled();
if((options.testFlag(AutomaticallyConvert) && BuiltinTypes::xsUntypedAtomic->xdtTypeMatches(operandType)) ||
(compatModeEnabled && BuiltinTypes::xsString->xdtTypeMatches(reqType)))
{
if(*reqType == *BuiltinTypes::numeric)
{
result = typeCheck(new UntypedAtomicConverter(result, BuiltinTypes::xsDouble, code),
context, reqSeqType);
}
else
result = typeCheck(new UntypedAtomicConverter(result, reqType, code), context, reqSeqType);
/* The UntypedAtomicConverter might know more about the type, so reload. */
operandType = result->staticType()->itemType();
}
else if(compatModeEnabled && *reqType == *BuiltinTypes::xsDouble)
{
const FunctionFactory::Ptr functions(context->functionSignatures());
Expression::List numberArgs;
numberArgs.append(operand);
result = functions->createFunctionCall(QXmlName(StandardNamespaces::fn, StandardLocalNames::number),
numberArgs,
context,
operand.data())->typeCheck(context, reqSeqType);
operandType = result->staticType()->itemType();
context->wrapExpressionWith(operand.data(), result);
}
if(reqType->xdtTypeMatches(operandType))
return result;
/* Test if promotion will solve it; the xdtTypeMatches didn't
* do that. */
if(options.testFlag(AutomaticallyConvert) && promotionPossible(operandType, reqType, context))
{
if(options.testFlag(GeneratePromotion))
return Expression::Ptr(new UntypedAtomicConverter(result, reqType));
else
return result;
}
if(operandType->xdtTypeMatches(reqType))
{
/* For example, operandType is numeric, and reqType is xs:integer. */
return Expression::Ptr(new ItemVerifier(result, reqType, code));
}
else
{
context->error(wrongType(context->namePool(), reqType, operandType), code, operand.data());
return result;
}
}
else if(reqType->isNodeType())
{
ReportContext::ErrorCode myCode;
if(*reqType == *CommonSequenceTypes::EBV->itemType())