2005-10-24 Sebastien Pouliot <sebastien@ximian.com>
[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                                 return compiledAssembly;
69                         }
70                         set {
71                                 compiledAssembly = value;
72                         }
73                 }
74
75                 public CompilerErrorCollection Errors {
76                         get {
77                                 if (errors == null)
78                                         errors = new CompilerErrorCollection();
79                                 return errors;
80                         }
81                 }
82
83 #if NET_1_1
84                 public Evidence Evidence {
85                         get { return evidence; }
86                         [SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
87                         set { evidence = value; }
88                 }
89 #endif
90
91                 public int NativeCompilerReturnValue {
92                         get {
93                                 return nativeCompilerReturnValue;
94                         }
95                         set {
96                                 nativeCompilerReturnValue = value;
97                         }
98                 }
99
100                 public StringCollection Output {
101                         get {
102                                 if (output == null)
103                                         output = new StringCollection();
104                                 return output;
105                         }
106                 }
107
108                 public string PathToAssembly {
109                         get {
110                                 return pathToAssembly;
111                         }
112                         set {
113                                 pathToAssembly = value;
114                         }
115                 }
116
117                 public TempFileCollection TempFiles {
118                         get {
119                                 return tempFiles;
120                         }
121                         set {
122                                 tempFiles = value;
123                         }
124                 }
125         }
126 }