SourceForge.net Logo

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-2008
00005  *     Oracle. All rights reserved.
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  * $Id: Sequence.hpp 475 2008-01-08 18:47:44Z jpcs $
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   // constructor that takes one Item
00051   Sequence(const Item::Ptr &item, XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* memMgr =
00052            XERCES_CPP_NAMESPACE_QUALIFIER XMLPlatformUtils::fgMemoryManager);
00053   // constructor that creates a empty sequence
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   // 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 
00117 #endif

Generated on Mon Apr 28 16:40:48 2008 for XQilla Simple API by  doxygen 1.5.1