* SearchResultCollection.cs: Add a few more stubs.
[mono.git] / mcs / class / System.DirectoryServices / System.DirectoryServices / SearchResultCollection.cs
1 /******************************************************************************
2 * The MIT License
3 * Copyright (c) 2003 Novell Inc.,  www.novell.com
4
5 * Permission is hereby granted, free of charge, to any person obtaining  a copy
6 * of this software and associated documentation files (the Software), to deal
7 * in the Software without restriction, including  without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
9 * copies of the Software, and to  permit persons to whom the Software is 
10 * furnished to do so, subject to the following conditions:
11
12 * The above copyright notice and this permission notice shall be included in 
13 * all copies or substantial portions of the Software.
14
15 * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *******************************************************************************/
23
24 //
25 // System.DirectoryServices.SearchResultCollection.cs
26 //
27 // Author:
28 //   Sunil Kumar (sunilk@novell.com)
29 //
30 // (C)  Novell Inc.
31 //
32
33 using System;
34 using System.Collections;
35
36 namespace System.DirectoryServices
37 {
38         /// <summary>
39         /// Contains the SearchResult instances that the Active Directory 
40         /// hierarchy returned during a DirectorySearcher query.
41         /// </summary>
42         /// <remarks>
43         /// Each time you perform a query, DirectorySearcher creates a handle to 
44         /// the corresponding SearchResultCollection instance. This handle 
45         /// persists until you call Dispose or until garbage collection picks up 
46         /// the instance.
47         /// </remarks>
48         public class SearchResultCollection : MarshalByRefObject, ICollection, IEnumerable, IDisposable
49         {
50                 protected ArrayList sValues = new ArrayList();
51
52
53                 internal SearchResultCollection()
54                 {
55                 }
56                 
57                 public int Count
58                 {
59                         get{return sValues.Count;}
60                 }
61
62                 bool ICollection.IsSynchronized
63                 {
64                         get{return sValues.IsSynchronized;}
65                 }
66
67                 object ICollection.SyncRoot
68                 {
69                         get{return sValues.SyncRoot;}
70                 }
71         
72                 void ICollection.CopyTo(System.Array oArray, int iArrayIndex)
73                 {
74                         sValues.CopyTo(oArray, iArrayIndex);
75                 }
76
77                 public void CopyTo(SearchResult[] results, int index)
78                 {
79                         ((ICollection) this).CopyTo((System.Array)results,index);
80                 }
81
82                 internal void Add(object oValue)
83                 {
84                         sValues.Add(oValue);
85                 }
86 /*
87                 public bool IsFixedSize
88                 {
89                         get{return m_oKeys.IsFixedSize;}
90                 }
91
92                 public bool IsReadOnly
93                 {
94                         get{return m_oKeys.IsReadOnly;}
95                 }
96
97                 public ICollection Keys
98                 {
99                         get{return m_oValues.Keys;}
100                 }
101         
102                 public void Clear()
103                 {
104                         m_oValues.Clear();
105                         m_oKeys.Clear();
106                 }
107
108                 public bool Contains(object oKey)
109                 {
110                         return m_oValues.Contains(oKey);
111                 }
112
113                 public bool ContainsKey(object oKey)
114                 {
115                         return m_oValues.ContainsKey(oKey);
116                 }
117
118                 public IDictionaryEnumerator GetEnumerator()
119                 {
120                         return m_oValues.GetEnumerator();
121                 }    
122
123                 public void Remove(object oKey)
124                 {
125                         m_oValues.Remove(oKey);
126                         m_oKeys.Remove(oKey);
127                 }
128        
129                 public object this[object oKey]
130                 {
131                         get{return m_oValues[oKey];}
132                         set{m_oValues[oKey] = value;}
133                 }
134 */
135                 bool Contains(object oValues)
136                 {
137                         return sValues.Contains(oValues);
138                 }
139
140                 public bool Contains(SearchResult result)
141                 {
142                         return Contains(result);
143                 }
144
145                 public SearchResult this[int index]
146                 {
147                         get{return (SearchResult)sValues[index];}
148                 }
149
150 /*              public ICollection Values
151                 {
152                         get{return m_oValues.Values;}
153                 }
154 */
155                 public int IndexOf (SearchResult result)
156                 {
157                         return sValues.IndexOf(result);
158                 }
159
160                 public IEnumerator GetEnumerator()
161                 {
162                         return sValues.GetEnumerator();
163                 }
164
165                 public void Dispose ()
166                 {
167                 }
168
169                 public string[] PropertiesLoaded
170                 {
171                         [MonoTODO]
172                         get { throw new NotImplementedException (); }
173                 }
174
175                 IntPtr Handle
176                 {
177                         [MonoTODO]
178                         get { throw new NotImplementedException (); }
179                 }
180         }
181 }
182