--- /dev/null
+//
+// System.Text.RegularExpressions.CaptureCollection
+//
+// Authors:
+// Dan Lewis (dlewis@gmx.co.uk)
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Dan Lewis
+// (C) 2004 Novell, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions
+{
+ [Serializable]
+ public class CaptureCollection: ICollection, IEnumerable
+ {
+ private ArrayList list;
+
+ /* No public constructor */
+ internal CaptureCollection () {
+ list = new ArrayList ();
+ }
+
+ public virtual int Count {
+ get {
+ return(list.Count);
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return(true);
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return(false);
+ }
+ }
+
+ public Capture this[int i] {
+ get {
+ if (i < 0 ||
+ i > Count) {
+ throw new ArgumentOutOfRangeException ("Index is out of range");
+ }
+
+ return((Capture)list[i]);
+ }
+ }
+
+ public virtual object SyncRoot {
+ get {
+ return(list);
+ }
+ }
+
+ public virtual void CopyTo (Array array, int index) {
+ foreach (object o in list) {
+ if (index > array.Length) {
+ break;
+ }
+
+ array.SetValue (o, index++);
+ }
+ }
+
+ public virtual IEnumerator GetEnumerator () {
+ return(new Enumerator (list));
+ }
+
+ internal void Add (object o) {
+ list.Add (o);
+ }
+
+ internal void Reverse () {
+ list.Reverse ();
+ }
+
+ private class Enumerator: IEnumerator {
+ private IList list;
+ private int ptr;
+
+ public Enumerator (IList list) {
+ this.list = list;
+ Reset ();
+ }
+
+ public object Current {
+ get {
+ if (ptr >= list.Count) {
+ throw new InvalidOperationException ();
+ }
+
+ return(list[ptr]);
+ }
+ }
+
+ public bool MoveNext () {
+ if (ptr > list.Count) {
+ throw new InvalidOperationException ();
+ }
+
+ return(++ptr < list.Count);
+ }
+
+ public void Reset () {
+ ptr = -1;
+ }
+ }
+ }
+}
+
+
+
+2004-05-12 Dick Porter <dick@ximian.com>
+
+ * GroupCollection.cs:
+ * MatchCollection.cs:
+ * CaptureCollection.cs: Moved GroupCollection, MatchCollection and
+ CaptureCollection so that they no longer inherit from the
+ non-standard RegexCollectionBase class. Fixes the API difference.
+
2004-04-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* arch.cs:
--- /dev/null
+//
+// System.Text.RegularExpressions.GroupCollection
+//
+// Authors:
+// Dan Lewis (dlewis@gmx.co.uk)
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Dan Lewis
+// (C) 2004 Novell, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions
+{
+ [Serializable]
+ public class GroupCollection: ICollection, IEnumerable
+ {
+ private ArrayList list;
+
+ /* No public constructor */
+ internal GroupCollection () {
+ list = new ArrayList ();
+ }
+
+ public virtual int Count {
+ get {
+ return(list.Count);
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return(true);
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return(false);
+ }
+ }
+
+ public Group this[int i] {
+ get {
+ if (i < list.Count &&
+ i >= 0) {
+ return((Group)list[i]);
+ } else {
+ return(new Group ());
+ }
+ }
+ }
+
+ public Group this[string groupName] {
+ get {
+ foreach (object o in list) {
+ if (!(o is Match)) {
+ continue;
+ }
+
+ int index = ((Match)o).Regex.GroupNumberFromName (groupName);
+
+ if (index != -1) {
+ return(this[index]);
+ }
+ }
+
+ return(new Group ());
+ }
+ }
+
+ public virtual object SyncRoot {
+ get {
+ return(list);
+ }
+ }
+
+ public virtual void CopyTo (Array array, int index) {
+ foreach (object o in list) {
+ if (index > array.Length) {
+ break;
+ }
+
+ array.SetValue (o, index++);
+ }
+ }
+
+ public virtual IEnumerator GetEnumerator () {
+ return(new Enumerator (list));
+ }
+
+ internal void Add (object o) {
+ list.Add (o);
+ }
+
+ internal void Reverse () {
+ list.Reverse ();
+ }
+
+ private class Enumerator: IEnumerator {
+ private IList list;
+ private int ptr;
+
+ public Enumerator (IList list) {
+ this.list = list;
+ Reset ();
+ }
+
+ public object Current {
+ get {
+ if (ptr >= list.Count) {
+ throw new InvalidOperationException ();
+ }
+
+ return(list[ptr]);
+ }
+ }
+
+ public bool MoveNext () {
+ if (ptr > list.Count) {
+ throw new InvalidOperationException ();
+ }
+
+ return(++ptr < list.Count);
+ }
+
+ public void Reset () {
+ ptr = -1;
+ }
+ }
+ }
+}
+
+
+
--- /dev/null
+//
+// System.Text.RegularExpressions.MatchCollection
+//
+// Authors:
+// Dan Lewis (dlewis@gmx.co.uk)
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Dan Lewis
+// (C) 2004 Novell, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions
+{
+ [Serializable]
+ public class MatchCollection: ICollection, IEnumerable
+ {
+ private ArrayList list;
+
+ /* No public constructor */
+ internal MatchCollection () {
+ list = new ArrayList ();
+ }
+
+ public virtual int Count {
+ get {
+ return(list.Count);
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return(true);
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return(false);
+ }
+ }
+
+ public Match this[int i] {
+ get {
+ if (i < 0 ||
+ i > Count) {
+ throw new ArgumentOutOfRangeException ("Index is out of range");
+ }
+
+ return((Match)list[i]);
+ }
+ }
+
+ public virtual object SyncRoot {
+ get {
+ return(list);
+ }
+ }
+
+ public virtual void CopyTo (Array array, int index) {
+ foreach (object o in list) {
+ if (index > array.Length) {
+ break;
+ }
+
+ array.SetValue (o, index++);
+ }
+ }
+
+ public virtual IEnumerator GetEnumerator () {
+ return(new Enumerator (list));
+ }
+
+ internal void Add (object o) {
+ list.Add (o);
+ }
+
+ internal void Reverse () {
+ list.Reverse ();
+ }
+
+ private class Enumerator: IEnumerator {
+ private IList list;
+ private int ptr;
+
+ public Enumerator (IList list) {
+ this.list = list;
+ Reset ();
+ }
+
+ public object Current {
+ get {
+ if (ptr >= list.Count) {
+ throw new InvalidOperationException ();
+ }
+
+ return(list[ptr]);
+ }
+ }
+
+ public bool MoveNext () {
+ if (ptr > list.Count) {
+ throw new InvalidOperationException ();
+ }
+
+ return(++ptr < list.Count);
+ }
+
+ public void Reset () {
+ ptr = -1;
+ }
+ }
+ }
+}
+
+
+
+++ /dev/null
-//\r
-// assembly: System\r
-// namespace: System.Text.RegularExpressions\r
-// file: collections.cs\r
-//\r
-// author: Dan Lewis (dlewis@gmx.co.uk)\r
-// (c) 2002\r
-\r
-using System;\r
-using System.Collections;\r
-\r
-namespace System.Text.RegularExpressions {\r
- public abstract class RegexCollectionBase : ICollection, IEnumerable {\r
- public int Count {\r
- get { return list.Count; }\r
- }\r
-\r
- public bool IsReadOnly {\r
- get { return true; } // FIXME\r
- }\r
-\r
- public bool IsSynchronized {\r
- get { return false; } // FIXME\r
- }\r
-\r
- public object SyncRoot {\r
- get { return list; } // FIXME\r
- }\r
-\r
- public void CopyTo (Array array, int index) {\r
- foreach (Object o in list) {\r
- if (index > array.Length)\r
- break;\r
- \r
- array.SetValue (o, index ++);\r
- }\r
- }\r
-\r
- public IEnumerator GetEnumerator () {\r
- return new Enumerator (list);\r
- }\r
-\r
- // internal methods\r
-\r
- internal RegexCollectionBase () {\r
- list = new ArrayList ();\r
- }\r
-\r
- internal void Add (Object o) {\r
- list.Add (o);\r
- }\r
-\r
- internal void Reverse () {\r
- list.Reverse ();\r
- }\r
-\r
- // IEnumerator implementation\r
-\r
- private class Enumerator : IEnumerator {\r
- public Enumerator (IList list) {\r
- this.list = list;\r
- Reset ();\r
- }\r
-\r
- public object Current {\r
- get {\r
- if (ptr >= list.Count)\r
- throw new InvalidOperationException ();\r
-\r
- return list[ptr];\r
- }\r
- }\r
-\r
- public bool MoveNext () {\r
- if (ptr > list.Count)\r
- throw new InvalidOperationException ();\r
- \r
- return ++ ptr < list.Count;\r
- }\r
-\r
- public void Reset () {\r
- ptr = -1;\r
- }\r
-\r
- private IList list;\r
- private int ptr;\r
- }\r
-\r
- // protected fields\r
-\r
- protected ArrayList list;\r
- }\r
-\r
- [Serializable]\r
- public class CaptureCollection : RegexCollectionBase, ICollection, IEnumerable {\r
- public Capture this[int i] {\r
- get { return (Capture)list[i]; }\r
- }\r
-\r
- internal CaptureCollection () {\r
- }\r
- }\r
-\r
- [Serializable]\r
- public class GroupCollection : RegexCollectionBase, ICollection, IEnumerable {\r
- public Group this[int i] {\r
- get { \r
- if (i < list.Count && i >= 0) \r
- return (Group)list[i]; \r
- else\r
- return new Group ();\r
- }\r
- }\r
- \r
- public Group this[string groupName] {\r
- get {\r
- foreach (object o in list) {\r
- if (!(o is Match))\r
- continue;\r
-\r
- int index = ((Match) o).Regex.GroupNumberFromName (groupName);\r
- if (index != -1)\r
- return this [index];\r
- }\r
-\r
- return new Group ();\r
- }\r
- }\r
- \r
- internal GroupCollection () {\r
- }\r
- }\r
-\r
- [Serializable]\r
- public class MatchCollection : RegexCollectionBase, ICollection, IEnumerable {\r
- public virtual Match this[int i] {\r
- get { return (Match)list[i]; }\r
- }\r
-\r
- internal MatchCollection () {\r
- }\r
- }\r
-}\r