~zorba-coders/zorba/bug1151967

« back to all changes in this revision

Viewing changes to modules/zorba-query/zorba-query.xq.src/zorba-query.h

  • Committer: Paul J. Lucas
  • Date: 2013-08-15 00:14:17 UTC
  • mfrom: (11597 lp_zorba)
  • mto: This revision was merged to the branch mainline in revision 11598.
  • Revision ID: paul@lucasmail.org-20130815001417-g22x9plxc8fv73zd
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef __COM_ZORBA_WWW_MODULES_XQXQ_H__
2
 
#define __COM_ZORBA_WWW_MODULES_XQXQ_H__
 
1
#ifndef __COM_ZORBA_WWW_MODULES_ZORBA_QUERY_H__
 
2
#define __COM_ZORBA_WWW_MODULES_ZORBA_QUERY_H__
3
3
 
4
4
#include <map>
5
5
 
9
9
#include <zorba/dynamic_context.h>
10
10
#include <zorba/serialization_callback.h>
11
11
 
12
 
#define XQXQ_MODULE_NAMESPACE "http://www.zorba-xquery.com/modules/xqxq"
 
12
#define ZORBA_QUERY_MODULE_NAMESPACE "http://zorba.io/modules/zorba-query"
13
13
 
14
 
namespace zorba { namespace xqxq {
 
14
namespace zorba { namespace zorbaquery {
15
15
  
16
16
  
17
17
/*******************************************************************************
18
18
 
19
19
********************************************************************************/
20
 
class XQXQModule : public ExternalModule 
 
20
class ZorbaQueryModule : public ExternalModule 
21
21
{
22
22
protected:
23
23
  class ltstr
36
36
 
37
37
public:
38
38
 
39
 
  virtual ~XQXQModule();
 
39
  virtual ~ZorbaQueryModule();
40
40
 
41
 
  virtual zorba::String getURI() const {return XQXQ_MODULE_NAMESPACE;}
 
41
  virtual zorba::String getURI() const {return ZORBA_QUERY_MODULE_NAMESPACE;}
42
42
 
43
43
  virtual zorba::ExternalFunction* getExternalFunction(const String& localName);
44
44
 
54
54
/*******************************************************************************
55
55
 
56
56
********************************************************************************/
57
 
class XQXQURLResolver : public URLResolver
 
57
class ZorbaQueryURLResolver : public URLResolver
58
58
{
59
59
protected:
60
60
  Item             theFunction;
61
61
  StaticContext_t  theCtx;
62
62
 
63
63
public:
64
 
  XQXQURLResolver(Item& aFunction, StaticContext_t& aSctx)
 
64
  ZorbaQueryURLResolver(Item& aFunction, StaticContext_t& aSctx)
65
65
    :
66
66
    URLResolver(),
67
67
    theFunction(aFunction),
69
69
  {
70
70
  }
71
71
        
72
 
  virtual ~XQXQURLResolver() { }
 
72
  virtual ~ZorbaQueryURLResolver() { }
73
73
      
74
74
  virtual Resource* resolveURL(const String& url, EntityData const* entityData);
75
75
};
76
76
  
77
77
 
78
 
class XQXQURIMapper : public URIMapper
 
78
class ZorbaQueryURIMapper : public URIMapper
79
79
{
80
80
protected:
81
81
  Item            theFunction;
82
82
  StaticContext_t theCtx;
83
83
    
84
84
public:
85
 
  XQXQURIMapper(Item& aFunction, StaticContext_t& aSctx)
 
85
  ZorbaQueryURIMapper(Item& aFunction, StaticContext_t& aSctx)
86
86
    :
87
87
    URIMapper(),
88
88
    theFunction(aFunction),
90
90
  {
91
91
  }
92
92
    
93
 
  virtual ~XQXQURIMapper(){ }
 
93
  virtual ~ZorbaQueryURIMapper(){ }
94
94
    
95
95
  virtual void mapURI(
96
96
    const zorba::String aUri,
146
146
/*******************************************************************************
147
147
 
148
148
********************************************************************************/
149
 
class XQXQFunction : public ContextualExternalFunction
 
149
class ZorbaQueryFunction : public ContextualExternalFunction
150
150
{
151
151
protected:
152
 
  const XQXQModule * theModule;
 
152
  const ZorbaQueryModule * theModule;
153
153
 
154
154
protected:
155
155
  static void throwError(const char*, const std::string&);
166
166
      const zorba::String& aIdent) const;
167
167
 
168
168
public:
169
 
  XQXQFunction(const XQXQModule* module);
 
169
  ZorbaQueryFunction(const ZorbaQueryModule* module);
170
170
 
171
 
  virtual ~XQXQFunction();
 
171
  virtual ~ZorbaQueryFunction();
172
172
 
173
173
  virtual String getURI() const;
174
174
};
177
177
/*******************************************************************************
178
178
 
179
179
********************************************************************************/
180
 
class PrepareMainModuleFunction : public XQXQFunction
 
180
class PrepareMainModuleFunction : public ZorbaQueryFunction
181
181
{
182
182
public:
183
 
  PrepareMainModuleFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
183
  PrepareMainModuleFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
184
184
 
185
185
  virtual ~PrepareMainModuleFunction(){  }
186
186
      
197
197
/*******************************************************************************
198
198
 
199
199
********************************************************************************/
200
 
class PrepareLibraryModuleFunction : public XQXQFunction
 
200
class PrepareLibraryModuleFunction : public ZorbaQueryFunction
201
201
{
202
202
public:
203
 
  PrepareLibraryModuleFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
203
  PrepareLibraryModuleFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
204
204
 
205
205
  virtual ~PrepareLibraryModuleFunction(){}
206
206
      
217
217
/*******************************************************************************
218
218
 
219
219
********************************************************************************/
220
 
class IsBoundContextItemFunction : public XQXQFunction
 
220
class IsBoundContextItemFunction : public ZorbaQueryFunction
221
221
{
222
222
public:
223
 
  IsBoundContextItemFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
223
  IsBoundContextItemFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
224
224
 
225
225
  virtual ~IsBoundContextItemFunction(){}
226
226
 
237
237
/*******************************************************************************
238
238
 
239
239
********************************************************************************/
240
 
class IsBoundVariableFunction : public XQXQFunction
 
240
class IsBoundVariableFunction : public ZorbaQueryFunction
241
241
{
242
242
public:
243
 
  IsBoundVariableFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
243
  IsBoundVariableFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
244
244
 
245
245
  virtual ~IsBoundVariableFunction(){}
246
246
 
257
257
/*******************************************************************************
258
258
 
259
259
********************************************************************************/
260
 
class GetExternalVariablesFunction : public XQXQFunction
 
260
class GetExternalVariablesFunction : public ZorbaQueryFunction
261
261
{
262
262
public:
263
 
  GetExternalVariablesFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
263
  GetExternalVariablesFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
264
264
 
265
265
  virtual ~GetExternalVariablesFunction() {}
266
266
 
277
277
/*******************************************************************************
278
278
 
279
279
********************************************************************************/
280
 
class IsUpdatingFunction : public XQXQFunction
 
280
class IsUpdatingFunction : public ZorbaQueryFunction
281
281
{
282
282
public:
283
 
  IsUpdatingFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
283
  IsUpdatingFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
284
284
 
285
285
  virtual ~IsUpdatingFunction() {}
286
286
 
297
297
/*******************************************************************************
298
298
 
299
299
********************************************************************************/
300
 
class IsSequentialFunction : public XQXQFunction
 
300
class IsSequentialFunction : public ZorbaQueryFunction
301
301
{
302
302
public:
303
 
  IsSequentialFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
303
  IsSequentialFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
304
304
 
305
305
  virtual ~IsSequentialFunction() {}
306
306
 
317
317
/*******************************************************************************
318
318
 
319
319
********************************************************************************/
320
 
class BindContextItemFunction : public XQXQFunction
 
320
class BindContextItemFunction : public ZorbaQueryFunction
321
321
{
322
322
public:
323
 
  BindContextItemFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
323
  BindContextItemFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
324
324
 
325
325
  virtual ~BindContextItemFunction() {}
326
326
 
337
337
/*******************************************************************************
338
338
 
339
339
********************************************************************************/
340
 
class BindContextPositionFunction : public XQXQFunction
 
340
class BindContextPositionFunction : public ZorbaQueryFunction
341
341
{
342
342
public:
343
 
  BindContextPositionFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
343
  BindContextPositionFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
344
344
 
345
345
  virtual ~BindContextPositionFunction() {}
346
346
 
357
357
/*******************************************************************************
358
358
 
359
359
********************************************************************************/
360
 
class BindContextSizeFunction : public XQXQFunction
 
360
class BindContextSizeFunction : public ZorbaQueryFunction
361
361
{
362
362
public:
363
 
  BindContextSizeFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
363
  BindContextSizeFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
364
364
 
365
365
  virtual ~BindContextSizeFunction() {}
366
366
  
377
377
/*******************************************************************************
378
378
 
379
379
********************************************************************************/
380
 
class BindVariableFunction : public XQXQFunction
 
380
class BindVariableFunction : public ZorbaQueryFunction
381
381
{
382
382
public:
383
 
  BindVariableFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
383
  BindVariableFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
384
384
 
385
385
  virtual ~BindVariableFunction() {}
386
386
 
448
448
/*******************************************************************************
449
449
 
450
450
********************************************************************************/
451
 
class EvaluateFunction : public XQXQFunction
 
451
class EvaluateFunction : public ZorbaQueryFunction
452
452
{
453
453
public:
454
 
  EvaluateFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
454
  EvaluateFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
455
455
 
456
456
  virtual ~EvaluateFunction() {}
457
457
 
468
468
/*******************************************************************************
469
469
 
470
470
********************************************************************************/
471
 
class EvaluateUpdatingFunction : public XQXQFunction
 
471
class EvaluateUpdatingFunction : public ZorbaQueryFunction
472
472
{
473
473
public:
474
 
  EvaluateUpdatingFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
474
  EvaluateUpdatingFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
475
475
 
476
476
  virtual ~EvaluateUpdatingFunction() {}
477
477
 
488
488
/*******************************************************************************
489
489
 
490
490
********************************************************************************/
491
 
class EvaluateSequentialFunction : public XQXQFunction
 
491
class EvaluateSequentialFunction : public ZorbaQueryFunction
492
492
{
493
493
public:
494
 
  EvaluateSequentialFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
494
  EvaluateSequentialFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
495
495
 
496
496
  virtual ~EvaluateSequentialFunction() {}
497
497
 
508
508
  }
509
509
  
510
510
protected:
511
 
  const XQXQModule* theModule;
 
511
  const ZorbaQueryModule* theModule;
512
512
};
513
513
 
514
514
 
515
515
/*******************************************************************************
516
516
 
517
517
********************************************************************************/
518
 
class DeleteQueryFunction : public XQXQFunction
 
518
class DeleteQueryFunction : public ZorbaQueryFunction
519
519
{
520
520
public:
521
 
  DeleteQueryFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
521
  DeleteQueryFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
522
522
 
523
523
  virtual ~DeleteQueryFunction() {}
524
524
 
531
531
           const zorba::DynamicContext*) const;
532
532
};
533
533
 
534
 
  class VariableValueFunction : public XQXQFunction{
 
534
  class VariableValueFunction : public ZorbaQueryFunction{
535
535
    protected:
536
536
      class ValueItemSequence : public ItemSequence
537
537
      {
551
551
 
552
552
      };
553
553
    public:
554
 
      VariableValueFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
554
      VariableValueFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
555
555
 
556
556
      virtual ~VariableValueFunction() {}
557
557
 
567
567
/*******************************************************************************
568
568
 
569
569
********************************************************************************/
570
 
class QueryPlanFunction : public XQXQFunction
 
570
class QueryPlanFunction : public ZorbaQueryFunction
571
571
{
572
572
public:
573
 
  QueryPlanFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
573
  QueryPlanFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
574
574
 
575
575
  virtual ~QueryPlanFunction() {}
576
576
 
587
587
  }
588
588
  
589
589
protected:
590
 
  const XQXQModule* theModule;
 
590
  const ZorbaQueryModule* theModule;
591
591
};
592
592
 
593
593
 
594
594
/*******************************************************************************
595
595
 
596
596
********************************************************************************/
597
 
class LoadFromQueryPlanFunction : public XQXQFunction
 
597
class LoadFromQueryPlanFunction : public ZorbaQueryFunction
598
598
{
599
599
public:
600
 
  LoadFromQueryPlanFunction(const XQXQModule* aModule) : XQXQFunction(aModule) {}
 
600
  LoadFromQueryPlanFunction(const ZorbaQueryModule* aModule) : ZorbaQueryFunction(aModule) {}
601
601
 
602
602
  virtual ~LoadFromQueryPlanFunction() {}
603
603
 
614
614
  }
615
615
  
616
616
protected:
617
 
  const XQXQModule* theModule;
 
617
  const ZorbaQueryModule* theModule;
618
618
 
619
619
  class QueryPlanSerializationCallback : public zorba::SerializationCallback
620
620
  {
645
645
    getURLResolver(size_t i) const { return theUrlResolvers.size() < i? NULL : theUrlResolvers[i]; }
646
646
  };
647
647
};
648
 
}/*xqxq namespace*/}/*zorba namespace*/
649
 
 
650
 
 
651
 
#endif //_COM_ZORBA_WWW_MODULES_XQXQ_H_
 
648
}/*zorbaquery namespace*/}/*zorba namespace*/
 
649
 
 
650
 
 
651
#endif //_COM_ZORBA_WWW_MODULES_ZORBA_QUERY_H_