**** Merged from MCS ****
[mono-project.git] / mcs / class / Microsoft.Web.Services / Microsoft.Web.Services / SoapOutputFilterCollection.cs
blobcf7c7faca614f78f25f73095a784456c87d1b6fa
1 //
2 // SoapInputFilterCollection.cs: Soap Input Filter Collection
3 //
4 // Author:
5 // Sebastien Pouliot (spouliot@motus.com)
6 //
7 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
8 //
10 using Microsoft.Web.Services;
11 using System;
12 using System.Collections;
14 namespace Microsoft.Web.Services {
16 public class SoapOutputFilterCollection : CollectionBase, ICloneable {
18 public SoapOutputFilterCollection () {}
20 internal SoapOutputFilterCollection (ArrayList list)
22 InnerList.AddRange (list);
25 public SoapOutputFilter this [int index] {
26 get { return (SoapOutputFilter) InnerList [index]; }
29 public int Add (SoapOutputFilter filter)
31 if (filter == null)
32 throw new ArgumentNullException ("filter");
33 return InnerList.Add (filter);
36 public void AddRange (ICollection filters)
38 // can't use list.AddRange because we must check every items
39 // in the collection
40 foreach (object o in filters) {
41 if (! (o is SoapOutputFilter))
42 throw new ArgumentException ("not SoapOutputFilter");
43 // we'll get the ArgumentNullException in Add
44 InnerList.Add (o);
48 // LAMESPEC: Shallow (implemented) or deep clone (todo)
49 public object Clone ()
51 return new SoapOutputFilterCollection ((ArrayList) InnerList.Clone ());
54 public bool Contains (SoapOutputFilter filter)
56 if (filter == null)
57 throw new ArgumentNullException ("filter");
58 return InnerList.Contains (filter);
61 public bool Contains (Type filterType)
63 foreach (object o in InnerList) {
64 if (o.GetType () == filterType)
65 return true;
67 return false;
70 public int IndexOf (SoapOutputFilter filter)
72 if (filter == null)
73 throw new ArgumentNullException ("filter");
74 return InnerList.IndexOf (filter);
77 public int IndexOf (Type filterType)
79 if (filterType == null)
80 throw new ArgumentNullException ("filterType");
81 int i = 0;
82 foreach (object o in InnerList) {
83 if (o.GetType () == filterType)
84 return i;
85 i++;
87 return -1;
90 public void Insert (int index, SoapOutputFilter filter)
92 if (filter == null)
93 throw new ArgumentNullException ("filter");
94 InnerList.Insert (index, filter);
97 public void Remove (SoapOutputFilter filter)
99 if (filter == null)
100 throw new ArgumentNullException ("filter");
101 InnerList.Remove (filter);
104 public void Remove (Type filterType)
106 if (filterType == null)
107 throw new ArgumentNullException ("filterType");
108 int i = 0;
109 foreach (object o in InnerList) {
110 if (o.GetType () == filterType)
111 InnerList.RemoveAt (i);
112 i++;