2004-03-23 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.Security / System.Security.Cryptography.Xml / ReferenceList.cs
1 //
2 // ReferenceList.cs - ReferenceList implementation for XML Encryption
3 // http://www.w3.org/2001/04/xmlenc#sec-ReferenceList
4 //
5 // Author:
6 //      Tim Coleman (tim@timcoleman.com)
7 //
8 // Copyright (C) Tim Coleman, 2004
9
10 #if NET_1_2
11
12 using System.Collections;
13 using System.Xml;
14
15 namespace System.Security.Cryptography.Xml {
16         public sealed class ReferenceList : IList, ICollection, IEnumerable {
17
18                 #region Fields
19
20                 ArrayList list;
21
22                 #endregion // Fields
23
24                 #region Constructors
25
26                 public ReferenceList ()
27                 {
28                         list = new ArrayList ();
29                 }
30         
31                 #endregion // Constructors
32
33                 #region Properties
34
35                 public int Count {
36                         get { return list.Count; }
37                 }
38
39                 object IList.this [int index] {
40                         get { return this [index]; }
41                         set { this [index] = (EncryptedReference) value; }
42                 }
43
44                 public bool IsFixedSize {
45                         get { return list.IsFixedSize; }
46                 }
47
48                 public bool IsReadOnly {
49                         get { return list.IsReadOnly; }
50                 }
51
52                 public bool IsSynchronized {
53                         get { return list.IsSynchronized; }
54                 }
55
56                 public EncryptedReference this [int oid] {
57                         get { return (EncryptedReference) list [oid]; }
58                         set { this [oid] = value; }
59                 }
60
61                 public object SyncRoot {
62                         get { return list.SyncRoot; }
63                 }
64
65                 #endregion // Properties
66
67                 #region Methods
68
69                 public int Add (object value)
70                 {
71                         if (!(value is EncryptedReference))
72                                 throw new ArgumentException ("value");
73                         return list.Add (value);
74                 }
75
76                 public void Clear ()
77                 {
78                         list.Clear ();
79                 }
80
81                 public bool Contains (object value)
82                 {
83                         return list.Contains (value);
84                 }
85
86                 public void CopyTo (Array array, int index)
87                 {
88                         list.CopyTo (array, index);
89                 }
90
91                 public IEnumerator GetEnumerator ()
92                 {
93                         return list.GetEnumerator ();
94                 }
95
96                 public int IndexOf (object value)
97                 {
98                         return list.IndexOf (value);
99                 }
100
101                 public void Insert (int index, object value)
102                 {
103                         if (!(value is EncryptedReference))
104                                 throw new ArgumentException ("value");
105                         list.Insert (index, value);
106                 }
107
108                 public void Remove (object value)
109                 {
110                         list.Remove (value);
111                 }
112
113                 public void RemoveAt (int index)
114                 {
115                         list.RemoveAt (index);
116                 }
117
118                 #endregion // Methods
119         }
120 }
121
122 #endif