* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / System / System.CodeDom.Compiler / CompilerResults.cs
1 //
2 // System.CodeDom.Compiler.CompilerResults.cs
3 //
4 // Authors:
5 //   Daniel Stodden (stodden@in.tum.de)
6 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
7 //
8 // (C) 2002 Ximian, Inc.
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.Collections.Specialized;
32 using System.Reflection;
33 using System.Security.Permissions;
34 using System.Security.Policy;
35
36 namespace System.CodeDom.Compiler {
37
38 #if NET_2_0
39         [Serializable]
40 #endif
41         [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
42         [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
43         public class CompilerResults {
44
45                 private Assembly compiledAssembly;
46                 private CompilerErrorCollection errors = new CompilerErrorCollection ();
47 #if NET_1_1
48                 private Evidence evidence;
49 #endif
50                 private int nativeCompilerReturnValue = 0;
51                 private StringCollection output = new StringCollection ();
52                 private string pathToAssembly;
53                 private TempFileCollection tempFiles;
54                 
55                 //
56                 // Constructors
57                 //
58                 public CompilerResults (TempFileCollection tempFiles)
59                 {
60                         this.tempFiles = tempFiles;
61                 }
62
63                 //
64                 // Properties
65                 //
66                 public Assembly CompiledAssembly {
67                         get {
68                                 if ((compiledAssembly == null) && (pathToAssembly != null))
69                                         compiledAssembly = Assembly.LoadFrom (pathToAssembly);
70                                 return compiledAssembly;
71                         }
72                         set {
73                                 compiledAssembly = value;
74                         }
75                 }
76
77                 public CompilerErrorCollection Errors {
78                         get {
79                                 if (errors == null)
80                                         errors = new CompilerErrorCollection();
81                                 return errors;
82                         }
83                 }
84
85 #if NET_1_1
86                 public Evidence Evidence {
87                         get { return evidence; }
88                         [SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
89                         set { evidence = value; }
90                 }
91 #endif
92
93                 public int NativeCompilerReturnValue {
94                         get {
95                                 return nativeCompilerReturnValue;
96                         }
97                         set {
98                                 nativeCompilerReturnValue = value;
99                         }
100                 }
101
102                 public StringCollection Output {
103                         get {
104                                 if (output == null)
105                                         output = new StringCollection();
106                                 return output;
107                         }
108                 }
109
110                 public string PathToAssembly {
111                         get {
112                                 return pathToAssembly;
113                         }
114                         set {
115                                 pathToAssembly = value;
116                         }
117                 }
118
119                 public TempFileCollection TempFiles {
120                         get {
121                                 return tempFiles;
122                         }
123                         set {
124                                 tempFiles = value;
125                         }
126                 }
127         }
128 }