Qt 4.8
Public Types | Public Functions | Protected Functions | List of all members
QPatternist::FunctionFactory Class Referenceabstract

An entry point for looking up and creating FunctionCall instances. More...

#include <qfunctionfactory_p.h>

Inheritance diagram for QPatternist::FunctionFactory:
QSharedData QPatternist::AbstractFunctionFactory QPatternist::FunctionFactoryCollection QPatternist::ConstructorFunctionsFactory QPatternist::XPath10CoreFunctions QPatternist::XPath20CoreFunctions QPatternist::XSLT20CoreFunctions

Public Types

typedef QList< FunctionFactory::PtrList
 
typedef QExplicitlySharedDataPointer< FunctionFactoryPtr
 

Public Functions

virtual Expression::Ptr createFunctionCall (const QXmlName name, const Expression::List &arguments, const StaticContext::Ptr &context, const SourceLocationReflection *const r)=0
 
virtual FunctionSignature::Hash functionSignatures () const =0
 
bool hasSignature (const FunctionSignature::Ptr &signature) const
 
virtual bool isAvailable (const NamePool::Ptr &np, const QXmlName name, const xsInteger arity)
 
virtual ~FunctionFactory ()
 
- 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...
 

Protected Functions

 FunctionFactory ()
 This constructor cannot be removed, because it can't be synthesized, for some reason. More...
 
virtual FunctionSignature::Ptr retrieveFunctionSignature (const NamePool::Ptr &np, const QXmlName name)=0
 

Additional Inherited Members

- Public Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

An entry point for looking up and creating FunctionCall instances.

See also
XQuery 1.0 and XPath 2.0 Functions and Operators
XML Path Language (XPath) 2.0, Definition: Function signatures
Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 81 of file qfunctionfactory_p.h.

Typedefs

◆ List

Definition at line 86 of file qfunctionfactory_p.h.

◆ Ptr

Definition at line 85 of file qfunctionfactory_p.h.

Constructors and Destructors

◆ ~FunctionFactory()

FunctionFactory::~FunctionFactory ( )
virtual

Definition at line 50 of file qfunctionfactory.cpp.

51 {
52 }

◆ FunctionFactory()

QPatternist::FunctionFactory::FunctionFactory ( )
inlineprotected

This constructor cannot be removed, because it can't be synthesized, for some reason.

Definition at line 144 of file qfunctionfactory_p.h.

145  {
146  }

Functions

◆ createFunctionCall()

virtual Expression::Ptr QPatternist::FunctionFactory::createFunctionCall ( const QXmlName  name,
const Expression::List arguments,
const StaticContext::Ptr context,
const SourceLocationReflection *const  r 
)
pure virtual

Creates a function call implementation.

A FunctionFactory represents a set of functions, which it is able to instantiate and to serve FunctionSignatures for. Conventionally, a FunctionFactory per namespace exists.

Note
This function should not issue any error unless it is absolutely confident that the error cannot be fixed in another way. For example, in some cases it might be that a function is available in another FunctionFactory and it would therefore be wrong to issue an error signalling that no function by that name exists, but leave that to the callee.
Parameters
namethe name of the function to create. In Clark syntax, this could for example be {http://www.w3.org/2005/04/xpath-functions}lower-case
argumentsthe function's operands
contextthe usual StaticContext which supplies compile time data and reporting functionality.
rthe SourceLocationReflection that identifies the callsite.
Returns
an instance of Expression which is the function implementation for name. Or, a static error was raised.

Implemented in QPatternist::FunctionFactoryCollection, and QPatternist::AbstractFunctionFactory.

Referenced by QPatternist::ByIDCreator::create().

◆ functionSignatures()

virtual FunctionSignature::Hash QPatternist::FunctionFactory::functionSignatures ( ) const
pure virtual

◆ hasSignature()

bool FunctionFactory::hasSignature ( const FunctionSignature::Ptr signature) const

Determines whether this FunctionFactory contains the function signature signature.

The implementation uses functionSignatures().

Definition at line 65 of file qfunctionfactory.cpp.

66 {
68  const FunctionSignature::Hash::const_iterator end(signs.constEnd());
69  FunctionSignature::Hash::const_iterator it(signs.constBegin());
70 
71  for(; it != end; ++it)
72  {
73  if(*(*it) == *signature)
74  return true;
75  }
76 
77  return false;
78 }
virtual FunctionSignature::Hash functionSignatures() const =0
#define it(className, varName)
static const KeyPair *const end

◆ isAvailable()

bool FunctionFactory::isAvailable ( const NamePool::Ptr np,
const QXmlName  name,
const xsInteger  arity 
)
virtual

Determines whether a function with the name name and arity arity is available. The implementation operates on the result of retrieveFunctionSignature() to determine the result.

Parameters
npthe NamePool.
namethe name of the function. For example fn:string-join.
aritythe number of arguments the function must have.

Reimplemented in QPatternist::FunctionFactoryCollection.

Definition at line 54 of file qfunctionfactory.cpp.

Referenced by QPatternist::FunctionAvailableFN::evaluateSingleton().

56 {
58 
59  if(sign)
60  return arity == FunctionSignature::UnlimitedArity || sign->isArityValid(arity);
61  else
62  return false;
63 }
static int sign(int x)
virtual FunctionSignature::Ptr retrieveFunctionSignature(const NamePool::Ptr &np, const QXmlName name)=0

◆ retrieveFunctionSignature()

virtual FunctionSignature::Ptr QPatternist::FunctionFactory::retrieveFunctionSignature ( const NamePool::Ptr np,
const QXmlName  name 
)
protectedpure virtual

This is a convenience function for sub-classes. It retrieves the function signature for function with name name.

According to the specifications are function signatures identified by their name and arity, but currently is the arity not part of the signature.

If no function could be found for the given name, null is returned.

Implemented in QPatternist::FunctionFactoryCollection, QPatternist::XPath20CoreFunctions, QPatternist::XPath10CoreFunctions, QPatternist::XSLT20CoreFunctions, and QPatternist::ConstructorFunctionsFactory.

Referenced by QPatternist::AbstractFunctionFactory::createFunctionCall(), FunctionFactory(), and isAvailable().


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