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 "storage/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 template< class It > 00044 DerefIterator( const It& i ) : Iter(i) {} 00045 00046 DerefIterator& operator++() { Iter::operator++(); return(*this); } 00047 DerefIterator operator++(int) 00048 { 00049 y2war( "Expensive ++ DerefIterator" ); 00050 DerefIterator tmp(*this); 00051 Iter::operator++(); 00052 return(tmp); 00053 } 00054 DerefIterator& operator--() { Iter::operator--(); return(*this); } 00055 DerefIterator operator--(int) 00056 { 00057 y2war( "Expensive -- DerefIterator" ); 00058 DerefIterator tmp(*this); 00059 Iter::operator--(); 00060 return(tmp); 00061 } 00062 00063 reference operator*() const 00064 { 00065 return( *Iter::operator*() ); 00066 } 00067 00068 pointer operator->() const 00069 { 00070 return( Iter::operator*() ); 00071 } 00072 }; 00073 00074 } 00075 00076 #endif
1.5.6