Qt 4.8
|
Verifies that the sequence an Expression evaluates to conforms to a Cardinality. More...
#include <qcardinalityverifier_p.h>
Static Public Functions | |
static Expression::Ptr | verifyCardinality (const Expression::Ptr &operand, const Cardinality &card, const StaticContext::Ptr &context, const ReportContext::ErrorCode code=ReportContext::XPTY0004) |
Static Public Functions inherited from QPatternist::Expression | |
static void | rewrite (Expression::Ptr &old, const Expression::Ptr &New, const StaticContext::Ptr &context) |
Static Private Functions | |
static QString | wrongCardinality (const Cardinality &req, const Cardinality &got=Cardinality::empty()) |
Properties | |
const bool | m_allowsMany |
const ReportContext::ErrorCode | m_errorCode |
const Cardinality | m_reqCard |
Verifies that the sequence an Expression evaluates to conforms to a Cardinality.
Definition at line 72 of file qcardinalityverifier_p.h.
CardinalityVerifier::CardinalityVerifier | ( | const Expression::Ptr & | operand, |
const Cardinality & | card, | ||
const ReportContext::ErrorCode | code | ||
) |
Definition at line 86 of file qcardinalityverifier.cpp.
Referenced by verifyCardinality().
|
virtual |
Implements QPatternist::Expression.
Definition at line 214 of file qcardinalityverifier.cpp.
|
virtual |
Returns this
.
Reimplemented from QPatternist::Expression.
Definition at line 189 of file qcardinalityverifier.cpp.
|
virtual |
If the static cardinality of the operand is within the required cardinality, the operand is returned as is, since results will always be valid and hence is not a CardinalityVerifier necessary.
Reimplemented from QPatternist::Expression.
Definition at line 194 of file qcardinalityverifier.cpp.
|
virtual |
Evaluate this Expression by iterating over it. This is a central function for evaluating expressions.
Expressions must always always return a valid QAbstractXmlForwardIterator and may never return 0. If an empty result is of interest to be returned, the EmptyIterator should be returned.
The default implementation returns a SingletonIterator over the item returned from evaluateSingleton().
Reimplemented from QPatternist::Expression.
Definition at line 98 of file qcardinalityverifier.cpp.
|
virtual |
Reimplemented from QPatternist::Expression.
Definition at line 147 of file qcardinalityverifier.cpp.
|
virtual |
Returns a list of Sequence Types, describing the type of each of the expression's operands. Hence, this function has a relationship to the operands() function:
- The lengths of the lists returned by expectedOperandTypes() and operands() should always be equal in length, since one cannot describe the type of a non-existent operand(and all operands must have type information). - A significant difference between the two functions is that while the type of objects in the list returned by operands() may vary between compilations/static context, simply because the particular Expression is part of different XPath expressions, the types in the list returned by expectedOperandTypes is always the same since the function/operator signature never changes.
This function should not be confused with staticType(), which returns the static type of the expression itself, not its operands. The function call is an expression where this is clear: the type of the return value is not the same as the arguments' types. The static type of the operands supplied to the expression can be determined via the staticType() function of the instances returned by operands().
If the expression has no operands, an empty list should be returned.
Implements QPatternist::Expression.
Definition at line 202 of file qcardinalityverifier.cpp.
|
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.
Reimplemented from QPatternist::Expression.
Definition at line 219 of file qcardinalityverifier.cpp.
|
virtual |
Implements QPatternist::Expression.
Definition at line 209 of file qcardinalityverifier.cpp.
|
static |
A utility function for determining whether the static type of an Expression matches a cardinality. More specifically, this function performs the cardinality verification part of the Function Conversion Rules.
Definition at line 62 of file qcardinalityverifier.cpp.
Referenced by QPatternist::TypeChecker::applyFunctionConversion(), and QPatternist::ExpressionSequence::typeCheck().
|
inlinestaticprivate |
Centralizes a message string in order to increase consistency and reduce work for translators.
Definition at line 55 of file qcardinalityverifier.cpp.
Referenced by evaluateSequence(), evaluateSingleton(), and verifyCardinality().
|
private |
Definition at line 119 of file qcardinalityverifier_p.h.
Referenced by evaluateSingleton().
|
private |
Definition at line 120 of file qcardinalityverifier_p.h.
Referenced by evaluateSequence(), and evaluateSingleton().
|
private |
Definition at line 118 of file qcardinalityverifier_p.h.
Referenced by CardinalityVerifier(), compress(), evaluateSequence(), evaluateSingleton(), and staticType().