Files
mono/mcs/class/System.XML/System.Xml.XPath/XPathNodeIterator.cs
T
Piers Haken 0d3a9e6aaf 2002-09-12 Piers Haken <[email protected]>
* Iterator.cs: added NullIterator to handle unspecified contexts
	* XPathNavigator.cs: use NullIterator insted of SelfIterator when context is unspecified.
	* XPathNodeIterator.cs: change default _count to -1 to prevent recalculations for NullIterators

svn path=/trunk/mcs/; revision=7424
2002-09-13 02:35:47 +00:00

64 lines
929 B
C#

//
// System.Xml.XPath.XPathNodeIterator
//
// Author:
// Jason Diamond ([email protected])
//
// (C) 2002 Jason Diamond http://injektilo.org/
//
using System;
namespace System.Xml.XPath
{
public abstract class XPathNodeIterator : ICloneable
{
private int _count = -1;
#region Constructor
protected XPathNodeIterator ()
{
}
#endregion
#region Properties
public virtual int Count
{
get
{
if (_count == -1)
{
// compute and cache the count
XPathNodeIterator tmp = Clone ();
while (tmp.MoveNext ())
;
_count = tmp.CurrentPosition;
}
return _count;
}
}
public abstract XPathNavigator Current { get; }
public abstract int CurrentPosition { get; }
#endregion
#region Methods
public abstract XPathNodeIterator Clone ();
object ICloneable.Clone ()
{
return Clone ();
}
public abstract bool MoveNext ();
#endregion
}
}