mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 03:51:19 -10:00
* 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
64 lines
929 B
C#
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
|
|
}
|
|
}
|