Qt 4.8
Public Functions | Properties | List of all members
QPatternist::RangeVariableReference Class Reference

A reference to a variable declared with for or a quantification expression, but not for instance a let binding. More...

#include <qrangevariablereference_p.h>

Inheritance diagram for QPatternist::RangeVariableReference:
QPatternist::VariableReference QPatternist::EmptyContainer QPatternist::Expression QSharedData QPatternist::CppCastingHelper< Expression > QPatternist::SourceLocationReflection

Public Functions

virtual ExpressionVisitorResult::Ptr accept (const ExpressionVisitor::Ptr &visitor) const
 
virtual bool evaluateEBV (const DynamicContext::Ptr &context) const
 
virtual Item evaluateSingleton (const DynamicContext::Ptr &context) const
 
virtual ID id () const
 
virtual Properties properties () const
 
 RangeVariableReference (const Expression::Ptr &sourceExpression, const VariableSlotID slot)
 
virtual SequenceType::Ptr staticType () const
 
- Public Functions inherited from QPatternist::VariableReference
VariableSlotID slot () const
 
 VariableReference (const VariableSlotID slot)
 
- Public Functions inherited from QPatternist::EmptyContainer
virtual Expression::List operands () const
 
virtual void setOperands (const Expression::List &)
 
- Public Functions inherited from QPatternist::Expression
virtual const SourceLocationReflectionactualReflection () const
 Returns this. More...
 
virtual void announceFocusType (const ItemType::Ptr &itemType)
 
virtual Expression::Ptr compress (const StaticContext::Ptr &context)
 
Properties deepProperties () const
 Computes the union of properties for this Expression and all its descending children. More...
 
virtual Properties dependencies () const
 
virtual QString description () const
 
virtual Item::Iterator::Ptr evaluateSequence (const DynamicContext::Ptr &context) const
 
virtual void evaluateToSequenceReceiver (const DynamicContext::Ptr &context) const
 
virtual ItemType::Ptr expectedContextItemType () const
 
 Expression ()
 
bool has (const Property prop) const
 
bool hasDependency (const Property prop) const
 
bool is (const ID id) const
 
bool isEvaluated () const
 
virtual ItemType::Ptr newFocusType () const
 
virtual QList< QExplicitlySharedDataPointer< OptimizationPass > > optimizationPasses () const
 
virtual PatternPriority patternPriority () const
 
const Expression::Ptrrewrite (const Expression::Ptr &to, const StaticContext::Ptr &context) const
 Rewrites this Expression to to, and return to. More...
 
virtual Expression::Ptr typeCheck (const StaticContext::Ptr &context, const SequenceType::Ptr &reqType)
 
virtual ~Expression ()
 
- Public Functions inherited from QSharedData
 QSharedData ()
 Constructs a QSharedData object with a reference count of 0. More...
 
 QSharedData (const QSharedData &)
 Constructs a QSharedData object with reference count 0. More...
 
- Public Functions inherited from QPatternist::CppCastingHelper< Expression >
const TCastTarget * as () const
 
TCastTarget * as ()
 
- Public Functions inherited from QPatternist::SourceLocationReflection
virtual QSourceLocation sourceLocation () const
 
 SourceLocationReflection ()
 
virtual ~SourceLocationReflection ()
 

Properties

const Expression::Ptr m_sourceExpression
 

Additional Inherited Members

- Public Types inherited from QPatternist::VariableReference
typedef QList< VariableReference::PtrList
 
typedef QExplicitlySharedDataPointer< VariableReferencePtr
 
- Public Types inherited from QPatternist::Expression
typedef QExplicitlySharedDataPointer< const ExpressionConstPtr
 A smart pointer wrapping const Expression instances. More...
 
enum  ID {
  IDBooleanValue = 1, IDCountFN, IDEmptyFN, IDExistsFN,
  IDExpressionSequence, IDGeneralComparison, IDIfThenClause, IDIgnorableExpression,
  IDIntegerValue, IDPositionFN, IDStringValue, IDValueComparison,
  IDRangeVariableReference, IDContextItem, IDUserFunctionCallsite, IDExpressionVariableReference,
  IDAttributeConstructor, IDUpperCaseFN, IDLowerCaseFN, IDFirstItemPredicate,
  IDEmptySequence, IDReturnOrderBy, IDLetClause, IDForClause,
  IDPath, IDNamespaceConstructor, IDArgumentReference, IDGenericPredicate,
  IDAxisStep, IDFloat, IDCombineNodes, IDUnresolvedVariableReference,
  IDCardinalityVerifier
}
 
typedef QList< Expression::PtrList
 
typedef QFlags< PropertyProperties
 
enum  Property {
  UseContextItem = 1, DisableElimination = 1 << 1, IsEvaluated = 1 << 2, DisableTypingDeduction = 1 << 3,
  EmptynessFollowsChild = 1 << 4, RewriteToEmptyOnEmpty = 1 << 5, RequiresFocus = 1 << 6, AffectsOrderOnly = 1 << 7,
  RequiresContextItem = (1 << 8) | RequiresFocus, CreatesFocusForLast = 1 << 9, LastOperandIsCollation = 1 << 10, DependsOnLocalVariable = (1 << 11) | DisableElimination,
  EvaluationCacheRedundant = (1 << 12), IsNodeConstructor = 1 << 13, RequiresCurrentItem = 1 << 14
}
 
typedef QExplicitlySharedDataPointer< ExpressionPtr
 A smart pointer wrapping mutable Expression instances. More...
 
typedef ::QAbstractXmlForwardIterator< Expression::PtrQAbstractXmlForwardIterator
 
typedef QVector< Expression::PtrVector
 
- Static Public Functions inherited from QPatternist::Expression
static void rewrite (Expression::Ptr &old, const Expression::Ptr &New, const StaticContext::Ptr &context)
 
- Public Variables inherited from QSharedData
QAtomicInt ref
 
- Protected Functions inherited from QPatternist::EmptyContainer
virtual bool compressOperands (const StaticContext::Ptr &context)
 
virtual SequenceType::List expectedOperandTypes () const
 
- Protected Functions inherited from QPatternist::Expression
void typeCheckOperands (const StaticContext::Ptr &context)
 
- Protected Functions inherited from QPatternist::CppCastingHelper< Expression >
 CppCastingHelper ()
 

Detailed Description

A reference to a variable declared with for or a quantification expression, but not for instance a let binding.

A range variable always represents a single item, while an other expression provides the binding and iteration. A for expression is a good example.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 74 of file qrangevariablereference_p.h.

Constructors and Destructors

◆ RangeVariableReference()

RangeVariableReference::RangeVariableReference ( const Expression::Ptr sourceExpression,
const VariableSlotID  slot 
)

Definition at line 51 of file qrangevariablereference.cpp.

52  : VariableReference(slotP),
53  m_sourceExpression(source)
54 {
55  Q_ASSERT(source);
56 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
VariableReference(const VariableSlotID slot)

Functions

◆ accept()

ExpressionVisitorResult::Ptr RangeVariableReference::accept ( const ExpressionVisitor::Ptr visitor) const
virtual

Implements QPatternist::Expression.

Definition at line 82 of file qrangevariablereference.cpp.

83 {
84  return visitor->visit(this);
85 }

◆ evaluateEBV()

bool RangeVariableReference::evaluateEBV ( const DynamicContext::Ptr context) const
virtual

Determines the Effective Boolean Value of the expression.

The Effective Boolean Value of a value is not necessarily the same as converting the value to a new value of type xs:boolean.

Note that this function cannot return the empty sequence, evaluateSingleton() must be overridden in order to be able to do that.

The default implementation results in a type error. Hence, this function must be overridden if such behavior is not of interest.

See also
XML Path Language (XPath) 2.0, 2.4.3 Effective Boolean Value

Reimplemented from QPatternist::Expression.

Definition at line 58 of file qrangevariablereference.cpp.

59 {
60  Q_ASSERT_X(context->rangeVariable(slot()), Q_FUNC_INFO, "The range variable must be set.");
61  return Boolean::evaluateEBV(context->rangeVariable(slot()), context);
62 }
virtual Item rangeVariable(const VariableSlotID slot) const =0
static bool evaluateEBV(const Item::Iterator::Ptr &e, const QExplicitlySharedDataPointer< DynamicContext > &)
Definition: qboolean.cpp:55
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ evaluateSingleton()

Item RangeVariableReference::evaluateSingleton ( const DynamicContext::Ptr context) const
virtual

Reimplemented from QPatternist::Expression.

Definition at line 64 of file qrangevariablereference.cpp.

65 {
66  Q_ASSERT_X(context->rangeVariable(slot()), Q_FUNC_INFO, "The range variable must be set.");
67  return context->rangeVariable(slot());
68 }
virtual Item rangeVariable(const VariableSlotID slot) const =0
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ id()

Expression::ID RangeVariableReference::id ( ) const
virtual
Returns
IDRangeVariableReference

Reimplemented from QPatternist::Expression.

Definition at line 76 of file qrangevariablereference.cpp.

◆ properties()

Expression::Properties RangeVariableReference::properties ( ) const
virtual
Returns
DisableElimination

Reimplemented from QPatternist::VariableReference.

Definition at line 87 of file qrangevariablereference.cpp.

◆ staticType()

SequenceType::Ptr RangeVariableReference::staticType ( ) const
virtual
Returns
the static type of this Expression. For example, an 'and' expression have as static type xs:boolean

Implements QPatternist::Expression.

Definition at line 70 of file qrangevariablereference.cpp.

71 {
72  return makeGenericSequenceType(m_sourceExpression->staticType()->itemType(),
74 }
virtual SequenceType::Ptr staticType() const =0
static Cardinality exactlyOne()
virtual ItemType::Ptr itemType() const =0

Properties

◆ m_sourceExpression

const Expression::Ptr QPatternist::RangeVariableReference::m_sourceExpression
private

Definition at line 92 of file qrangevariablereference_p.h.

Referenced by staticType().


The documentation for this class was generated from the following files: