本文整理汇总了C++中expression::List类的典型用法代码示例。如果您正苦于以下问题:C++ List类的具体用法?C++ List怎么用?C++ List使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了List类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BindExpression
Expression* InterpreterEmulator::InterpreterExpressionVisitor::VisitBind(Expression::List const& rExprList)
{
Expression::List SmplExprList;
for (Expression* pExpr : rExprList)
SmplExprList.push_back(pExpr->Visit(this));
return new BindExpression(SmplExprList);
}
示例2: typeCheck
Expression::Ptr ElementConstructor::typeCheck(const StaticContext::Ptr &context,
const SequenceType::Ptr &reqType)
{
/* What does this code do? When type checking our children, our namespace
* bindings, which are also children of the form of NamespaceConstructor
* instances, must be statically in-scope for them, so find them and
* shuffle their bindings into the StaticContext. */
m_staticBaseURI = context->baseURI();
/* Namespace declarations changes the in-scope bindings, so let's
* first lookup our child NamespaceConstructors. */
const ID operandID = m_operand2->id();
NamespaceResolver::Bindings overrides;
if(operandID == IDExpressionSequence)
{
const Expression::List operands(m_operand2->operands());
const int len = operands.count();
for(int i = 0; i < len; ++i)
{
if(operands.at(i)->is(IDNamespaceConstructor))
{
const QXmlName &nb = operands.at(i)->as<NamespaceConstructor>()->namespaceBinding();
overrides.insert(nb.prefix(), nb.namespaceURI());
}
}
}
const NamespaceResolver::Ptr newResolver(new DelegatingNamespaceResolver(context->namespaceBindings(), overrides));
const StaticContext::Ptr augmented(new StaticNamespaceContext(newResolver, context));
return PairContainer::typeCheck(augmented, reqType);
}
示例3: typeCheck
Expression::Ptr ElementConstructor::typeCheck(const StaticContext::Ptr &context,
const SequenceType::Ptr &reqType)
{
m_staticBaseURI = context->baseURI();
/* Namespace declarations changes the in-scope bindings, so let's
* first lookup our child NamespaceConstructors. */
const ID operandID = m_operand2->id();
NamespaceResolver::Bindings overrides;
if(operandID == IDExpressionSequence)
{
const Expression::List operands(m_operand2->operands());
const int len = operands.count();
for(int i = 0; i < len; ++i)
{
if(operands.at(i)->is(IDNamespaceConstructor))
{
const QXmlName &nb = operands.at(i)->as<NamespaceConstructor>()->namespaceBinding();
overrides.insert(nb.prefix(), nb.namespaceURI());
}
}
}
const NamespaceResolver::Ptr newResolver(new DelegatingNamespaceResolver(context->namespaceBindings(), overrides));
const StaticContext::Ptr augmented(new StaticNamespaceContext(newResolver, context));
return PairContainer::typeCheck(augmented, reqType);
}
示例4: setOperands
void TripleContainer::setOperands(const Expression::List &ops)
{
Q_ASSERT(ops.count() == 3);
m_operand1 = ops.first();
m_operand2 = ops.at(1);
m_operand3 = ops.at(2);
}
示例5: BindExpression
Expression* InterpreterEmulator::InterpreterExpressionVisitor::VisitBind(Expression::List const& rExprList)
{
Expression::List SmplExprList;
for (auto itExpr = std::begin(rExprList); itExpr != std::end(rExprList); ++itExpr)
SmplExprList.push_back((*itExpr)->Visit(this));
return new BindExpression(SmplExprList);
}
示例6: typeCheck
Expression::Ptr OrderBy::typeCheck(const StaticContext::Ptr &context,
const SequenceType::Ptr &reqType)
{
m_returnOrderBy->setStay(true);
/* It's important we do the typeCheck() before calling OrderSpec::prepare(), since
* atomizers must first be inserted. */
const Expression::Ptr me(SingleContainer::typeCheck(context, reqType));
const Expression::List ops(m_returnOrderBy->operands());
const int len = ops.count();
Q_ASSERT(ops.count() > 1);
Q_ASSERT(m_orderSpecs.count() == ops.count() - 1);
for(int i = 1; i < len; ++i)
m_orderSpecs[i - 1].prepare(ops.at(i), context);
return me;
/* It's not meaningful to sort a single item or less, so rewrite ourselves
* away if that is the case. This is an optimization. */
/* TODO: How do we remove ReturnOrderBy?
if(Cardinality::zeroOrOne().isMatch(m_operand->staticType()->cardinality()))
return m_operand->typeCheck(context, reqType);
else
return SingleContainer::typeCheck(context, reqType);
*/
}
示例7: ParseNonAmbiguousExpression
Expression::Ptr ParseNonAmbiguousExpression(const string& code)
{
auto item = make_shared<GrammarStackItem>();
item->FillPredefinedSymbols();
auto stack = make_shared<GrammarStack>();
stack->Push(item);
CodeToken::List tokens;
GrammarStack::ResultList result;
Tokenize(code, tokens);
stack->ParseExpression(tokens.begin(), tokens.end(), result);
Expression::List fullExpressions;
for (auto r : result)
{
if (r.first == tokens.end())
{
fullExpressions.push_back(r.second);
}
}
TEST_ASSERT(fullExpressions.size() == 1);
return fullExpressions[0];
}
示例8: operands
Expression::List PairContainer::operands() const
{
Expression::List list;
list.append(m_operand1);
list.append(m_operand2);
return list;
}
示例9: operands
Expression::List TripleContainer::operands() const
{
Expression::List result;
result.append(m_operand1);
result.append(m_operand2);
result.append(m_operand3);
return result;
}
示例10: setOperands
void PairContainer::setOperands(const Expression::List &ops)
{
Q_ASSERT(ops.count() == 2);
m_operand1 = ops.first();
m_operand2 = ops.last();
Q_ASSERT(m_operand1);
Q_ASSERT(m_operand2);
}
示例11: BindExpression
Expression *BindExpression::Clone(void) const
{
Expression::List ExprListCloned;
std::for_each(std::begin(m_Expressions), std::end(m_Expressions), [&](Expression *pExpr)
{
ExprListCloned.push_back(pExpr->Clone());
});
return new BindExpression(ExprListCloned);
}
示例12: checkArgumentsCircularity
void CallTargetDescription::checkArgumentsCircularity(CallTargetDescription::List &signList,
const Expression::Ptr callsite)
{
/* Check the arguments. */
const Expression::List ops(callsite->operands());
const Expression::List::const_iterator end(ops.constEnd());
Expression::List::const_iterator it(ops.constBegin());
for(; it != end; ++it)
checkCallsiteCircularity(signList, *it);
}
示例13: typeCheckOperands
void Expression::typeCheckOperands(const StaticContext::Ptr &context)
{
const Expression::List ops(operands());
/* Check if this expression has any operands at all. */
if(ops.isEmpty())
return; /* We're done, early exit. */
const SequenceType::List opTypes(expectedOperandTypes());
Expression::List result;
/* If we create a focus, we handle the last one specially, so avoid it in the loop. */
const bool createsFocus = has(CreatesFocusForLast);
const SequenceType::List::const_iterator typeEnd(createsFocus ? --opTypes.constEnd()
: opTypes.constEnd());
const Expression::List::const_iterator end(createsFocus ? --ops.constEnd()
: ops.constEnd());
SequenceType::List::const_iterator reqType(opTypes.constBegin());
SequenceType::Ptr t(*reqType);
// TODO we assign twice to t here(also below in loop) when ops.size() > 1
Expression::List::const_iterator it(ops.constBegin());
for(; it != end; ++it)
{
/* This ensures that the last expectedOperandType stays, and is
* used for all other operands. This is used for expressions that
* have an infinite amount of operands, such as the concat() function. */
if(reqType != typeEnd)
{
t = *reqType;
++reqType;
}
/* Let the child & its children typecheck. */
result.append((*it)->typeCheck(context, t));
}
if(createsFocus)
{
const StaticContext::Ptr newContext(finalizeStaticContext(context));
result.append(ops.last()->typeCheck(newContext, opTypes.last()));
}
setOperands(result);
}
示例14: UnlimitedContainer
ReturnOrderBy::ReturnOrderBy(const OrderBy::Stability aStability,
const OrderBy::OrderSpec::Vector &oSpecs,
const Expression::List &ops) : UnlimitedContainer(ops)
, m_stability(aStability)
, m_orderSpecs(oSpecs)
, m_flyAway(true)
{
Q_ASSERT_X(m_operands.size() >= 2, Q_FUNC_INFO,
"ReturnOrderBy must have the return expression, and at least one sort key.");
Q_ASSERT(m_orderSpecs.size() == ops.size() - 1);
}
示例15: retrieveExpression
Expression::Ptr ConstructorFunctionsFactory::retrieveExpression(const QXmlName name,
const Expression::List &args,
const FunctionSignature::Ptr &sign) const
{
Q_UNUSED(sign);
/* This function is only called if the callsite is valid, so createSchemaType() will always
* return an AtomicType. */
const AtomicType::Ptr at(static_cast<AtomicType *>(m_typeFactory->createSchemaType(name).data()));
return Expression::Ptr(new CastAs(args.first(),
makeGenericSequenceType(at,
Cardinality::zeroOrOne())));
}