2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / class / System / System.ComponentModel / TypeConverter.cs
1 //
2 // System.ComponentModel.TypeConverter
3 //
4 // Authors:
5 //      Gonzalo Paniagua Javier (gonzalo@ximian.com)
6 //
7 // (C) 2002 Ximian, Inc (http://www.ximian.com)
8 //
9
10 using System;
11 using System.Collections;
12 using System.Globalization;
13
14 namespace System.ComponentModel {
15
16 [MonoTODO("Only has the minimal implementation needed to use ColorConverter")]
17 public class TypeConverter
18 {
19         public TypeConverter ()
20         {
21         }
22
23         public bool CanConvertFrom (Type sourceType)
24         {
25                 return CanConvertFrom (null, sourceType);
26         }
27         
28         [MonoTODO]
29         public virtual bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
30         {
31                 throw new NotImplementedException ();
32         }
33
34         public bool CanConvertTo (Type destinationType)
35         {
36                 return CanConvertTo (null, destinationType);
37         }
38         
39         [MonoTODO]
40         public virtual bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
41         {
42                 throw new NotImplementedException ();
43         }
44
45         public object ConvertFrom (object o)
46         {
47                 return ConvertFrom (null, CultureInfo.CurrentCulture, o);
48         }
49
50         [MonoTODO]
51         public virtual object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
52         {
53                 throw new NotImplementedException ();
54         }
55         
56         public virtual object ConvertFromInvariantString (string text)
57         {
58                 return ConvertFromInvariantString (null, text); 
59         }
60
61         [MonoTODO]
62         public virtual object ConvertFromInvariantString (ITypeDescriptorContext context, string text)
63         {
64                 throw new NotImplementedException ();
65         }
66
67         public object ConvertFromString (string s)
68         {
69                 return ConvertFrom (s);
70         }
71
72         public object ConvertFromString (ITypeDescriptorContext context, string text)
73         {
74                 return ConvertFromString (context, CultureInfo.CurrentCulture, text);
75         }
76
77         [MonoTODO]
78         public object ConvertFromString (ITypeDescriptorContext context, CultureInfo culture, string text)
79         {
80                 throw new NotImplementedException ();
81         }
82
83         [MonoTODO]
84         public object ConvertTo (object value, Type destinationType)
85         {
86                 throw new NotImplementedException ();
87         }
88         [MonoTODO]
89         public virtual object ConvertTo (ITypeDescriptorContext context,
90                                          CultureInfo culture,
91                                          object value,
92                                          Type destinationType)
93         {
94                 throw new NotImplementedException ();
95         }
96
97         [MonoTODO]
98         public string ConvertToInvariantString (object value)
99         {
100                 throw new NotImplementedException ();
101         }
102
103         [MonoTODO]
104         public string ConvertToInvariantString (ITypeDescriptorContext context, object value)
105         {
106                 throw new NotImplementedException ();
107         }
108
109         [MonoTODO]
110         public string ConvertToString (object value)
111         {
112                 throw new NotImplementedException ();
113         }
114
115         [MonoTODO]
116         public string ConvertToString (ITypeDescriptorContext context, object value)
117         {
118                 throw new NotImplementedException ();
119         }
120
121         [MonoTODO]
122         public string ConvertToString (ITypeDescriptorContext context, CultureInfo culture, object value)
123         {
124                 throw new NotImplementedException ();
125         }
126
127         [MonoTODO]
128         public object CreateInstance (IDictionary propertyValues)
129         {
130                 throw new NotImplementedException ();
131         }
132
133         [MonoTODO]
134         public virtual object CreateInstance (ITypeDescriptorContext context, IDictionary propertyValues)
135         {
136                 throw new NotImplementedException ();
137         }
138
139         [MonoTODO]
140         public bool GetCreateInstanceSupported ()
141         {
142                 throw new NotImplementedException ();
143         }
144
145         [MonoTODO]
146         public virtual bool GetCreateInstanceSupported (ITypeDescriptorContext context)
147         {
148                 throw new NotImplementedException ();
149         }
150
151         [MonoTODO]
152         public PropertyDescriptorCollection GetProperties (object value)
153         {
154                 throw new NotImplementedException ();
155         }
156
157         [MonoTODO]
158         public PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, object value)
159         {
160                 throw new NotImplementedException ();
161         }
162
163         [MonoTODO]
164         public virtual PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context,
165                                                                    object value,
166                                                                    Attribute[] attributes)
167         {
168                 throw new NotImplementedException ();
169         }
170
171         [MonoTODO]
172         public bool GetPropertiesSupported ()
173         {
174                 throw new NotImplementedException ();
175         }
176
177         [MonoTODO]
178         public virtual bool GetPropertiesSupported (ITypeDescriptorContext context)
179         {
180                 throw new NotImplementedException ();
181         }
182
183         [MonoTODO]
184         public ICollection GetStandardValues ()
185         {
186                 throw new NotImplementedException ();
187         }
188
189         [MonoTODO]
190         public virtual StandardValuesCollection GetStandardValues (ITypeDescriptorContext context)
191         {
192                 throw new NotImplementedException ();
193         }
194
195         [MonoTODO]
196         public bool GetStandardValuesExclusive ()
197         {
198                 throw new NotImplementedException ();
199         }
200
201         [MonoTODO]
202         public virtual bool GetStandardValuesExclusive (ITypeDescriptorContext context)
203         {
204                 throw new NotImplementedException ();
205         }
206
207         [MonoTODO]
208         public bool GetStandardValuesSupported ()
209         {
210                 throw new NotImplementedException ();
211         }
212
213         [MonoTODO]
214         public virtual bool GetStandardValuesSupported (ITypeDescriptorContext context)
215         {
216                 throw new NotImplementedException ();
217         }
218
219         [MonoTODO]
220         public bool IsValid (object value)
221         {
222                 throw new NotImplementedException ();
223         }
224
225         [MonoTODO]
226         public virtual bool IsValid (ITypeDescriptorContext context, object value)
227         {
228                 throw new NotImplementedException ();
229         }
230
231         //public class StandardValuesCollection : ICollection, IEnumerable
232         public class StandardValuesCollection : IEnumerable
233         {
234                 private ICollection values;
235                 
236                 public StandardValuesCollection (ICollection values)
237                 {
238                         this.values = values;
239                 }
240
241                 public void CopyTo (Array array, int index)
242                 {
243                         values.CopyTo (array, index);
244                 }
245
246                 public IEnumerator GetEnumerator ()
247                 {
248                         return values.GetEnumerator ();
249                 }
250
251                 /*
252                 bool ICollection.IsSynchronized ()
253                 {
254                         return false;
255                 }
256
257                 bool ICollection.SyncRoot ()
258                 {
259                         return false;
260                 }
261
262                 bool ICollection.Count
263                 {
264                         get { return this.Count; }
265                 }
266                 */
267
268                 public int Count
269                 {
270                         get { return values.Count; }
271                 }
272
273                 public object this [int index]
274                 {
275                         get { return ((IList) values) [index]; }
276                 }
277         }
278 }
279 }
280