XQuilla/include/xqilla/ast/TupleNode.hpp

78 lines
2.2 KiB
C++
Raw Normal View History

2020-02-17 21:11:31 +00:00
/*
2020-02-17 21:22:42 +00:00
* Copyright (c) 2001, 2008,
2020-02-17 21:11:31 +00:00
* DecisionSoft Limited. All rights reserved.
2020-02-17 21:24:47 +00:00
* Copyright (c) 2004, 2018 Oracle and/or its affiliates. All rights reserved.
2020-02-17 21:23:16 +00:00
*
2020-02-17 21:11:31 +00:00
*
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:11:31 +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:11:31 +00:00
*/
#ifndef TUPLENODE_HPP
#define TUPLENODE_HPP
#include <xqilla/runtime/TupleResult.hpp>
class StaticContext;
class StaticAnalysis;
2020-02-17 21:17:06 +00:00
class XPath2MemoryManager;
2020-02-17 21:11:31 +00:00
class XQILLA_API TupleNode : public LocationInfo
{
public:
enum Type {
CONTEXT_TUPLE,
FOR,
LET,
WHERE,
2020-02-17 21:17:06 +00:00
ORDER_BY,
2020-02-17 21:22:42 +00:00
COUNT,
2020-02-17 21:17:06 +00:00
DEBUG_HOOK
2020-02-17 21:11:31 +00:00
};
virtual ~TupleNode() {}
2020-02-17 21:17:06 +00:00
virtual void release();
2020-02-17 21:11:31 +00:00
virtual Type getType() const { return type_; }
2020-02-17 21:17:06 +00:00
virtual XPath2MemoryManager *getMemoryManager() const { return mm_; }
unsigned int getMin() const { return min_; }
unsigned int getMax() const { return max_; }
void setMin(unsigned int v) { min_ = v; }
void setMax(unsigned int v) { max_ = v; }
2020-02-17 21:11:31 +00:00
TupleNode *getParent() const { return parent_; }
void setParent(TupleNode *parent) { parent_ = parent; }
void *getUserData() const { return userData_; }
void setUserData(void *data) { userData_ = data; }
virtual TupleNode *staticResolution(StaticContext *context) = 0;
2020-02-17 21:17:06 +00:00
virtual TupleNode *staticTypingImpl(StaticContext *context) = 0;
2020-02-17 21:11:31 +00:00
virtual TupleNode *staticTypingTeardown(StaticContext *context, StaticAnalysis &usedSrc) = 0;
virtual TupleResult::Ptr createResult(DynamicContext* context) const = 0;
protected:
2020-02-17 21:17:06 +00:00
TupleNode(Type type, TupleNode *parent, XPath2MemoryManager *mm)
: type_(type), parent_(parent), min_(0), max_(0), userData_(0), mm_(mm) {}
2020-02-17 21:11:31 +00:00
Type type_;
TupleNode *parent_;
2020-02-17 21:17:06 +00:00
unsigned int min_, max_;
2020-02-17 21:11:31 +00:00
void *userData_;
2020-02-17 21:17:06 +00:00
XPath2MemoryManager *mm_;
2020-02-17 21:11:31 +00:00
};
#endif