| [6e97e5] | 1 | /*
 | 
|---|
 | 2 |  * SelectiveIterator.hpp
 | 
|---|
 | 3 |  *
 | 
|---|
 | 4 |  *  Created on: Mar 17, 2010
 | 
|---|
 | 5 |  *      Author: crueger
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | #ifndef SELECTIVEITERATOR_HPP_
 | 
|---|
 | 9 | #define SELECTIVEITERATOR_HPP_
 | 
|---|
 | 10 | 
 | 
|---|
| [56f73b] | 11 | // include config.h
 | 
|---|
 | 12 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 13 | #include <config.h>
 | 
|---|
 | 14 | #endif
 | 
|---|
 | 15 | 
 | 
|---|
 | 16 | 
 | 
|---|
| [6e97e5] | 17 | #include <iterator>
 | 
|---|
 | 18 | 
 | 
|---|
 | 19 | template<class _Target,
 | 
|---|
 | 20 |          class _Container,
 | 
|---|
 | 21 |          class _Descriptor>
 | 
|---|
 | 22 | class SelectiveIterator :
 | 
|---|
 | 23 |   public std::iterator<typename std::iterator_traits<typename _Container::iterator>::difference_type,
 | 
|---|
 | 24 |                        typename std::iterator_traits<typename _Container::iterator>::value_type,
 | 
|---|
 | 25 |                        typename std::iterator_traits<typename _Container::iterator>::pointer,
 | 
|---|
 | 26 |                        typename std::iterator_traits<typename _Container::iterator>::reference>
 | 
|---|
 | 27 | {
 | 
|---|
 | 28 | public:
 | 
|---|
 | 29 |   typedef typename _Container::iterator     Iter;
 | 
|---|
 | 30 |   typedef          _Target                  Target;
 | 
|---|
 | 31 |   typedef typename Iter::value_type         value_type;
 | 
|---|
 | 32 |   typedef typename Iter::difference_type    difference_type;
 | 
|---|
 | 33 |   typedef typename Iter::pointer            pointer;
 | 
|---|
 | 34 |   typedef typename Iter::reference          reference;
 | 
|---|
 | 35 |   typedef typename Iter::iterator_category  iterator_category;
 | 
|---|
 | 36 | 
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 |   SelectiveIterator(_Descriptor, _Container&);
 | 
|---|
 | 39 |   SelectiveIterator(_Descriptor, _Container&, Iter);
 | 
|---|
 | 40 |   SelectiveIterator(const SelectiveIterator&);
 | 
|---|
 | 41 |   SelectiveIterator& operator=(const SelectiveIterator&);
 | 
|---|
 | 42 |   SelectiveIterator& operator++();     // prefix
 | 
|---|
 | 43 |   SelectiveIterator  operator++(int);  // postfix with dummy parameter
 | 
|---|
 | 44 |   bool operator==(const SelectiveIterator&);
 | 
|---|
 | 45 |   bool operator!=(const SelectiveIterator&);
 | 
|---|
 | 46 |   Target operator*();
 | 
|---|
 | 47 | 
 | 
|---|
 | 48 |   int getCount();
 | 
|---|
 | 49 | protected:
 | 
|---|
 | 50 |   void advanceState();
 | 
|---|
 | 51 |   Iter state;
 | 
|---|
 | 52 |   typename _Descriptor::impl_ptr descr;
 | 
|---|
 | 53 |   int index;
 | 
|---|
 | 54 | 
 | 
|---|
 | 55 |   _Container &content;
 | 
|---|
 | 56 | };
 | 
|---|
 | 57 | 
 | 
|---|
 | 58 | #endif /* SELECTIVEITERATOR_HPP_ */
 | 
|---|