This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / mcs / class / Microsoft.Web.Services / Microsoft.Web.Services.Dime / DimeAttachmentCollection.cs
1 //
2 // Microsoft.Web.Services.Dime.DimeAttachmentCollection.cs
3 //
4 // Name: Daniel Kornhauser <dkor@alum.mit.edu>
5 //
6 // Copyright (C) Ximian, Inc. 2003
7 //
8
9 using Microsoft.Web.Services;
10 using System;
11 using System.Collections;
12 using System.Globalization;
13
14 namespace Microsoft.Web.Services.Dime { 
15
16
17         public class DimeAttachmentCollection : CollectionBase
18         {               
19                 
20                 DimeReader reader;              
21
22                 public DimeAttachmentCollection ()
23                 {
24                 }
25
26                 public DimeAttachmentCollection (DimeReader reader)
27                 {
28                         if (reader == null) 
29                                 throw new ArgumentNullException (
30                                         Locale.GetText ("Argument is null."));
31
32
33                         if (reader.CanRead == false) 
34                                 throw new ArgumentException (
35                                         Locale.GetText ("The reader is not readable"));
36
37                         this.reader = reader;
38                 }
39
40                 public DimeAttachment this [int key] {
41                         get {
42                                 return (DimeAttachment) InnerList [key];
43                         }
44                 }
45
46                 public DimeAttachment this [string key] {
47                         get {
48                                 // FIXME: must iterate in collection
49                                 return null;
50                         }
51                 }
52
53                 public void Add (DimeAttachment attachment)
54                 {
55                         InnerList.Add (attachment);
56                 }
57
58                 public void AddRange (ICollection collection)
59                 {
60                         foreach (object o in collection)
61                                 InnerList.Add (o);
62                 }
63                 
64                 public bool Contains (string id)
65                 {
66                         return InnerList.Contains (id);
67                 }
68                 
69                 public void CopyTo (DimeAttachment[] attachments, int index)
70                 {
71                         InnerList.CopyTo (attachments, index);
72                 }
73
74                 public int IndexOf (DimeAttachment attachment)
75                 {
76                         return InnerList.IndexOf(attachment);
77                 }
78
79                 public int IndexOf (string id)
80                 {
81                         return InnerList.IndexOf(id);
82                 }
83
84                 public void Remove (DimeAttachment attachment)
85                 {
86                         InnerList.Remove (attachment);
87                 }
88         }
89 }
90
91