/******************************************************************************  		
 * Company:         SINED GmbH 
 * Author:          Andriy Kurhanevych
 * Created:         11.05.2007
 * Last modified:   $Modtime: 14.05.07 11:31 $
 * Purpose:         Declaration of the PolygonEnumerator class
 ******************************************************************************/

#ifndef POLYGONLIBRARY_POLYGONENUMERATOR_H
#define POLYGONLIBRARY_POLYGONENUMERATOR_H

namespace PolygonLibrary
{
	class   Polygon;

	//////////////////////////////////////////////////////////////////////////
	/// An iterator over a Polygon collection: points to a Polygon and allows 
	/// to move the pointer over the Polygon collection. 
	/// Initially, the enumerator is positioned before the first element.
	///
	/// The enumerator must not be used after modification of the collection or 
	/// their items.
	//////////////////////////////////////////////////////////////////////////
	class PolygonEnumerator
	{
		
	// --- Interface ---
	public:
		PolygonEnumerator();
		~PolygonEnumerator();
		PolygonEnumerator(const PolygonEnumerator& enumerator);
		PolygonEnumerator& operator=(const PolygonEnumerator& enumerator);
		
		/// Returns the current value of the enumerator pointer.
		/// @exception Exceptions::InvalidOperationException - if the enumerator is not positioned  
		/// at an element of the collection (MoveNext() was not called after creation or Reset() or 
		/// last MoveNext() returned false). 
		Polygon* Current() const;				
		
		/// Advances the enumerator pointer (Current()) to the next Polygon. 
		/// Returns a value indicating if the enumerator was successfully advanced 
		/// (there is a next Polygon).
		bool MoveNext();
		
		/// Sets the enumerator pointer to its initial position,
		/// which is before the first Polygon.
		void Reset();

	// --- Implementation ---
	private:
		friend class PolygonEnumeratorImpl;
		class   PolygonEnumeratorImpl;
		PolygonEnumerator(PolygonEnumeratorImpl* pImpl);	
		PolygonEnumeratorImpl* m_pimpl;		
	};

}
#endif