Zorba
The XQuery Processor
Documentation
Live Demo
Modules
Download
Tools
Blog
Code
Main Page
Related Pages
Classes
Files
Examples
File List
swig
Collection.h
Go to the documentation of this file.
1
/*
2
* Copyright 2006-2012 The FLWOR Foundation.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
#ifndef API_COLLECTION_H
17
#define API_COLLECTION_H
18
19
/** \brief A Collection is a persistent sequence of node items.
20
*
21
* Instances of this class can be used to modify or retrieve the contents
22
* of a collection.
23
*
24
* The variable aNodes passed to any of the insert functions is evaluated
25
* as though it were an enclosed expression in an element constructor.
26
* The result of this step is a sequence of nodes to be inserted into the collection.
27
*
28
*/
29
class
Collection
30
{
31
private
:
32
zorba::Collection_t theCollection;
33
34
public
:
35
Collection
(
const
Collection
& aMgr) : theCollection(aMgr.theCollection) {}
36
Collection
(zorba::Collection* aMgr) : theCollection(aMgr) {}
37
38
/**
39
* This function returns the sequence of nodes of the collection.
40
*
41
* @return The sequence contained in the given collection.
42
*
43
*/
44
ItemSequence
contents
();
45
46
/**
47
* This function deletes the first node from a collection.
48
*
49
* @throw XDDY0011 if the collection doesn't contain any node.
50
*
51
*/
52
void
deleteNodeFirst
();
53
54
/**
55
* This function deletes the last node from a collection.
56
*
57
* @throw XDDY0011 if the collection doesn't contain any node.
58
*
59
*/
60
void
deleteNodeLast
();
61
62
/**
63
* This function deletes zero of more nodes from a collection.
64
*
65
* @param aNodes the nodes in the collection that should be deleted.
66
*
67
* @throw XDDY0011 if any nodes in the given sequence is not a member of a collection
68
* or not all nodes of the sequence belong to the same collection.
69
*
70
*/
71
void
deleteNodes
(
const
ItemSequence
&aNodes );
72
73
/**
74
* This function deletes the n first nodes from a collection.
75
*
76
* @throw XDDY0011 if the collection doesn't contain any node.
77
*
78
*/
79
void
deleteNodesFirst
(
unsigned
long
aNumNodes );
80
81
/**
82
* This function deletes the n last nodes from a collection.
83
*
84
* @throw XDDY0011 if the collection doesn't contain any node.
85
*
86
*/
87
void
deleteNodesLast
(
unsigned
long
aNumNodes );
88
89
/**
90
* \brief Get the name of the collection.
91
*
92
* @return The name of the collection.
93
*/
94
Item
getName
();
95
96
/**
97
* Retrieves the sequence type for this (static declared) collection.
98
*
99
* @return the sequence type for the said collection, or 0
100
* if this collection is not statically declared.
101
*
102
* @see isStatic()
103
*/
104
TypeIdentifier
getType
();
105
106
/**
107
* This function returns the index of the given node in the collection.
108
*
109
* @param aNode The node to retrieve the index from.
110
*
111
* @return Returns the position of the given node in the collection.
112
*
113
* @throw XDDY0011 if node is not contained in any collection.
114
*
115
*/
116
long
long
indexOf
(
const
Item
&aNode );
117
118
/**
119
* This function inserts copies of the given
120
* nodes into a collection at the position directly following the
121
* given target node.
122
*
123
* @param aTarget the node in the collection after which the
124
* sequence should be inserted.
125
* @param aNodes The sequences of nodes whose copies should
126
* be added to the collection.
127
*
128
* @throw XDDY0011 if any nodes in the sequence is not a member of a collection
129
* or not all nodes of the sequence belong to the same collection.
130
*
131
*/
132
void
insertNodesAfter
(
const
Item
&aTarget,
const
ItemSequence
&aNodes );
133
134
/**
135
* This function inserts copies of the given
136
* nodes into a collection at the position directly preceding the
137
* given target node.
138
*
139
* @param aTarget the node in the collection before which the
140
* sequence should be inserted.
141
* @param aNodes The sequences of nodes whose copies should
142
* be added to the collection.
143
*
144
* @throw XDDY0011 if any nodes in the sequence is not a member of a collection
145
* or not all nodes of the sequence belong to the same collection.
146
*
147
*/
148
void
insertNodesBefore
(
const
Item
&aTarget,
const
ItemSequence
&aNodes );
149
150
/**
151
* This function inserts copies of the
152
* given nodes at the beginning of the collection.
153
*
154
* @param aNodes The sequences of nodes whose copies
155
* should be added to the collection.
156
*
157
*/
158
void
insertNodesFirst
(
const
ItemSequence
&aNodes );
159
160
/**
161
* This function inserts copies of the
162
* given nodes at the end of the collection.
163
*
164
* @param aNodes The sequences of nodes whose copies
165
* should be added to the collection.
166
*
167
*/
168
void
insertNodesLast
(
const
ItemSequence
&aNodes );
169
170
/**
171
* The function checks if this collection has been statically declared.
172
*
173
* @return true if the collection is a static collection, false otherwise.
174
*/
175
bool
isStatic
();
176
177
//void registerDiagnosticHandler(DiagnosticHandler *aDiagnosticHandler );
178
};
179
180
#endif
Please enable JavaScript to view the
comments powered by Disqus.
blog comments powered by
Disqus