Explorar el Código

2006-11-30 Atsushi Enomoto <[email protected]>

	* System.Web.Services.dll.sources :
	  added BasicProfileViolationEnumerator.cs.

	* BasicProfileViolationEnumerator.cs : new missing 2.0 class.
	* BasicProfileViolationCollection.cs : use it.


svn path=/branches/atsushi/mcs/; revision=68731
Atsushi Eno hace 19 años
padre
commit
d32769ae8e

+ 5 - 0
mcs/class/System.Web.Services/ChangeLog

@@ -1,3 +1,8 @@
+2006-11-30  Atsushi Enomoto  <[email protected]>
+
+	* System.Web.Services.dll.sources :
+	  added BasicProfileViolationEnumerator.cs.
+
 2006-11-28  Atsushi Enomoto  <[email protected]>
 
 	* System.Web.Services.dll.sources : added SOAP 1.2 Fault serializer

+ 18 - 4
mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileViolationCollection.cs

@@ -31,21 +31,34 @@
 #if NET_2_0
 
 using System.Collections;
+using System.Collections.Generic;
 
 namespace System.Web.Services.Description
 {
-	public class BasicProfileViolationCollection: CollectionBase
+	public class BasicProfileViolationCollection
+		: CollectionBase, IEnumerable<BasicProfileViolation>
 	{
+		int generation;
+
 		public BasicProfileViolationCollection ()
 		{
 		}
-		
+
+		IEnumerator<BasicProfileViolation> IEnumerable<BasicProfileViolation>.GetEnumerator ()
+		{
+			return new BasicProfileViolationEnumerator (this);
+		}
+
+		internal int Generation {
+			get { return generation; }
+		}
+
 		public BasicProfileViolation this [int index] {
 			get { return (BasicProfileViolation) List [index]; }
 			set { List [index] = value; }
 		}
-		
-		public int Add (BasicProfileViolation violation)
+
+		internal int Add (BasicProfileViolation violation)
 		{
 			return List.Add (violation);
 		}
@@ -67,6 +80,7 @@ namespace System.Web.Services.Description
 
 		public void Insert (int index, BasicProfileViolation violation)
 		{
+			generation++;
 			List.Insert (index, violation);
 		}
 		

+ 81 - 0
mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileViolationEnumerator.cs

@@ -0,0 +1,81 @@
+// 
+// BasicProfileViolationEnumerator.cs
+//
+// Author:
+//	Atsushi Enomoto  <[email protected]>
+//
+// Copyright (C) 2006 Novell, Inc.
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.Collections;
+using System.Collections.Generic;
+
+namespace System.Web.Services.Description
+{
+	public class BasicProfileViolationEnumerator : IEnumerator<BasicProfileViolation>, IDisposable
+	{
+		BasicProfileViolationCollection collection;
+		int current = -1;
+		int generation;
+
+		public BasicProfileViolationEnumerator (BasicProfileViolationCollection collection)
+		{
+			if (collection == null)
+				throw new ArgumentNullException ("collection");
+			this.collection = collection;
+			generation = collection.Generation;
+		}
+
+		public void Dispose ()
+		{
+			collection = null;
+		}
+
+		public bool MoveNext ()
+		{
+			if (generation != collection.Generation)
+				throw new InvalidOperationException ("Collection has changed during the enumeration.");
+			if (current + 1 == collection.Count)
+				return false;
+			current++;
+			return true;
+		}
+
+		public BasicProfileViolation Current {
+			get { return current < 0 ? null : collection [current]; }
+		}
+
+		object IEnumerator.Current {
+			get { return current < 0 ? null : collection [current]; }
+		}
+
+		void IEnumerator.Reset ()
+		{
+			current = -1;
+		}
+	}
+}
+#endif

+ 5 - 0
mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog

@@ -1,3 +1,8 @@
+2006-11-30  Atsushi Enomoto  <[email protected]>
+
+	* BasicProfileViolationEnumerator.cs : new missing 2.0 class.
+	* BasicProfileViolationCollection.cs : use it.
+
 2006-11-28  Atsushi Enomoto  <[email protected]>
 
 	* BasicProfileChecker.cs : reviewed and updated some of the

+ 1 - 0
mcs/class/System.Web.Services/System.Web.Services.dll.sources

@@ -29,6 +29,7 @@ System.Web.Services.Configuration/XmlFormatExtensionPrefixAttribute.cs
 System.Web.Services.Description/BasicProfileChecker.cs
 System.Web.Services.Description/BasicProfileViolation.cs
 System.Web.Services.Description/BasicProfileViolationCollection.cs
+System.Web.Services.Description/BasicProfileViolationEnumerator.cs
 System.Web.Services.Description/Binding.cs
 System.Web.Services.Description/BindingCollection.cs
 System.Web.Services.Description/ConformanceChecker.cs