/* * Copyright (c) 2001-2006 * DecisionSoft Limited. All rights reserved. * Copyright (c) 2004-2006 * Progress Software Corporation. All rights reserved. * Copyright (c) 2004-2006 * Oracle. All rights reserved. * * See the file LICENSE for redistribution information. * * $Id: XQFunction.hpp,v 1.10 2006/11/01 16:37:11 jpcs Exp $ */ #ifndef _XQFUNCTION_HPP #define _XQFUNCTION_HPP #include #include #include #include #include #include // because every implementation will use these to define the function name #include class SequenceType; class XQILLA_API XQFunction : public ASTNodeImpl { public: XQFunction(const XMLCh* name, unsigned int argsFrom, unsigned int argsTo, const char* paramDecl, const VectorOfASTNodes &args, XPath2MemoryManager* memMgr); virtual ~XQFunction(); const XMLCh* getFunctionURI()const; const XMLCh* getFunctionName()const; const XMLCh* getFunctionSignature() const; const VectorOfASTNodes &getArguments() const; static const XMLCh XMLChFunctionURI[]; /** Wraps the arguments in the appropriate conversion functions, calls static resolution on them, and constant folds if this function's StaticResolutionContext is not used */ ASTNode *resolveArguments(StaticContext *context, bool checkTimezone = false, bool numericFunction = false); ASTNode *calculateSRCForArguments(StaticContext *context, bool checkTimezone = false, bool numericFunction = false); /** casts the expression given as a parameter into the appropriate type and returns the guaranteed correctly typed objects in a sequence */ virtual Result getParamNumber(unsigned int number, DynamicContext* context, int flags=0) const; /** returns the number of parameters passed into the function */ unsigned int getNumArgs() const; protected: /** Helper method, produces a single ATStringOrDerived from the output of getParamNumber(). If getParamNumber() returns anything other than a single string, an exception is thrown. */ static const unsigned int UNLIMITED; //parse the supplied string of comma separated arguments into vector of SequenceTypes static std::vector< SequenceType* >* parseParamDecl(const char* paramString); const XMLCh *_fName, *_fURI, *_signature; const unsigned int _nArgsFrom, _nArgsTo; const std::vector* _paramDecl; VectorOfASTNodes _args; // The real store for arguments }; #endif