SourceForge.net Logo
Sequence.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 _SEQUENCE_HPP
21#define _SEQUENCE_HPP
22
23#include <vector>
24
25#include <xqilla/framework/XQillaExport.hpp>
28
31
32class DynamicContext;
33
34typedef std::vector<Item::Ptr, XQillaAllocator<Item::Ptr> > VectorOfItems;
35
39class XQILLA_API Sequence : public XERCES_CPP_NAMESPACE_QUALIFIER XMemory
40{
41
42public:
43 typedef VectorOfItems::iterator iterator;
44 typedef VectorOfItems::const_iterator const_iterator;
45 typedef VectorOfItems::reverse_iterator reverse_iterator;
46 typedef VectorOfItems::const_reverse_iterator const_reverse_iterator;
47
48 // constructor that takes one Item
49 Sequence(const Item::Ptr &item, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr =
50 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
51 // constructor that creates a empty sequence
52 Sequence(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr =
53 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
55 Sequence(size_t n, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr =
56 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
57 Sequence(const Sequence&, size_t start, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr =
58 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
59 // copy constructor
60 Sequence(const Sequence&, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr);
61 // copy constructor
64
66
67 void clear();
68
69 const Item::Ptr &first() const;
70 const Item::Ptr &second() const;
71
75
79
83
86
88 size_t getLength(void) const;
89
91 const Item::Ptr &item(size_t index) const;
93 const Item::Ptr &item(const ATDecimalOrDerived::Ptr &index) const;
94
96 void addItem(const Item::Ptr &item);
97
99 void addItemFront(const Item::Ptr &item);
100
102 void joinSequence(const Sequence & s);
103
105 bool isEmpty() const;
106
109
111 void sortWithCollation(const Collation *collation, const DynamicContext *context);
112
113private:
114 VectorOfItems _itemList;
115
116 friend class SequenceResult;
117};
118
119#endif
std::vector< Item::Ptr, XQillaAllocator< Item::Ptr > > VectorOfItems
Definition Sequence.hpp:34
Definition Collation.hpp:30
The execution time dynamic context interface.
Definition DynamicContext.hpp:39
An eagerly evaluated result of a query execution.
Definition Sequence.hpp:40
const Item::Ptr & item(const ATDecimalOrDerived::Ptr &index) const
Return the indexth item in the collection - takes ATDecimalOrDerived.
Sequence(const Sequence &, xercesc::MemoryManager *memMgr)
void addItem(const Item::Ptr &item)
add an item to this sequence
Sequence(const Sequence &, size_t start, xercesc::MemoryManager *memMgr=xercesc::XMLPlatformUtils::fgMemoryManager)
VectorOfItems::iterator iterator
Definition Sequence.hpp:43
Sequence(const Item::Ptr &item, xercesc::MemoryManager *memMgr=xercesc::XMLPlatformUtils::fgMemoryManager)
Sequence::iterator end(void)
Find the end of the iterator.
VectorOfItems::reverse_iterator reverse_iterator
Definition Sequence.hpp:45
void clear()
const Item::Ptr & second() const
Sequence(size_t n, xercesc::MemoryManager *memMgr=xercesc::XMLPlatformUtils::fgMemoryManager)
construct and reserve space for n elements
Sequence & operator=(const Sequence &)
VectorOfItems::const_iterator const_iterator
Definition Sequence.hpp:44
void addItemFront(const Item::Ptr &item)
add an item to this sequence
Sequence::const_iterator begin(void) const
void sortIntoDocumentOrder(const DynamicContext *context)
sort into document order (only works for Sequences containing only Nodes)
Sequence(const Sequence &)
size_t getLength(void) const
Returns the number of nodes in the list
VectorOfItems::const_reverse_iterator const_reverse_iterator
Definition Sequence.hpp:46
Sequence::const_iterator end(void) const
void joinSequence(const Sequence &s)
combine another sequence onto this sequence
Sequence(xercesc::MemoryManager *memMgr=xercesc::XMLPlatformUtils::fgMemoryManager)
Sequence::reverse_iterator rend(void)
const Item::Ptr & first() const
Sequence::iterator begin(void)
Begin an iterator.
Sequence::reverse_iterator rbegin(void)
Reverse iterator methods.
const Item::Ptr & item(size_t index) const
Return the indexth item in the collection.
Sequence::const_reverse_iterator rend(void) const
void sortWithCollation(const Collation *collation, const DynamicContext *context)
sort as strings, using the given collation
bool isEmpty() const
Returns true if the list is empty.
Sequence::const_reverse_iterator rbegin(void) const