Qt 4.8
|
Represents the signature of an XPath function. More...
#include <qfunctionsignature_p.h>
Public Types | |
enum | { UnlimitedArity = -1 } |
typedef qint16 | Arity |
typedef QHash< QXmlName, FunctionSignature::Ptr > | Hash |
typedef QList< FunctionSignature::Ptr > | List |
typedef QExplicitlySharedDataPointer< FunctionSignature > | Ptr |
Public Types inherited from QPatternist::CallTargetDescription | |
typedef QList< Ptr > | List |
typedef QExplicitlySharedDataPointer< CallTargetDescription > | Ptr |
Properties | |
FunctionArgument::List | m_arguments |
const Expression::ID | m_id |
const Arity | m_maxArgs |
const Arity | m_minArgs |
const Expression::Properties | m_props |
const SequenceType::Ptr | m_returnType |
Additional Inherited Members | |
Static Public Functions inherited from QPatternist::CallTargetDescription | |
static void | checkCallsiteCircularity (CallTargetDescription::List &signList, const Expression::Ptr expr) |
Public Variables inherited from QSharedData | |
QAtomicInt | ref |
Represents the signature of an XPath function.
FunctionSignature represents and allows inspection of a function signature, such as fn:string-join($arg1 as xs:string*, $arg2 as xs:string) as xs:string
. No XPath related languages allows polymorphism on the type of the arguments, only the amount(arity) of the arguments. For example, fn:string() as xs:string
and fn:string($arg as item()?) as xs:string
can happily co-exist, but fn:string($arg as item()?) as xs:string
and fn:string($arg as xs:anyAtomicType?) as xs:string
would be an error. This fact is reflected by FunctionSignature that if minimumArguments() and maximumArguments() are not equal, it means that this FunctionSignature represents several function signatures.
Definition at line 93 of file qfunctionsignature_p.h.
A number which tells the amount of arguments a function has.
Definition at line 111 of file qfunctionsignature_p.h.
Definition at line 105 of file qfunctionsignature_p.h.
Definition at line 106 of file qfunctionsignature_p.h.
Definition at line 104 of file qfunctionsignature_p.h.
anonymous enum |
Enumerator | |
---|---|
UnlimitedArity | Flags the function as allowing an unlimited amount of arguments. |
Definition at line 96 of file qfunctionsignature_p.h.
FunctionSignature::FunctionSignature | ( | const QXmlName | name, |
const Arity | minArgs, | ||
const Arity | maxArgs, | ||
const SequenceType::Ptr & | returnType, | ||
const Expression::Properties | chars = Expression::Properties() , |
||
const Expression::ID | id = Expression::IDIgnorableExpression |
||
) |
Definition at line 50 of file qfunctionsignature.cpp.
void FunctionSignature::appendArgument | ( | const QXmlName::LocalNameCode | name, |
const SequenceType::Ptr & | type | ||
) |
This is a convenience function. Calling this once, is equal to calling setArguments() with a list containing a FunctionsArgument with name name
and type type
.
Definition at line 68 of file qfunctionsignature.cpp.
Referenced by QPatternist::XPath10CoreFunctions::retrieveFunctionSignature(), QPatternist::XSLT20CoreFunctions::retrieveFunctionSignature(), and QPatternist::XPath20CoreFunctions::retrieveFunctionSignature().
FunctionArgument::List FunctionSignature::arguments | ( | ) | const |
Definition at line 123 of file qfunctionsignature.cpp.
Referenced by QPatternist::UserFunctionCallsite::expectedOperandTypes(), and QPatternist::ErrorFN::signature().
QString FunctionSignature::displayName | ( | const NamePool::Ptr & | np | ) | const |
Builds a string representation for this function signature. The syntax used is the one used in the XQuery. It looks like this:
prefix:function-name($parameter-name as parameter-type, ...) as return-type
The prefix used for the name is conventional. For example, for constructor functions is xs
used.
Definition at line 76 of file qfunctionsignature.cpp.
Expression::ID FunctionSignature::id | ( | ) | const |
The ID that the corresponding FunctionCall instance should return in Expression::id().
Definition at line 153 of file qfunctionsignature.cpp.
Referenced by QPatternist::FunctionCall::id().
bool FunctionSignature::isArityValid | ( | const xsInteger | arity | ) | const |
Checks whether arity
is within the range of allowed count of arguments. For example, when the minimum arguments is 1 and maximum arguments 2, false
will be returned for passing 0 while true
will be returned when 2 is passed.
Definition at line 128 of file qfunctionsignature.cpp.
Referenced by QPatternist::FunctionFactory::isAvailable(), QPatternist::UserFunctionCallsite::isSignatureValid(), and operator==().
FunctionSignature::Arity FunctionSignature::maximumArguments | ( | ) | const |
Definition at line 138 of file qfunctionsignature.cpp.
Referenced by operator==(), QPatternist::ErrorFN::signature(), QPatternist::FunctionCall::typeCheck(), and QPatternist::AbstractFunctionFactory::verifyArity().
FunctionSignature::Arity FunctionSignature::minimumArguments | ( | ) | const |
Definition at line 133 of file qfunctionsignature.cpp.
Referenced by operator==(), QPatternist::ErrorFN::signature(), and QPatternist::AbstractFunctionFactory::verifyArity().
bool FunctionSignature::operator== | ( | const FunctionSignature & | other | ) | const |
Determines whether this FunctionSignature is equal to other
, taking into account XPath's function polymorphism. other
is equal to this FunctionSignature if their name() instances are equal, and that the maximumArguments() and minimumArguments() arguments of other
are allowed, as per isArityValid().
In other words, this equalness operator can return true
for different signatures, but it do make sense since a FunctionSignature can represent multiple signatures.
true
if this FunctionSignature is equal to other
, otherwise false
Definition at line 111 of file qfunctionsignature.cpp.
Expression::Properties FunctionSignature::properties | ( | ) | const |
The properties that the corresponding FunctionCall instance should return in Expression::properties().
Definition at line 148 of file qfunctionsignature.cpp.
Referenced by QPatternist::FunctionCall::properties(), and QPatternist::ErrorFN::signature().
SequenceType::Ptr FunctionSignature::returnType | ( | ) | const |
The return type of this function signature. For example, if the represented function signature is fn:string() as xs:string
, the return type is xs:string
.
Definition at line 143 of file qfunctionsignature.cpp.
Referenced by QPatternist::ErrorFN::signature(), and QPatternist::FunctionCall::staticType().
void FunctionSignature::setArguments | ( | const FunctionArgument::List & | args | ) |
Definition at line 118 of file qfunctionsignature.cpp.
|
private |
Definition at line 193 of file qfunctionsignature_p.h.
Referenced by appendArgument(), arguments(), displayName(), and setArguments().
|
private |
Definition at line 195 of file qfunctionsignature_p.h.
Referenced by id().
|
private |
Definition at line 191 of file qfunctionsignature_p.h.
Referenced by displayName(), FunctionSignature(), isArityValid(), and maximumArguments().
|
private |
Definition at line 190 of file qfunctionsignature_p.h.
Referenced by isArityValid(), and minimumArguments().
|
private |
Definition at line 194 of file qfunctionsignature_p.h.
Referenced by properties().
|
private |
Definition at line 192 of file qfunctionsignature_p.h.
Referenced by displayName(), and returnType().