~ubuntu-branches/ubuntu/feisty/monodevelop/feisty

« back to all changes in this revision

Viewing changes to Extras/VBNetBinding/SharpRefactoryVB/src/Parser/AST/TypeLevel/TypeReference.cs

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-08-18 00:51:23 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060818005123-5iit07y0j7wjg55f
Tags: 0.11+svn20060818-0ubuntu1
* New SVN snapshot
  + Works with Gtk# 2.9.0
* debian/control:
  + Updated Build-Depends
* debian/patches/use_nunit2.2.dpatch,
  debian/patches/use_real_libs.dpatch:
  + Updated
* debian/patches/versioncontrol_buildfix.dpatch:
  + Fix build failure in the version control addin

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// TypeReference.cs
2
 
// Copyright (C) 2003 Mike Krueger (mike@icsharpcode.net)
3
 
// 
4
 
// This program is free software; you can redistribute it and/or
5
 
// modify it under the terms of the GNU General Public License
6
 
// as published by the Free Software Foundation; either version 2
7
 
// of the License, or (at your option) any later version.
8
 
// 
9
 
// This program is distributed in the hope that it will be useful,
10
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
// GNU General Public License for more details.
13
 
// 
14
 
// You should have received a copy of the GNU General Public License
15
 
// along with this program; if not, write to the Free Software
16
 
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
 
 
18
 
using System;
19
 
using System.Collections;
20
 
using System.Text;
21
 
using ICSharpCode.SharpRefactory.Parser.VB;
22
 
 
23
 
namespace ICSharpCode.SharpRefactory.Parser.AST.VB
24
 
{
25
 
        public class TypeReference : AbstractNode
26
 
        {
27
 
                string type;
28
 
                string systemType;
29
 
                ArrayList rankSpecifier;
30
 
                ArrayList dimension;
31
 
                AttributeSection attributes = null;
32
 
                
33
 
                static Hashtable types = new Hashtable();
34
 
                static TypeReference()
35
 
                {
36
 
                        types.Add("boolean", "System.Boolean");
37
 
                        types.Add("byte",    "System.Byte");
38
 
                        types.Add("date",        "System.DateTime");
39
 
                        types.Add("char",    "System.Char");
40
 
                        types.Add("decimal", "System.Decimal");
41
 
                        types.Add("double",  "System.Double");
42
 
                        types.Add("single",  "System.Single");
43
 
                        types.Add("integer", "System.Int32");
44
 
                        types.Add("long",    "System.Int64");
45
 
                        types.Add("object",  "System.Object");
46
 
                        types.Add("short",   "System.Int16");
47
 
                        types.Add("string",  "System.String");
48
 
                }
49
 
                
50
 
                public AttributeSection Attributes
51
 
                {
52
 
                        get {
53
 
                                return attributes;
54
 
                        }
55
 
                        set {
56
 
                                attributes = value;
57
 
                        }
58
 
                }
59
 
                
60
 
                public static ICollection PrimitiveTypes
61
 
                {
62
 
                        get {
63
 
                                return types.Keys;
64
 
                        }
65
 
                }
66
 
                
67
 
                public string Type
68
 
                {
69
 
                        get {
70
 
                                return type;
71
 
                        }
72
 
                        set {
73
 
                                type = value;
74
 
                        }
75
 
                }
76
 
                
77
 
                public string SystemType
78
 
                {
79
 
                        get {
80
 
                                return systemType;
81
 
                        }
82
 
                }
83
 
                
84
 
                public ArrayList RankSpecifier
85
 
                {
86
 
                        get {
87
 
                                return rankSpecifier;
88
 
                        }
89
 
                        set {
90
 
                                rankSpecifier = value;
91
 
                        }
92
 
                }
93
 
                
94
 
                public bool IsArrayType
95
 
                {
96
 
                        get {
97
 
                                return rankSpecifier != null && rankSpecifier.Count> 0;
98
 
                        }
99
 
                }
100
 
                
101
 
                public ArrayList Dimension
102
 
                {
103
 
                        get {
104
 
                                return dimension;
105
 
                        }
106
 
                        set {
107
 
                                dimension = value;
108
 
                        }
109
 
                }
110
 
                
111
 
                string GetSystemType(string type)
112
 
                {
113
 
                        return (string)types[type.ToLower()];
114
 
                }
115
 
                
116
 
                public TypeReference(string type)
117
 
                {
118
 
                        this.systemType = GetSystemType(type);
119
 
                        this.type = type;
120
 
                }
121
 
                
122
 
                public TypeReference(string type, ArrayList rankSpecifier)
123
 
                {
124
 
                        this.type = type;
125
 
                        this.systemType = GetSystemType(type);
126
 
                        this.rankSpecifier = rankSpecifier;
127
 
                }
128
 
                
129
 
                public override object AcceptVisitor(IASTVisitor visitor, object data)
130
 
                {
131
 
                        return visitor.Visit(this, data);
132
 
                }
133
 
                
134
 
                public override string ToString()
135
 
                {
136
 
                        return String.Format("[TypeReference: Type={0}, RankSpeifier={1}]", type, AbstractNode.GetCollectionString(rankSpecifier));
137
 
                }
138
 
        }
139
 
}