In System.IO:
[mono.git] / mcs / class / corlib / System.Diagnostics / DebuggerVisualizerAttribute.cs
1 //
2 // System.Diagnostics.DebuggerVisualizerAttribute.cs
3 //
4 // Author:
5 //   Chris Toshok (toshok@novell.com)
6 //
7
8 //
9 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
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
33 #if NET_2_0
34 using System.Runtime.InteropServices;
35 #endif
36
37 namespace System.Diagnostics {
38
39         [AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple=true)]
40 #if NET_2_0
41         [ComVisible (true)]
42         public sealed class DebuggerVisualizerAttribute : Attribute
43 #else
44         internal sealed class DebuggerVisualizerAttribute : Attribute
45 #endif
46         {
47                 public DebuggerVisualizerAttribute(string visualizerSourceName) {
48                         this.visualizerSourceName = visualizerSourceName;
49                 }
50
51                 public DebuggerVisualizerAttribute(Type visualizerSource) {
52                         this.visualizerSource = visualizerSource;
53                         this.visualizerSourceName = visualizerSource.AssemblyQualifiedName;
54                 }
55
56                 public DebuggerVisualizerAttribute(string visualizerName, string visualizerSourceName) {
57                         this.visualizerName = visualizerName;
58                         this.visualizerSourceName = visualizerSourceName;
59                 }
60
61 #if NET_2_0
62                 public DebuggerVisualizerAttribute (string visualizerTypeName,
63                                                     Type visualizerObjectSource)
64                 {
65                         this.visualizerName = visualizerTypeName;
66                         this.visualizerSource = visualizerObjectSource;
67                         this.visualizerSourceName = visualizerObjectSource.AssemblyQualifiedName;
68                 }
69 #endif
70
71                 public DebuggerVisualizerAttribute(Type visualizer, string visualizerSourceName) {
72                         this.visualizerSourceName = visualizerSourceName;
73                         this.visualizer = visualizer;
74                         this.visualizerName = visualizer.AssemblyQualifiedName;
75                 }
76
77                 public DebuggerVisualizerAttribute(Type visualizer, Type visualizerSource) {
78                         this.visualizer = visualizer;
79                         this.visualizerName = visualizer.AssemblyQualifiedName;
80                         this.visualizerSource = visualizerSource;
81                         this.visualizerSourceName = visualizerSource.AssemblyQualifiedName;
82                 }
83
84                 public string Description {
85                         get {
86                                 return description;
87                         }
88                         set {
89                                 description = value;
90                         }
91                 }
92
93                 public Type Target {
94                         get {
95                                 return target;
96                         }
97                         set {
98                                 target = value;
99                                 targetTypeName = target.AssemblyQualifiedName;
100                         }
101                 }
102
103                 public string TargetTypeName {
104                         get {
105                                 return targetTypeName;
106                         }
107                         set {
108                                 targetTypeName = value;
109                         }
110                 }
111
112                 // Debugged program-side type
113                 public string VisualizerObjectSourceTypeName {
114                         get {
115                                 return visualizerSourceName;
116                         }
117                 }
118
119                 // Debugger-side type
120                 public string VisualizerTypeName {
121                         get {
122                                 return visualizerName;
123                         }
124                 }
125
126                 string description;
127                 string visualizerSourceName;
128                 Type visualizerSource;
129                 string visualizerName;
130                 Type visualizer;
131
132                 string targetTypeName;
133                 Type target;
134         }
135
136 }