(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / System.Web.Services / System.Web.Services.Description / ServiceDescriptionFormatExtensionCollection.cs
blob83d762c4f98f6597e3a8e2130910be67c03bdd02
1 //
2 // System.Web.Services.Description.ServiceDescriptionFormatExtensionCollection.cs
3 //
4 // Author:
5 // Tim Coleman (tim@timcoleman.com)
6 //
7 // Copyright (C) Tim Coleman, 2002
8 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 //
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 //
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Collections;
32 using System.Web.Services;
33 using System.Xml;
35 namespace System.Web.Services.Description {
36 public sealed class ServiceDescriptionFormatExtensionCollection : ServiceDescriptionBaseCollection {
38 #region Constructors
40 public ServiceDescriptionFormatExtensionCollection (object parent)
41 : base (parent)
45 #endregion // Constructors
47 #region Properties
49 public object this [int index] {
50 get {
51 if (index < 0 || index > Count)
52 throw new ArgumentOutOfRangeException ();
54 return List[index];
56 set { List[index] = value; }
59 #endregion // Properties
61 #region Methods
63 public int Add (object extension)
65 Insert (Count, extension);
66 return (Count - 1);
69 public bool Contains (object extension)
71 return List.Contains (extension);
74 public void CopyTo (object[] array, int index)
76 List.CopyTo (array, index);
79 public object Find (Type type)
81 foreach (object value in List)
82 if (type.IsAssignableFrom (value.GetType ()))
83 return value;
84 return null;
87 public XmlElement Find (string name, string ns)
89 XmlElement xmlElement;
90 foreach (object value in List)
91 if (value is XmlElement) {
92 xmlElement = (value as XmlElement);
93 if (xmlElement.Name == name && xmlElement.NamespaceURI == ns)
94 return xmlElement;
96 return null;
99 public object[] FindAll (Type type)
101 ArrayList searchResults = new ArrayList ();
102 foreach (object value in List)
103 if (value.GetType () == type)
104 searchResults.Add (value);
105 object[] returnValue = new object [searchResults.Count];
107 if (searchResults.Count > 0)
108 searchResults.CopyTo (returnValue);
110 return returnValue;
113 public XmlElement[] FindAll (string name, string ns)
115 ArrayList searchResults = new ArrayList ();
116 XmlElement xmlElement;
118 foreach (object value in List)
119 if (value is XmlElement) {
120 xmlElement = (value as XmlElement);
121 if (xmlElement.Name == name && xmlElement.NamespaceURI == ns)
122 searchResults.Add (xmlElement);
125 XmlElement[] returnValue = new XmlElement [searchResults.Count];
127 if (searchResults.Count > 0)
128 searchResults.CopyTo (returnValue);
130 return returnValue;
133 public int IndexOf (object extension)
135 return List.IndexOf (extension);
138 public void Insert (int index, object extension)
140 List.Insert (index, extension);
143 [MonoTODO]
144 public bool IsHandled (object item)
146 throw new NotImplementedException ();
149 [MonoTODO]
150 public bool IsRequired (object item)
152 throw new NotImplementedException ();
155 protected override void OnValidate (object value)
157 if (value == null)
158 throw new ArgumentNullException ();
159 if (!(value is XmlElement || value is ServiceDescriptionFormatExtension))
160 throw new ArgumentException ();
163 public void Remove (object extension)
165 List.Remove (extension);
168 protected override void SetParent (object value, object parent)
170 ((ServiceDescriptionFormatExtension) value).SetParent (parent);
173 #endregion // Methods