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

Implements XSL-T 2.0's XPath function fn:function-available(). More...

#include <qfunctionavailablefn_p.h>

Inheritance diagram for QPatternist::FunctionAvailableFN:
QPatternist::StaticNamespacesContainer QPatternist::FunctionCall QPatternist::UnlimitedContainer QPatternist::Expression QSharedData QPatternist::CppCastingHelper< Expression > QPatternist::SourceLocationReflection

Public Functions

virtual Item evaluateSingleton (const DynamicContext::Ptr &context) const
 
virtual Expression::Ptr typeCheck (const StaticContext::Ptr &context, const SequenceType::Ptr &reqType)
 
- Public Functions inherited from QPatternist::FunctionCall
virtual ExpressionVisitorResult::Ptr accept (const ExpressionVisitor::Ptr &visitor) const
 
virtual SequenceType::List expectedOperandTypes () const
 
virtual ID id () const
 
virtual Expression::Properties properties () const
 
virtual void setSignature (const FunctionSignature::Ptr &sign)
 
virtual FunctionSignature::Ptr signature () const
 
virtual SequenceType::Ptr staticType () const
 
- Public Functions inherited from QPatternist::UnlimitedContainer
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 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 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 ()
 
- 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

QXmlName::NamespaceCode m_defFuncNS
 
FunctionFactory::Ptr m_functionFactory
 

Additional Inherited Members

- Public Types inherited from QPatternist::FunctionCall
typedef QExplicitlySharedDataPointer< FunctionCallPtr
 
- Public Types inherited from QPatternist::UnlimitedContainer
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
 
- 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::StaticNamespacesContainer
const NamespaceResolver::PtrstaticNamespaces () const
 
 StaticNamespacesContainer ()
 
- Protected Functions inherited from QPatternist::UnlimitedContainer
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 inherited from QPatternist::UnlimitedContainer
Expression::List m_operands
 

Detailed Description

Implements XSL-T 2.0's XPath function fn:function-available().

See also
XSL Transformations (XSLT) Version 2.0, 18.1.1 Testing Availability of Functions
Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 72 of file qfunctionavailablefn_p.h.

Functions

◆ evaluateSingleton()

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

Reimplemented from QPatternist::Expression.

Definition at line 53 of file qfunctionavailablefn.cpp.

54 {
55  const QString lexQName(m_operands.first()->evaluateSingleton(context).stringValue());
56 
59 
61 
62  const QXmlName name
65  ReportContext::XTDE1400>(lexQName,
66  context,
67  resolver,
68  this));
69 
70  xsInteger arity;
71 
72  if(m_operands.count() == 2)
73  arity = m_operands.at(1)->evaluateSingleton(context).as<Numeric>()->toInteger();
74  else
76 
77  return Boolean::fromValue(m_functionFactory->isAvailable(context->namePool(), name, arity));
78 }
virtual NamePool::Ptr namePool() const =0
qint64 xsInteger
const NamespaceResolver::Ptr & staticNamespaces() const
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
static QXmlName expandQName(const QString &lexicalQName, const TReportContext &context, const NamespaceResolver::Ptr &nsResolver, const SourceLocationReflection *const r, const bool asForAttribute=false)
The QString class provides a Unicode character string.
Definition: qstring.h:83
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
Contains a set of bindings, plus a pointer to another resolver which is delegates requests to...
const char * name
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QString stringValue() const
Returns the string value of this Item.
Definition: qitem_p.h:302
static Boolean::Ptr fromValue(const bool value)
Definition: qboolean.cpp:115
virtual bool isAvailable(const NamePool::Ptr &np, const QXmlName name, const xsInteger arity)
T & first()
Returns a reference to the first item in the list.
Definition: qlist.h:282
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Definition: qxmlname.h:58
Base class for all numeric values.
TCastTarget * as() const
Definition: qitem_p.h:278
virtual Item evaluateSingleton(const DynamicContext::Ptr &context) const

◆ typeCheck()

Expression::Ptr FunctionAvailableFN::typeCheck ( const StaticContext::Ptr context,
const SequenceType::Ptr reqType 
)
virtual

Reimplemented to store data from the context which is needed at runtime.

Reimplemented from QPatternist::StaticNamespacesContainer.

Definition at line 80 of file qfunctionavailablefn.cpp.

82 {
86  /* m_defFuncNS can be empty/null or an actual value. */
87 
88  return StaticNamespacesContainer::typeCheck(context, reqType);
89 }
virtual NamePool::Ptr namePool() const =0
QXmlName::NamespaceCode allocateNamespace(const QString &uri)
Definition: qnamepool_p.h:202
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
virtual QExplicitlySharedDataPointer< FunctionFactory > functionSignatures() const =0
virtual Expression::Ptr typeCheck(const StaticContext::Ptr &context, const SequenceType::Ptr &reqType)
virtual QString defaultFunctionNamespace() const =0

Properties

◆ m_defFuncNS

QXmlName::NamespaceCode QPatternist::FunctionAvailableFN::m_defFuncNS
private

Definition at line 85 of file qfunctionavailablefn_p.h.

Referenced by evaluateSingleton(), and typeCheck().

◆ m_functionFactory

FunctionFactory::Ptr QPatternist::FunctionAvailableFN::m_functionFactory
private

Definition at line 84 of file qfunctionavailablefn_p.h.

Referenced by evaluateSingleton(), and typeCheck().


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