~zorba-coders/zorba/bug-950621

« back to all changes in this revision

Viewing changes to src/functions/Sequences.h

  • Committer: brantmat at ETHZ
  • Date: 2007-10-09 12:58:38 UTC
  • Revision ID: svn-v4:8046edc3-af21-0410-8661-ec7318497eea:trunk/zorba:904
commit of the new directory structure

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @file Sequences.h
 
3
 * @author Paul Pedersen (pcp071098@yahoo.com)
 
4
 * @copyright 2006-2007 FLWOR Foundation (flworfound.org)
 
5
 *
 
6
 * Licensed under the Apache License, Version 2.0 (the "License");
 
7
 * you may not use this file except in compliance with the License.
 
8
 * You may obtain a copy of the License at
 
9
 *
 
10
 *    http://www.apache.org/licenses/LICENSE-2.0
 
11
 *
 
12
 * Unless required by applicable law or agreed to in writing, software
 
13
 * distributed under the License is distributed on an "AS IS" BASIS,
 
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
15
 * See the License for the specific language governing permissions and
 
16
 * limitations under the License.
 
17
 *
 
18
 */
 
19
 
 
20
#ifndef XQP_SEQUENCES_H
 
21
#define XQP_SEQUENCES_H
 
22
 
 
23
#include <string>
 
24
#include <vector>
 
25
 
 
26
#include "function.h"
 
27
 
 
28
namespace xqp {
 
29
 
 
30
class zorba;
 
31
 
 
32
/*______________________________________________________________________
 
33
|  
 
34
| 15.1 General Functions and Operators on Sequences
 
35
|_______________________________________________________________________*/
 
36
 
 
37
//15.1.1 fn:boolean (effective boolean value)
 
38
//-----------------
 
39
 
 
40
 
 
41
//15.1.2 op:concatenate
 
42
//---------------------
 
43
class op_concatenate : public function
 
44
{
 
45
public:
 
46
        op_concatenate(const signature&);
 
47
        ~op_concatenate() {}
 
48
 
 
49
public:
 
50
        Iterator_t operator()(const yy::location& loc,std::vector<Iterator_t>&) const;
 
51
        sequence_type_t type_check(signature&) const;
 
52
        bool validate_args(std::vector<Iterator_t>&) const;
 
53
};
 
54
 
 
55
 
 
56
//15.1.3 fn:index-of
 
57
//------------------
 
58
class fn_index_of : public function
 
59
{
 
60
public:
 
61
        fn_index_of(const signature&);
 
62
        ~fn_index_of() {}
 
63
 
 
64
public:
 
65
        Iterator_t operator()(const yy::location& loc, std::vector<Iterator_t>&) const;
 
66
        sequence_type_t type_check(signature&) const;
 
67
        bool validate_args(std::vector<Iterator_t>&) const;
 
68
};
 
69
 
 
70
 
 
71
//15.1.4 fn:empty
 
72
//---------------
 
73
class fn_empty : public function
 
74
{
 
75
public:
 
76
        fn_empty(const signature&);
 
77
        ~fn_empty() {}
 
78
 
 
79
public:
 
80
        Iterator_t operator()(const yy::location& loc, std::vector<Iterator_t>&) const;
 
81
        sequence_type_t type_check(signature&) const;
 
82
        bool validate_args(std::vector<Iterator_t>&) const;
 
83
};
 
84
 
 
85
 
 
86
//15.1.5 fn:exists
 
87
//----------------
 
88
class fn_exists : public function
 
89
{
 
90
public:
 
91
        fn_exists(const signature&);
 
92
        ~fn_exists() {}
 
93
 
 
94
public:
 
95
        Iterator_t operator()(const yy::location& loc, std::vector<Iterator_t>&) const;
 
96
        sequence_type_t type_check(signature&) const;
 
97
        bool validate_args(std::vector<Iterator_t>&) const;
 
98
};
 
99
 
 
100
 
 
101
//15.1.6 fn:distinct-values
 
102
//-------------------------
 
103
class fn_distinct_values : public function
 
104
{
 
105
public:
 
106
        fn_distinct_values(const signature&);
 
107
        ~fn_distinct_values() {}
 
108
 
 
109
public:
 
110
        Iterator_t operator()(const yy::location& loc, std::vector<Iterator_t>&) const;
 
111
        sequence_type_t type_check(signature&) const;
 
112
        bool validate_args(std::vector<Iterator_t>&) const;
 
113
};
 
114
 
 
115
 
 
116
//15.1.7 fn:insert-before
 
117
//-----------------------
 
118
 
 
119
 
 
120
//15.1.8 fn:remove
 
121
//----------------
 
122
 
 
123
 
 
124
//15.1.9 fn:reverse
 
125
//-----------------
 
126
class fn_reverse : public function
 
127
{
 
128
public:
 
129
        fn_reverse(const signature&);
 
130
        ~fn_reverse() {}
 
131
 
 
132
public:
 
133
        Iterator_t operator()(const yy::location& loc, std::vector<Iterator_t>&) const;
 
134
        sequence_type_t type_check(signature&) const;
 
135
        bool validate_args(std::vector<Iterator_t>&) const;
 
136
};
 
137
 
 
138
 
 
139
//15.1.10 fn:subsequence
 
140
//----------------------
 
141
class fn_subsequence : public function
 
142
{
 
143
public:
 
144
        fn_subsequence(const signature&);
 
145
        ~fn_subsequence() {}
 
146
 
 
147
public:
 
148
        Iterator_t operator()(const yy::location& loc, std::vector<Iterator_t>&) const;
 
149
        sequence_type_t type_check(signature&) const;
 
150
        bool validate_args(std::vector<Iterator_t>&) const;
 
151
};
 
152
 
 
153
 
 
154
//15.1.11 fn:unordered
 
155
//--------------------
 
156
 
 
157
 
 
158
/*______________________________________________________________________
 
159
|  
 
160
| 15.2 Functions That Test the Cardinality of Sequences
 
161
|_______________________________________________________________________*/
 
162
 
 
163
//15.2.1 fn:zero-or-one
 
164
 
 
165
//15.2.2 fn:one-or-more
 
166
 
 
167
//15.2.3 fn:exactly-one
 
168
 
 
169
 
 
170
/*______________________________________________________________________
 
171
|
 
172
| 15.3 Equals, Union, Intersection and Except
 
173
|_______________________________________________________________________*/
 
174
 
 
175
//15.3.1 fn:deep-equal
 
176
 
 
177
//15.3.2 op:union
 
178
 
 
179
//15.3.3 op:intersect
 
180
 
 
181
//15.3.4 op:except
 
182
 
 
183
 
 
184
/*______________________________________________________________________
 
185
|
 
186
| 15.4 Aggregate Functions
 
187
|_______________________________________________________________________*/
 
188
 
 
189
//15.4.1 fn:count
 
190
 
 
191
//15.4.2 fn:avg
 
192
 
 
193
//15.4.3 fn:max
 
194
 
 
195
 
 
196
//15.4.4 fn:min
 
197
//-------------
 
198
class fn_min : public function
 
199
{
 
200
public:
 
201
        fn_min(const signature&);
 
202
        ~fn_min() {}
 
203
 
 
204
public:
 
205
        sequence_type_t type_check(signature&) const { return xs_untypedValue; }
 
206
        Iterator_t operator()(const yy::location& loc, std::vector<Iterator_t>&) const { return NULL; } 
 
207
        bool validate_args(std::vector<Iterator_t>&) const { return true; }
 
208
 
 
209
};
 
210
 
 
211
 
 
212
/*
 
213
class fn_min_int : public function
 
214
{
 
215
public:
 
216
        fn_min_int(const signature&);
 
217
        ~fn_min_int() {}
 
218
public:
 
219
        sequence_type_t type_check(signature&) const;
 
220
        Iterator_t operator()( vector<Iterator_t>) const;
 
221
};
 
222
 
 
223
class fn_min_float : public function
 
224
{
 
225
public:
 
226
        fn_min_float(const signature&);
 
227
        ~fn_min_float() {}
 
228
public:
 
229
        sequence_type_t type_check(signature&) const;
 
230
        Iterator_t operator()( vector<Iterator_t>) const;
 
231
};
 
232
*/
 
233
 
 
234
 
 
235
//15.4.5 fn:sum
 
236
 
 
237
 
 
238
/*______________________________________________________________________
 
239
|
 
240
| 15.5 Functions and Operators that Generate Sequences
 
241
|_______________________________________________________________________*/
 
242
 
 
243
//15.5.1 op:to
 
244
 
 
245
//15.5.2 fn:id
 
246
 
 
247
//15.5.3 fn:idref
 
248
 
 
249
 
 
250
//15.5.4 fn:doc
 
251
class fn_doc_func : public function
 
252
{
 
253
public:
 
254
        fn_doc_func(const signature&);
 
255
        ~fn_doc_func() {}
 
256
 
 
257
public:
 
258
        sequence_type_t type_check(signature&) const;
 
259
        Iterator_t operator()( const yy::location& loc, std::vector<Iterator_t>&) const;
 
260
        bool validate_args(std::vector<Iterator_t>&) const;
 
261
};
 
262
 
 
263
 
 
264
//15.5.5 fn:doc-available
 
265
 
 
266
//15.5.6 fn:collection
 
267
 
 
268
 
 
269
/*______________________________________________________________________
 
270
|
 
271
| Extensions
 
272
|_______________________________________________________________________*/
 
273
 
 
274
Iterator_t xqp_load(
 
275
        const std::string& path,
 
276
        const std::string& baseuri,
 
277
        const std::string& uri);
 
278
 
 
279
 
 
280
} /* namespace xqp */
 
281
#endif /* XQP_SEQUENCES_H */