Qt 4.8
Public Functions | Static Public Functions | List of all members
QPatternist::EmptySequence Class Reference

Implements the value instance of empty sequence: (). More...

#include <qemptysequence_p.h>

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

Public Functions

virtual ExpressionVisitorResult::Ptr accept (const ExpressionVisitor::Ptr &visitor) const
 
 EmptySequence ()
 Creates an instance of EmptySequence. More...
 
virtual bool evaluateEBV (const DynamicContext::Ptr &context) const
 
virtual Item::Iterator::Ptr evaluateSequence (const DynamicContext::Ptr &) const
 
virtual Item evaluateSingleton (const DynamicContext::Ptr &) const
 
virtual void evaluateToSequenceReceiver (const DynamicContext::Ptr &) const
 
virtual ID id () const
 
virtual Properties properties () const
 
virtual SequenceType::Ptr staticType () const
 
virtual QString stringValue () const
 
virtual ItemType::Ptr type () const
 
- 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 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 ()
 

Static Public Functions

static Expression::Ptr create (const Expression *const replacementFor, const StaticContext::Ptr &context)
 Creates an EmptySequence that is a replacement for replacementFor. More...
 
- Static Public Functions inherited from QPatternist::Expression
static void rewrite (Expression::Ptr &old, const Expression::Ptr &New, const StaticContext::Ptr &context)
 

Additional Inherited Members

- 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
 
- 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

Implements the value instance of empty sequence: ().

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

Definition at line 69 of file qemptysequence_p.h.

Constructors and Destructors

◆ EmptySequence()

QPatternist::EmptySequence::EmptySequence ( )
inline

Creates an instance of EmptySequence.

Note
In most cases create() should be used, since it takes care of adjusting source location annotations.
See also
create()

Definition at line 90 of file qemptysequence_p.h.

Referenced by create().

91  {
92  }

Functions

◆ accept()

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

Implements QPatternist::Expression.

Definition at line 97 of file qemptysequence.cpp.

Referenced by EmptySequence().

98 {
99  return visitor->visit(this);
100 }

◆ create()

Expression::Ptr EmptySequence::create ( const Expression *const  replacementFor,
const StaticContext::Ptr context 
)
static

Creates an EmptySequence that is a replacement for replacementFor.

See also
EmptySequence()

Definition at line 52 of file qemptysequence.cpp.

Referenced by QPatternist::NodeComparison::compress(), QPatternist::ExpressionSequence::compress(), QPatternist::SubsequenceFN::compress(), QPatternist::Expression::constantPropagate(), QPatternist::GenericPredicate::create(), QPatternist::FunctionCall::typeCheck(), QPatternist::ValueComparison::typeCheck(), QPatternist::ForClause::typeCheck(), QPatternist::ArithmeticExpression::typeCheck(), QPatternist::IndexOfFN::typeCheck(), QPatternist::CastAs::typeCheck(), QPatternist::DocFN::typeCheck(), and QPatternist::DistinctValuesFN::typeCheck().

54 {
55  Q_ASSERT(replacementFor);
56  Q_ASSERT(context);
57 
58  const Expression::Ptr retval(new EmptySequence());
59  context->wrapExpressionWith(replacementFor, retval);
60  return retval;
61 }
EmptySequence()
Creates an instance of EmptySequence.
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void wrapExpressionWith(const SourceLocationReflection *const existingNode, const QExplicitlySharedDataPointer< Expression > &newNode)
Ensures source locations are handled in such a manner that existingNode wraps newNode.

◆ evaluateEBV()

bool EmptySequence::evaluateEBV ( const DynamicContext::Ptr context) const
virtual
Returns
always false.

Reimplemented from QPatternist::Expression.

Definition at line 87 of file qemptysequence.cpp.

Referenced by EmptySequence().

88 {
89  return false;
90 }

◆ evaluateSequence()

Item::Iterator::Ptr EmptySequence::evaluateSequence ( const DynamicContext::Ptr ) const
virtual
Returns
always an empty iterator, an instance of EmptyIterator.

Reimplemented from QPatternist::Expression.

Definition at line 63 of file qemptysequence.cpp.

Referenced by EmptySequence().

64 {
66 }
static const EmptyIterator< Item >::Ptr emptyIterator

◆ evaluateSingleton()

Item EmptySequence::evaluateSingleton ( const DynamicContext::Ptr ) const
virtual
Returns
always null.

Reimplemented from QPatternist::Expression.

Definition at line 68 of file qemptysequence.cpp.

Referenced by EmptySequence().

69 {
70  return Item();
71 }
Represents an item in the XPath 2.0 Data Model.
Definition: qitem_p.h:182

◆ evaluateToSequenceReceiver()

void EmptySequence::evaluateToSequenceReceiver ( const DynamicContext::Ptr ) const
virtual

Does nothing.

Reimplemented from QPatternist::Expression.

Definition at line 73 of file qemptysequence.cpp.

Referenced by EmptySequence().

74 {
75 }

◆ id()

Expression::ID EmptySequence::id ( ) const
virtual

This property, which has no setter, returns an enum value that uniquely identifies this Expression. Patternist makes no use of C++'s dynamic_cast feature, but uses this polymorphic function instead.

Returns
always IgnorableExpression.

Reimplemented from QPatternist::Expression.

Definition at line 102 of file qemptysequence.cpp.

Referenced by EmptySequence().

◆ properties()

Expression::Properties EmptySequence::properties ( ) const
virtual
Returns
a bitwise OR'd value of properties, describing the characteristics of the expression. These properties affects how this Expression is treated in for example type checking stages.

The default implementation returns 0. Override and let the function return a different value, if that's of interest.

An important decision when re-implementing properties() is whether to OR in the properties() of ones operands. For instance, if an operand has RequiresFocus set, that flag nost likely applies to the apparent as well, since it depends on its operand.

See also
deepProperties()
Returns
Expression::None, meaning no special properties

Reimplemented from QPatternist::Expression.

Definition at line 107 of file qemptysequence.cpp.

Referenced by EmptySequence().

◆ staticType()

SequenceType::Ptr EmptySequence::staticType ( ) const
virtual
Returns
always CommonSequenceTypes::Empty

Implements QPatternist::Expression.

Definition at line 82 of file qemptysequence.cpp.

Referenced by EmptySequence().

83 {
85 }
static const EmptySequenceType::Ptr Empty

◆ stringValue()

QString EmptySequence::stringValue ( ) const
virtual

Definition at line 92 of file qemptysequence.cpp.

Referenced by EmptySequence().

93 {
94  return QString();
95 }
The QString class provides a Unicode character string.
Definition: qstring.h:83

◆ type()

ItemType::Ptr EmptySequence::type ( ) const
virtual
Returns
always CommonSequenceTypes::Empty

Definition at line 77 of file qemptysequence.cpp.

Referenced by EmptySequence().

78 {
80 }
static const EmptySequenceType::Ptr Empty

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