Qt 4.8
Public Types | Public Functions | Protected Functions | Protected Variables | List of all members
QPatternist::UnlimitedContainer Class Reference

Base class for expressions that has any amount of operands. More...

#include <qunlimitedcontainer_p.h>

Inheritance diagram for QPatternist::UnlimitedContainer:
QPatternist::Expression QSharedData QPatternist::CppCastingHelper< Expression > QPatternist::SourceLocationReflection QPatternist::CallSite QPatternist::ExpressionSequence QPatternist::FunctionCall QPatternist::ReturnOrderBy QPatternist::TemplateInvoker QPatternist::UserFunctionCallsite QPatternist::ExtractFromDateTimeFN< DayFromAbstractDateTimeFN > QPatternist::ExtractFromDateTimeFN< HoursFromAbstractDateTimeFN > QPatternist::ExtractFromDateTimeFN< MinutesFromAbstractDateTimeFN > QPatternist::ExtractFromDateTimeFN< MonthFromAbstractDateTimeFN > QPatternist::ExtractFromDateTimeFN< SecondsFromAbstractDateTimeFN > QPatternist::ExtractFromDateTimeFN< TimezoneFromAbstractDateTimeFN > QPatternist::ExtractFromDateTimeFN< YearFromAbstractDateTimeFN > QPatternist::ExtractFromDurationFN< DaysFromDurationFN > QPatternist::ExtractFromDurationFN< HoursFromDurationFN > QPatternist::ExtractFromDurationFN< MinutesFromDurationFN > QPatternist::ExtractFromDurationFN< MonthsFromDurationFN > QPatternist::ExtractFromDurationFN< SecondsFromDurationFN > QPatternist::ExtractFromDurationFN< YearsFromDurationFN > QPatternist::AddingAggregate QPatternist::AdjustTimezone QPatternist::Aggregator QPatternist::BaseURIFN QPatternist::BooleanFN QPatternist::CodepointsToStringFN QPatternist::CollectionFN QPatternist::ComparesCaseAware QPatternist::ConcatFN QPatternist::ContextNodeChecker QPatternist::CountFN QPatternist::CurrentDateFN QPatternist::CurrentDateTimeFN QPatternist::CurrentFN QPatternist::CurrentTimeFN QPatternist::DateTimeFN QPatternist::DeepEqualFN QPatternist::DefaultCollationFN QPatternist::DistinctValuesFN QPatternist::DocumentFN QPatternist::DocumentURIFN QPatternist::EncodeString QPatternist::ErrorFN QPatternist::Existence< Id > QPatternist::ExtractFromDateTimeFN< TSubClass > QPatternist::ExtractFromDurationFN< TSubClass > QPatternist::FalseFN QPatternist::GenerateIDFN QPatternist::ImplicitTimezoneFN QPatternist::IndexOfFN QPatternist::InScopePrefixesFN QPatternist::InsertBeforeFN QPatternist::LangFN QPatternist::LastFN QPatternist::LocalNameFN QPatternist::LocalNameFromQNameFN QPatternist::LowerCaseFN QPatternist::NameFN QPatternist::NamespaceURIFN QPatternist::NamespaceURIForPrefixFN QPatternist::NamespaceURIFromQNameFN QPatternist::NilledFN QPatternist::NodeNameFN QPatternist::NormalizeSpaceFN QPatternist::NormalizeUnicodeFN QPatternist::NotFN QPatternist::NumberFN QPatternist::PatternPlatform QPatternist::PositionFN QPatternist::PrefixFromQNameFN QPatternist::QNameFN QPatternist::RemoveFN QPatternist::ResolveQNameFN QPatternist::ResolveURIFN QPatternist::ReverseFN QPatternist::RootFN QPatternist::StaticBaseUriContainer QPatternist::StaticBaseURIFN QPatternist::StaticNamespacesContainer QPatternist::StringFN QPatternist::StringJoinFN QPatternist::StringLengthFN QPatternist::StringToCodepointsFN QPatternist::SubsequenceFN QPatternist::SubstringAfterFN QPatternist::SubstringBeforeFN QPatternist::SubstringFN QPatternist::TraceFN QPatternist::TranslateFN QPatternist::TrueFN QPatternist::UpperCaseFN

Public Types

enum  CardinalityComputation { ProductOfCardinality, UnionOfCardinality }
 
- 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 Functions

virtual bool compressOperands (const StaticContext::Ptr &)
 
virtual Expression::List operands () const
 
virtual void setOperands (const Expression::List &list)
 
 UnlimitedContainer (const Expression::List &operands=Expression::List())
 
- Public Functions inherited from QPatternist::Expression
virtual ExpressionVisitorResult::Ptr accept (const ExpressionVisitor::Ptr &visitor) const =0
 
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 bool evaluateEBV (const DynamicContext::Ptr &context) const
 
virtual Item::Iterator::Ptr evaluateSequence (const DynamicContext::Ptr &context) const
 
virtual Item evaluateSingleton (const DynamicContext::Ptr &context) const
 
virtual void evaluateToSequenceReceiver (const DynamicContext::Ptr &context) const
 
virtual ItemType::Ptr expectedContextItemType () const
 
virtual SequenceType::List expectedOperandTypes () const =0
 
 Expression ()
 
bool has (const Property prop) const
 
bool hasDependency (const Property prop) const
 
virtual ID id () 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
 
virtual Properties properties () const
 
const Expression::Ptrrewrite (const Expression::Ptr &to, const StaticContext::Ptr &context) const
 Rewrites this Expression to to, and return to. More...
 
virtual SequenceType::Ptr staticType () const =0
 
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 ()
 

Protected Functions

template<CardinalityComputation suppliedCard>
SequenceType::Ptr operandsUnionType () const
 
- Protected Functions inherited from QPatternist::Expression
void typeCheckOperands (const StaticContext::Ptr &context)
 
- Protected Functions inherited from QPatternist::CppCastingHelper< Expression >
 CppCastingHelper ()
 

Protected Variables

Expression::List m_operands
 

Additional Inherited Members

- 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
 

Detailed Description

Base class for expressions that has any amount of operands.

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

Definition at line 71 of file qunlimitedcontainer_p.h.

Enumerations

◆ CardinalityComputation

Tells how operandsUnionType() should compute the cardinality of its children.

This type is public because of a bug in the HP-UX aCC compiler.

Enumerator
ProductOfCardinality 
UnionOfCardinality 

Definition at line 95 of file qunlimitedcontainer_p.h.

Constructors and Destructors

◆ UnlimitedContainer()

UnlimitedContainer::UnlimitedContainer ( const Expression::List operands = Expression::List())

Creates an UnlimitedContainer containing the operands operands. operands may be empty.

Definition at line 48 of file qunlimitedcontainer.cpp.

48  : m_operands(ops)
49 {
50 }

Functions

◆ compressOperands()

bool UnlimitedContainer::compressOperands ( const StaticContext::Ptr context)
virtual
Note
This function cannot be called before setOperands is called.

Implements QPatternist::Expression.

Definition at line 62 of file qunlimitedcontainer.cpp.

63 {
66  int evaled = 0;
67 
68  for(; it != end; ++it)
69  {
70  Q_ASSERT((*it));
71  rewrite((*it), (*it)->compress(context), context);
72  if((*it)->isEvaluated())
73  ++evaled;
74  }
75 
76  return evaled == m_operands.count();
77 }
#define it(className, varName)
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition: qlist.h:267
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static void rewrite(Expression::Ptr &old, const Expression::Ptr &New, const StaticContext::Ptr &context)
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:270
friend class iterator
Definition: qlist.h:226
static const KeyPair *const end

◆ operands()

Expression::List UnlimitedContainer::operands ( ) const
virtual
Returns
the expression's child expressions. For example, a function's arguments is returned here.

If this Expression has no operands, an empty list should be returned.

Implements QPatternist::Expression.

Definition at line 57 of file qunlimitedcontainer.cpp.

Referenced by QPatternist::CountFN::typeCheck(), and QPatternist::OrderBy::typeCheck().

58 {
59  return m_operands;
60 }

◆ operandsUnionType()

template<CardinalityComputation suppliedCard>
SequenceType::Ptr QPatternist::UnlimitedContainer::operandsUnionType ( ) const
inlineprotected

Computes and returns the union type of all the Expression instances in this Expression's operands.

This implementation is placed inside because CardinalityComputation can't be referenced from the outside(in conforming compilers).

Definition at line 111 of file qunlimitedcontainer_p.h.

112  {
113  Q_ASSERT(suppliedCard == ProductOfCardinality || suppliedCard == UnionOfCardinality);
116 
117  /* Load the first one, and jump over it in the loop. */
118  SequenceType::Ptr t(m_operands.first()->staticType());
119  ItemType::Ptr type(t->itemType());
120  Cardinality card(t->cardinality());
121  ++it;
122 
123  for(; it != end; ++it)
124  {
125  t = (*it)->staticType();
126  type |= t->itemType();
127 
128  /* Since this function is a template function, it doesn't
129  * hurt performance that this test is inside the loop. */
130  if(suppliedCard == ProductOfCardinality)
131  card += t->cardinality();
132  else
133  card |= t->cardinality();
134  }
135 
136  return makeGenericSequenceType(type, card);
137  }
int type
Definition: qmetatype.cpp:239
#define it(className, varName)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
Definition: qlist.h:269
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
friend class const_iterator
Definition: qlist.h:264
T & first()
Returns a reference to the first item in the list.
Definition: qlist.h:282
QExplicitlySharedDataPointer< ItemType > Ptr
Definition: qitemtype_p.h:88
QExplicitlySharedDataPointer< const SequenceType > Ptr
static const KeyPair *const end
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272

◆ setOperands()

void UnlimitedContainer::setOperands ( const Expression::List list)
virtual

Implements QPatternist::Expression.

Definition at line 52 of file qunlimitedcontainer.cpp.

53 {
54  m_operands = list;
55 }

Properties

◆ m_operands

Expression::List QPatternist::UnlimitedContainer::m_operands
protected

Definition at line 139 of file qunlimitedcontainer_p.h.

Referenced by QPatternist::UserFunctionCallsite::bindVariables(), QPatternist::ComparesCaseAware::compress(), QPatternist::TemplateInvoker::compress(), QPatternist::ReturnOrderBy::compress(), QPatternist::ReplaceFN::compress(), QPatternist::CountFN::compress(), QPatternist::ExpressionSequence::compress(), QPatternist::StringJoinFN::compress(), QPatternist::PatternPlatform::compress(), QPatternist::Existence< Id >::compress(), QPatternist::NormalizeUnicodeFN::compress(), QPatternist::SubsequenceFN::compress(), compressOperands(), QPatternist::NormalizeUnicodeFN::determineNormalizationForm(), QPatternist::ElementAvailableFN::evaluateEBV(), QPatternist::UnparsedTextAvailableFN::evaluateEBV(), QPatternist::DeepEqualFN::evaluateEBV(), QPatternist::ReturnOrderBy::evaluateEBV(), QPatternist::BooleanFN::evaluateEBV(), QPatternist::NotFN::evaluateEBV(), QPatternist::Existence< Id >::evaluateEBV(), QPatternist::ExpressionSequence::evaluateSequence(), QPatternist::StringToCodepointsFN::evaluateSequence(), QPatternist::IndexOfFN::evaluateSequence(), QPatternist::TokenizeFN::evaluateSequence(), QPatternist::InScopePrefixesFN::evaluateSequence(), QPatternist::DistinctValuesFN::evaluateSequence(), QPatternist::InsertBeforeFN::evaluateSequence(), QPatternist::RemoveFN::evaluateSequence(), QPatternist::ReverseFN::evaluateSequence(), QPatternist::SubsequenceFN::evaluateSequence(), QPatternist::ResolveURIFN::evaluateSingleton(), QPatternist::DateTimeFN::evaluateSingleton(), QPatternist::SystemPropertyFN::evaluateSingleton(), QPatternist::FunctionAvailableFN::evaluateSingleton(), QPatternist::GenerateIDFN::evaluateSingleton(), QPatternist::TypeAvailableFN::evaluateSingleton(), QPatternist::UnparsedTextFN::evaluateSingleton(), QPatternist::ContainsFN::evaluateSingleton(), QPatternist::NodeNameFN::evaluateSingleton(), QPatternist::MatchesFN::evaluateSingleton(), QPatternist::FloorFN::evaluateSingleton(), QPatternist::QNameFN::evaluateSingleton(), QPatternist::CodepointEqualFN::evaluateSingleton(), QPatternist::ErrorFN::evaluateSingleton(), QPatternist::NameFN::evaluateSingleton(), QPatternist::CodepointsToStringFN::evaluateSingleton(), QPatternist::ConcatFN::evaluateSingleton(), QPatternist::ReturnOrderBy::evaluateSingleton(), QPatternist::CountFN::evaluateSingleton(), QPatternist::AdjustTimezone::evaluateSingleton(), QPatternist::StartsWithFN::evaluateSingleton(), QPatternist::NilledFN::evaluateSingleton(), QPatternist::ResolveQNameFN::evaluateSingleton(), QPatternist::AbsFN::evaluateSingleton(), QPatternist::CompareFN::evaluateSingleton(), QPatternist::LocalNameFN::evaluateSingleton(), QPatternist::ReplaceFN::evaluateSingleton(), QPatternist::StringJoinFN::evaluateSingleton(), QPatternist::EndsWithFN::evaluateSingleton(), QPatternist::StringFN::evaluateSingleton(), QPatternist::PrefixFromQNameFN::evaluateSingleton(), QPatternist::NamespaceURIFN::evaluateSingleton(), QPatternist::RoundFN::evaluateSingleton(), QPatternist::SubstringFN::evaluateSingleton(), QPatternist::SubstringBeforeFN::evaluateSingleton(), QPatternist::LocalNameFromQNameFN::evaluateSingleton(), QPatternist::BaseURIFN::evaluateSingleton(), QPatternist::CeilingFN::evaluateSingleton(), QPatternist::NumberFN::evaluateSingleton(), QPatternist::AvgFN::evaluateSingleton(), QPatternist::StringLengthFN::evaluateSingleton(), QPatternist::SubstringAfterFN::evaluateSingleton(), QPatternist::NamespaceURIFromQNameFN::evaluateSingleton(), QPatternist::DocumentURIFN::evaluateSingleton(), QPatternist::RoundHalfToEvenFN::evaluateSingleton(), QPatternist::NormalizeSpaceFN::evaluateSingleton(), QPatternist::NamespaceURIForPrefixFN::evaluateSingleton(), QPatternist::SumFN::evaluateSingleton(), QPatternist::LangFN::evaluateSingleton(), QPatternist::NormalizeUnicodeFN::evaluateSingleton(), QPatternist::RootFN::evaluateSingleton(), QPatternist::UpperCaseFN::evaluateSingleton(), QPatternist::LowerCaseFN::evaluateSingleton(), QPatternist::TranslateFN::evaluateSingleton(), QPatternist::EncodeString::evaluateSingleton(), QPatternist::RemoveFN::evaluateSingleton(), QPatternist::ExpressionSequence::evaluateToSequenceReceiver(), operands(), operandsUnionType(), QPatternist::ReplaceFN::parseReplacement(), QPatternist::PatternPlatform::pattern(), QPatternist::ExpressionSequence::properties(), QPatternist::ReturnOrderBy::ReturnOrderBy(), setOperands(), QPatternist::UserFunctionCallsite::setSource(), QPatternist::ErrorFN::signature(), QPatternist::FunctionCall::staticType(), QPatternist::Aggregator::staticType(), QPatternist::ReturnOrderBy::staticType(), QPatternist::AvgFN::staticType(), QPatternist::SumFN::staticType(), QPatternist::RootFN::staticType(), QPatternist::DistinctValuesFN::staticType(), QPatternist::InsertBeforeFN::staticType(), QPatternist::RemoveFN::staticType(), QPatternist::ReverseFN::staticType(), QPatternist::SubsequenceFN::staticType(), QPatternist::TemplateInvoker::TemplateInvoker(), QPatternist::ResolveURIFN::typeCheck(), QPatternist::DeepEqualFN::typeCheck(), QPatternist::FunctionCall::typeCheck(), QPatternist::StringFN::typeCheck(), QPatternist::ExpressionSequence::typeCheck(), QPatternist::AddingAggregate::typeCheck(), QPatternist::IndexOfFN::typeCheck(), QPatternist::DocumentFN::typeCheck(), QPatternist::AvgFN::typeCheck(), QPatternist::NumberFN::typeCheck(), QPatternist::DocFN::typeCheck(), QPatternist::SumFN::typeCheck(), QPatternist::DistinctValuesFN::typeCheck(), and QPatternist::ReverseFN::typeCheck().


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