2006-01-10 Cesar Lopez Nataren <cnataren@novell.com>
[mono.git] / mcs / class / Microsoft.JScript / Microsoft.JScript / JSFieldInfo.cs
1 //
2 // JSFieldInfo.cs:
3 //
4 // Author:
5 //      Cesar Lopez Nataren (cesar@ciencias.unam.mx)
6 //
7 // (C) 2003, Cesar Lopez Nataren
8 //
9
10 //
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.
29 //
30
31 using System;
32 using System.Reflection;
33 using System.Globalization;
34
35 namespace Microsoft.JScript {
36
37         public sealed class JSFieldInfo : FieldInfo {
38
39                 private FieldAttributes attr;
40                 private string name;
41                 private object value;
42
43                 internal JSFieldInfo (string name)
44                 {
45                         this.name = name;
46                 }
47
48                 public override FieldAttributes Attributes {
49                         get { return attr; }
50                 }
51
52
53                 public override Type DeclaringType {
54                         get { throw new NotImplementedException (); }
55                 }
56
57
58                 public override RuntimeFieldHandle FieldHandle {
59                         get { throw new NotImplementedException (); }
60                 }
61
62
63                 public override Type FieldType {
64                         get { throw new NotImplementedException (); }
65                 }
66
67
68                 public override object [] GetCustomAttributes (Type t, bool inherit)
69                 {
70                         throw new NotImplementedException ();
71                 }
72
73         
74                 public override object [] GetCustomAttributes (bool inherit)
75                 {
76                         throw new NotImplementedException ();
77                 }
78
79
80                 public override object GetValue (object obj)
81                 {
82                         string str_name = Convert.ToString (obj);
83
84                         if (str_name == name)
85                                 return value;
86                         else
87                                 throw new NotImplementedException ();
88                 }
89
90
91                 public override bool IsDefined (Type type, bool inherit)
92                 {
93                         throw new NotImplementedException ();
94                 }
95
96
97                 public override MemberTypes MemberType {
98                         get { throw new NotImplementedException (); }
99                 }
100
101
102                 public override string Name {
103                         get { return name; }
104                 }
105
106
107                 public override Type ReflectedType {
108                         get { throw new NotImplementedException (); }
109                 }
110
111
112                 public new void SetValue (object obj, object value)
113                 {
114                         string str_name = Convert.ToString (obj);
115                         if (str_name == name)
116                                 this.value = value;
117                         else {
118                                 Console.WriteLine ("arg {0} != name {1}", str_name, name);
119                                 throw new NotImplementedException ();
120                         }
121                 }
122
123
124                 public override void SetValue (object obj, object value, BindingFlags invokeAttr,
125                                                System.Reflection.Binder binder, CultureInfo culture)
126                 {
127                         SetValue (obj, value);
128                 }
129
130 #if NET_2_0 || BOOTSTRAP_NET_2_0
131                 public override FieldInfo Mono_GetGenericFieldDefinition ()
132                 {
133                         throw new NotImplementedException ();
134                 }
135 #endif
136         }
137 }