# XQilla Simple API Documentation

- Main Page
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

# Sequence.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Copyright (c) 2001, 2008,
    00003  *     DecisionSoft Limited. All rights reserved.
    00004  * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
    00005  *
    00006  *
    00007  * Licensed under the Apache License, Version 2.0 (the "License");
    00008  * you may not use this file except in compliance with the License.
    00009  * You may obtain a copy of the License at
    00010  *
    00011  *     http://www.apache.org/licenses/LICENSE-2.0
    00012  *
    00013  * Unless required by applicable law or agreed to in writing, software
    00014  * distributed under the License is distributed on an "AS IS" BASIS,
    00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00016  * See the License for the specific language governing permissions and
    00017  * limitations under the License.
    00018  */
    00019
    00020 #ifndef _SEQUENCE_HPP
    00021 #define _SEQUENCE_HPP
    00022
    00023 #include <vector>
    00024
    00025 #include <xqilla/framework/XQillaExport.hpp>
    00026 #include <xqilla/items/ATDecimalOrDerived.hpp>
    00027 #include <xqilla/framework/XPath2MemoryManager.hpp>
    00028
    00029 #include <xercesc/util/XMemory.hpp>
    00030 #include <xercesc/util/PlatformUtils.hpp>
    00031
    00032 class DynamicContext;
    00033
    00034 typedef std::vector<Item::Ptr, XQillaAllocator<Item::Ptr> > VectorOfItems;
    00035
    00039 class XQILLA_API Sequence : public XERCES_CPP_NAMESPACE_QUALIFIER XMemory
    00040 {
    00041
    00042 public:
    00043   typedef VectorOfItems::iterator iterator;
    00044   typedef VectorOfItems::const_iterator const_iterator;
    00045   typedef VectorOfItems::reverse_iterator reverse_iterator;
    00046   typedef VectorOfItems::const_reverse_iterator const_reverse_iterator;
    00047
    00048   // constructor that takes one Item
    00049   Sequence(const Item::Ptr &item, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr =
    00050            XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
    00051   // constructor that creates a empty sequence
    00052   Sequence(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr =
    00053            XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
    00055   Sequence(size_t n, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr =
    00056            XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
    00057   Sequence(const Sequence&, size_t start, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr =
    00058            XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
    00059   // copy constructor
    00060   Sequence(const Sequence&, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr);
    00061   // copy constructor
    00062   Sequence(const Sequence&);
    00063   Sequence &operator=(const Sequence &);
    00064
    00065   ~Sequence();
    00066
    00067   void clear();
    00068
    00069   const Item::Ptr &first() const;
    00070   const Item::Ptr &second() const;
    00071
    00073   Sequence::iterator begin(void);
    00074   Sequence::const_iterator begin(void) const;
    00075
    00077   Sequence::iterator end(void);
    00078   Sequence::const_iterator end(void) const;
    00079
    00081   Sequence::reverse_iterator rbegin(void);
    00082   Sequence::const_reverse_iterator rbegin(void) const;
    00083
    00084   Sequence::reverse_iterator rend(void);
    00085   Sequence::const_reverse_iterator rend(void) const;
    00086
    00088   size_t getLength(void) const;
    00089
    00091   const Item::Ptr &item(size_t index) const;
    00093   const Item::Ptr &item(const ATDecimalOrDerived::Ptr &index) const;
    00094
    00096   void addItem(const Item::Ptr &item);
    00097
    00099   void addItemFront(const Item::Ptr &item);
    00100
    00102   void joinSequence(const Sequence & s);
    00103
    00105   bool isEmpty() const;
    00106
    00108   void sortIntoDocumentOrder(const DynamicContext *context);
    00109
    00111   void sortWithCollation(const Collation *collation, const DynamicContext *context);
    00112
    00113 private:
    00114   VectorOfItems _itemList;
    00115
    00116   friend class SequenceResult;
    00117 };
    00118
    00119 #endif