SourceForge.net Logo
EventGenerator.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2001, 2008,
3 * DecisionSoft Limited. All rights reserved.
4 * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
5 *
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20#ifndef _EVENTGENERATOR_HPP
21#define _EVENTGENERATOR_HPP
22
23#include <xqilla/framework/XQillaExport.hpp>
26
27class DynamicContext;
28class EventHandler;
29class ASTNode;
30class QueryPathNode;
31
32class XQILLA_API EventGenerator : public ReferenceCounted
33{
34public:
36
37 virtual ~EventGenerator() {}
38
42
43 static void generateAndTailCall(const EventGenerator::Ptr &generator, EventHandler *events,
44 DynamicContext *context)
45 {
46 EventGenerator::Ptr gen = generator;
47 while(gen.notNull()) {
48 gen = gen->generateEvents(events, context);
49 }
50 }
51
52 static Result createResult(const ASTNode *ast, const QueryPathNode *projection,
53 DynamicContext *context);
54};
55
56class XQILLA_API ASTNodeEventGenerator : public EventGenerator
57{
58public:
59 ASTNodeEventGenerator(const ASTNode *ast, bool preserveNS, bool preserveType);
60
62
63protected:
64 const ASTNode *ast_;
65 bool preserveNS_, preserveType_;
66};
67
68#endif
Definition EventGenerator.hpp:57
virtual EventGenerator::Ptr generateEvents(EventHandler *events, DynamicContext *context)
Returns the result of this expression via the EventHandler provided.
ASTNodeEventGenerator(const ASTNode *ast, bool preserveNS, bool preserveType)
const ASTNode * ast_
Definition EventGenerator.hpp:64
bool preserveNS_
Definition EventGenerator.hpp:65
The execution time dynamic context interface.
Definition DynamicContext.hpp:39
Definition EventGenerator.hpp:33
virtual EventGenerator::Ptr generateEvents(EventHandler *events, DynamicContext *context)=0
Returns the result of this expression via the EventHandler provided.
RefCountPointer< EventGenerator > Ptr
Definition EventGenerator.hpp:35
static Result createResult(const ASTNode *ast, const QueryPathNode *projection, DynamicContext *context)
virtual ~EventGenerator()
Definition EventGenerator.hpp:37
static void generateAndTailCall(const EventGenerator::Ptr &generator, EventHandler *events, DynamicContext *context)
Definition EventGenerator.hpp:43
Definition EventHandler.hpp:30
Super class of all the reference counted wrappers for Items.
Definition ReferenceCounted.hpp:62
bool notNull() const
Definition ReferenceCounted.hpp:114
Super class for reference counted classes.
Definition ReferenceCounted.hpp:31
A scoped pointer wrapper for the lazily evaluated query result.
Definition Result.hpp:38