2 // (C) Sergey Chaban (serge@wildwestsoftware.com)
5 using System
.Collections
;
6 using System
.Reflection
;
12 // maps default types to their library equivalents
13 private static Hashtable defaultTypes
;
14 private static readonly object dummy
;
15 private Hashtable userTypes
;
19 dummy
= new Object ();
21 defaultTypes
= new Hashtable ();
22 Hashtable t
= defaultTypes
;
24 t
["object"] = Type
.GetType ("System.Object");
25 t
["string"] = Type
.GetType ("System.String");
26 t
["char"] = Type
.GetType ("System.Char");
27 t
["void"] = Type
.GetType ("System.Void");
28 t
["bool"] = Type
.GetType ("System.Boolean");
29 t
["int8"] = Type
.GetType ("System.Byte");
30 t
["int16"] = Type
.GetType ("System.Int16");
31 t
["int32"] = Type
.GetType ("System.Int32");
32 t
["int64"] = Type
.GetType ("System.Int64");
33 t
["float32"] = Type
.GetType ("System.Single");
34 t
["float64"] = Type
.GetType ("System.Double");
35 t
["uint8"] = Type
.GetType ("System.SByte");
36 t
["uint16"] = Type
.GetType ("System.UInt16");
37 t
["uint32"] = Type
.GetType ("System.UInt32");
38 t
["uint64"] = Type
.GetType ("System.UInt64");
51 /// <param name="typeName"></param>
52 /// <returns></returns>
53 public Type
Lookup (string typeName
)
55 Type res
= defaultTypes
[typeName
] as Type
;
62 /// <param name="name"></param>
63 /// <param name="type"></param>
64 public void Add (string name
, Type type
)
66 if (defaultTypes
.Contains (name
)) return;
68 if (userTypes
== null) userTypes
= new Hashtable ();
69 userTypes
[name
] = (type
!= null) ? type
: dummy
;
75 /// <param name="name"></param>
76 public void Add (string name
){