00001 /* 00002 * Copyright (c) [2004-2009] Novell, Inc. 00003 * 00004 * All Rights Reserved. 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of version 2 of the GNU General Public License as published 00008 * by the Free Software Foundation. 00009 * 00010 * This program is distributed in the hope that it will be useful, but WITHOUT 00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 * more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, contact Novell, Inc. 00017 * 00018 * To contact Novell about this file by physical or electronic mail, you may 00019 * find current contact information at www.novell.com. 00020 */ 00021 00022 00023 #ifndef DEREF_ITERATOR_H 00024 #define DEREF_ITERATOR_H 00025 00026 #include "y2storage/AppUtil.h" 00027 00028 namespace storage 00029 { 00030 00031 template< class Iter, class Value > 00032 class DerefIterator : public Iter 00033 { 00034 public: 00035 typedef Value value_type; 00036 typedef Value& reference; 00037 typedef Value* pointer; 00038 typedef typename Iter::difference_type difference_type; 00039 typedef typename Iter::iterator_category iterator_category; 00040 00041 DerefIterator() {} 00042 00043 DerefIterator( const Iter& i ) : Iter(i) {} 00044 00045 DerefIterator& operator++() { Iter::operator++(); return(*this); } 00046 DerefIterator operator++(int) 00047 { 00048 y2war( "Expensive ++ DerefIterator" ); 00049 DerefIterator tmp(*this); 00050 Iter::operator++(); 00051 return(tmp); 00052 } 00053 DerefIterator& operator--() { Iter::operator--(); return(*this); } 00054 DerefIterator operator--(int) 00055 { 00056 y2war( "Expensive -- DerefIterator" ); 00057 DerefIterator tmp(*this); 00058 Iter::operator--(); 00059 return(tmp); 00060 } 00061 00062 reference operator*() const 00063 { 00064 return( *Iter::operator*() ); 00065 } 00066 00067 pointer operator->() const 00068 { 00069 return( Iter::operator*() ); 00070 } 00071 }; 00072 00073 } 00074 00075 #endif
1.5.6