2020-02-17 21:05:20 +00:00
|
|
|
/*
|
2020-02-17 21:13:50 +00:00
|
|
|
* Copyright (c) 2001-2008
|
2020-02-17 21:05:20 +00:00
|
|
|
* DecisionSoft Limited. All rights reserved.
|
2020-02-17 21:13:50 +00:00
|
|
|
* Copyright (c) 2004-2008
|
2020-02-17 21:05:20 +00:00
|
|
|
* Oracle. All rights reserved.
|
|
|
|
*
|
2020-02-17 21:12:51 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2020-02-17 21:05:20 +00:00
|
|
|
*
|
2020-02-17 21:12:51 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*
|
2020-02-17 21:14:54 +00:00
|
|
|
* $Id: ASTNode.hpp 475 2008-01-08 18:47:44Z jpcs $
|
2020-02-17 21:05:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ASTNODE_HPP
|
|
|
|
#define _ASTNODE_HPP
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <xqilla/framework/XQillaExport.hpp>
|
|
|
|
#include <xqilla/framework/XPath2MemoryManager.hpp>
|
|
|
|
#include <xqilla/ast/LocationInfo.hpp>
|
|
|
|
|
|
|
|
class DynamicContext;
|
|
|
|
class StaticContext;
|
|
|
|
class Result;
|
2020-02-17 21:11:31 +00:00
|
|
|
class StaticAnalysis;
|
|
|
|
class PendingUpdateList;
|
|
|
|
class EventHandler;
|
2020-02-17 21:05:20 +00:00
|
|
|
|
|
|
|
class XQILLA_API ASTNode : public LocationInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
///enum for data types
|
|
|
|
typedef enum {
|
|
|
|
LITERAL,
|
|
|
|
SEQUENCE,
|
|
|
|
FUNCTION,
|
|
|
|
NAVIGATION,
|
|
|
|
VARIABLE,
|
|
|
|
STEP,
|
|
|
|
IF,
|
|
|
|
INSTANCE_OF,
|
|
|
|
CASTABLE_AS,
|
|
|
|
CAST_AS,
|
|
|
|
TREAT_AS,
|
|
|
|
OPERATOR,
|
|
|
|
CONTEXT_ITEM,
|
|
|
|
PARENTHESIZED,
|
|
|
|
DOM_CONSTRUCTOR,
|
2020-02-17 21:11:31 +00:00
|
|
|
QUANTIFIED,
|
2020-02-17 21:05:20 +00:00
|
|
|
TYPESWITCH,
|
|
|
|
VALIDATE,
|
|
|
|
FUNCTION_CALL,
|
|
|
|
USER_FUNCTION,
|
|
|
|
ORDERING_CHANGE,
|
|
|
|
XPATH1_CONVERT,
|
|
|
|
PROMOTE_UNTYPED,
|
|
|
|
PROMOTE_NUMERIC,
|
|
|
|
PROMOTE_ANY_URI,
|
|
|
|
DOCUMENT_ORDER,
|
|
|
|
PREDICATE,
|
|
|
|
ATOMIZE,
|
2020-02-17 21:11:31 +00:00
|
|
|
FTCONTAINS,
|
|
|
|
UDELETE,
|
|
|
|
URENAME,
|
|
|
|
UREPLACE,
|
|
|
|
UREPLACE_VALUE_OF,
|
|
|
|
UTRANSFORM,
|
|
|
|
UINSERT_AS_FIRST,
|
|
|
|
UINSERT_AS_LAST,
|
|
|
|
UINSERT_INTO,
|
|
|
|
UINSERT_AFTER,
|
|
|
|
UINSERT_BEFORE,
|
|
|
|
UAPPLY_UPDATES,
|
|
|
|
NAME_EXPRESSION,
|
|
|
|
CONTENT_SEQUENCE,
|
|
|
|
DIRECT_NAME,
|
|
|
|
RETURN
|
2020-02-17 21:05:20 +00:00
|
|
|
} whichType;
|
|
|
|
|
2020-02-17 21:11:31 +00:00
|
|
|
ASTNode() : userData_(0) {}
|
2020-02-17 21:05:20 +00:00
|
|
|
virtual ~ASTNode() {}
|
|
|
|
|
2020-02-17 21:11:31 +00:00
|
|
|
/** Returns a Result iterator for the results of this expression.
|
|
|
|
The flags parameter is currently unused */
|
|
|
|
virtual Result createResult(DynamicContext* context, int flags=0) const = 0;
|
|
|
|
|
|
|
|
/** Returns the result of this expression via the EventHandler provided. */
|
|
|
|
virtual void generateEvents(EventHandler *events, DynamicContext *context,
|
|
|
|
bool preserveNS, bool preserveType) const = 0;
|
|
|
|
|
|
|
|
/// Executes an update expression
|
|
|
|
virtual PendingUpdateList createUpdateList(DynamicContext *context) const = 0;
|
2020-02-17 21:05:20 +00:00
|
|
|
|
|
|
|
/** Returns true if this ASTNode has no predicates, and is an instance of
|
|
|
|
XQSequence or XQLiteral */
|
|
|
|
virtual bool isConstant() const = 0;
|
|
|
|
/** Returns true if this ASTNode has no predicates, and is an instance of
|
|
|
|
XQSequence or XQLiteral. If the literal value of this ASTNode
|
|
|
|
is a single DateOrTimeType, then !hasTimezone() on it must return true,
|
|
|
|
otherwise this method will return false. */
|
|
|
|
virtual bool isDateOrTimeAndHasNoTimezone(StaticContext* context) const = 0;
|
|
|
|
virtual bool isSingleNumericConstant(StaticContext *context) const = 0;
|
|
|
|
|
|
|
|
virtual whichType getType(void) const = 0;
|
|
|
|
|
|
|
|
virtual ASTNode *staticResolution(StaticContext *context) = 0;
|
|
|
|
virtual ASTNode *staticTyping(StaticContext *context) = 0;
|
2020-02-17 21:11:31 +00:00
|
|
|
/// Returns the StaticAnalysis for this ASTNode
|
|
|
|
virtual const StaticAnalysis &getStaticAnalysis() const = 0;
|
|
|
|
|
|
|
|
void *getUserData() const { return userData_; }
|
|
|
|
void setUserData(void *data) { userData_ = data; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
void *userData_;
|
2020-02-17 21:05:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<ASTNode*,XQillaAllocator<ASTNode*> > VectorOfASTNodes;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|