00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _SEQUENCE_HPP
00023 #define _SEQUENCE_HPP
00024
00025 #include <vector>
00026
00027 #include <xqilla/framework/XQillaExport.hpp>
00028 #include <xqilla/items/ATDecimalOrDerived.hpp>
00029 #include <xqilla/framework/XPath2MemoryManager.hpp>
00030
00031 #include <xercesc/util/XMemory.hpp>
00032 #include <xercesc/util/PlatformUtils.hpp>
00033
00034 class DynamicContext;
00035
00036 typedef std::vector<Item::Ptr, XQillaAllocator<Item::Ptr> > VectorOfItems;
00037
00041 class XQILLA_API Sequence : public XERCES_CPP_NAMESPACE_QUALIFIER XMemory
00042 {
00043
00044 public:
00045 typedef VectorOfItems::iterator iterator;
00046 typedef VectorOfItems::const_iterator const_iterator;
00047 typedef VectorOfItems::reverse_iterator reverse_iterator;
00048 typedef VectorOfItems::const_reverse_iterator const_reverse_iterator;
00049
00050
00051 Sequence(const Item::Ptr &item, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr =
00052 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
00053
00054 Sequence(XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr =
00055 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
00057 Sequence(size_t n, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr =
00058 XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
00059
00060 Sequence(const Sequence&, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr);
00061
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
00117 #endif