/* EList_Iterator class declaration.
Copyright (C) 2002-2004 Roberto Bagnara <bagnara@cs.unipr.it>
This file is part of the Parma Watchdog Library (PWL).
The PWL is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
The PWL is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
For the most up-to-date information see
http://www.cs.unipr.it/Software/ . */
#ifndef PWL_EList_Iterator_defs_hh
#define PWL_EList_Iterator_defs_hh 1
#include "EList_Iterator.types.hh"
#include "Doubly_Linked_Object.types.hh"
namespace Parma_Watchdog_Library {
//! Returns <CODE>true</CODE> if and only if \p x and \p y are equal.
template <typename T>
bool operator==(const EList_Iterator<T>& x, const EList_Iterator<T>& y);
//! Returns <CODE>true</CODE> if and only if \p x and \p y are different.
template <typename T>
bool operator!=(const EList_Iterator<T>& x, const EList_Iterator<T>& y);
} // namespace Parma_Watchdog_Library
//! A class providing iterators for embedded lists.
template <typename T>
class Parma_Watchdog_Library::EList_Iterator {
public:
//! Constructs an iterator pointing to nothing.
EList_Iterator();
//! Constructs an iterator pointing to \p p.
explicit EList_Iterator(Doubly_Linked_Object* p);
//! Changes \p *this so that it points to \p p.
EList_Iterator& operator=(Doubly_Linked_Object* p);
//! Indirect member selector.
T* operator->();
//! Dereference operator.
T& operator*();
//! Preincrement operator.
EList_Iterator& operator++();
//! Postincrement operator.
EList_Iterator operator++(int);
//! Predecrement operator.
EList_Iterator& operator--();
//! Postdecrement operator.
EList_Iterator operator--(int);
private:
//! Embedded pointer.
Doubly_Linked_Object* ptr;
friend bool operator==<T>(const EList_Iterator& x, const EList_Iterator& y);
friend bool operator!=<T>(const EList_Iterator& x, const EList_Iterator& y);
};
#include "EList_Iterator.inlines.hh"
#endif // !defined(PWL_EList_Iterator_defs_hh)
syntax highlighted by Code2HTML, v. 0.9.1