set svn:eol-style to native and converted several files to unix line ending
[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 using System.Runtime.InteropServices;
33
34 namespace System.Diagnostics
35 {
36         [AttributeUsageAttribute(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple=true)]
37 #if NET_2_0
38         [ComVisible (true)]
39         public sealed class DebuggerVisualizerAttribute : Attribute
40 #else
41         internal sealed class DebuggerVisualizerAttribute : Attribute
42 #endif
43         {
44                 private string description;
45                 private string visualizerSourceName;
46                 private string visualizerName;
47                 private string targetTypeName;
48                 private Type target;
49
50                 public DebuggerVisualizerAttribute (string visualizerTypeName)
51                 {
52                         this.visualizerName = visualizerTypeName;
53                 }
54
55                 public DebuggerVisualizerAttribute (Type visualizer)
56                 {
57                         if (visualizer == null)
58                                 throw new ArgumentNullException ("visualizer");
59
60                         this.visualizerName = visualizer.AssemblyQualifiedName;
61                 }
62
63                 public DebuggerVisualizerAttribute (string visualizerTypeName, string visualizerObjectSourceTypeName)
64                 {
65                         this.visualizerName = visualizerTypeName;
66                         this.visualizerSourceName = visualizerObjectSourceTypeName;
67                 }
68
69                 public DebuggerVisualizerAttribute (string visualizerTypeName, Type visualizerObjectSource)
70                 {
71                         if (visualizerObjectSource == null)
72                                 throw new ArgumentNullException ("visualizerObjectSource");
73
74                         this.visualizerName = visualizerTypeName;
75                         this.visualizerSourceName = visualizerObjectSource.AssemblyQualifiedName;
76                 }
77
78                 public DebuggerVisualizerAttribute (Type visualizer, string visualizerObjectSourceTypeName)
79                 {
80                         if (visualizer == null)
81                                 throw new ArgumentNullException ("visualizer");
82
83                         this.visualizerName = visualizer.AssemblyQualifiedName;
84                         this.visualizerSourceName = visualizerObjectSourceTypeName;
85                 }
86
87                 public DebuggerVisualizerAttribute (Type visualizer, Type visualizerObjectSource)
88                 {
89                         if (visualizer == null)
90                                 throw new ArgumentNullException ("visualizer");
91                         if (visualizerObjectSource == null)
92                                 throw new ArgumentNullException ("visualizerObjectSource");
93
94                         this.visualizerName = visualizer.AssemblyQualifiedName;
95                         this.visualizerSourceName = visualizerObjectSource.AssemblyQualifiedName;
96                 }
97
98                 public string Description {
99                         get {
100                                 return description;
101                         }
102                         set {
103                                 description = value;
104                         }
105                 }
106
107                 public Type Target {
108                         get {
109                                 return target;
110                         }
111                         set {
112                                 target = value;
113                                 targetTypeName = target.AssemblyQualifiedName;
114                         }
115                 }
116
117                 public string TargetTypeName {
118                         get {
119                                 return targetTypeName;
120                         }
121                         set {
122                                 targetTypeName = value;
123                         }
124                 }
125
126                 // Debugged program-side type
127                 public string VisualizerObjectSourceTypeName {
128                         get {
129                                 return visualizerSourceName;
130                         }
131                 }
132
133                 // Debugger-side type
134                 public string VisualizerTypeName {
135                         get {
136                                 return visualizerName;
137                         }
138                 }
139         }
140 }