New test.
[mono.git] / mcs / class / System / System.CodeDom.Compiler / CodeGeneratorOptions.cs
1 //
2 // System.CodeDom.Compiler CodeGeneratorOptions class
3 //
4 // Authors:
5 //      Daniel Stodden (stodden@in.tum.de)
6 //      Sebastien Pouliot  <sebastien@ximian.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;
32 using System.Collections.Specialized;
33 using System.Runtime.InteropServices;
34 using System.Security.Permissions;
35
36 namespace System.CodeDom.Compiler {
37
38         [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
39         public class CodeGeneratorOptions {
40
41                 private IDictionary properties;
42                 
43                 //
44                 // Constructors
45                 //
46                 public CodeGeneratorOptions()
47                 {
48                         properties = new ListDictionary();
49                 }
50
51                 //
52                 // Properties
53                 //
54
55                 /// <summary>
56                 /// Whether to insert blank lines between individual members.
57                 /// Default is true.
58                 /// </summary>
59                 public bool BlankLinesBetweenMembers {
60                         get {
61                                 object o = properties["BlankLinesBetweenMembers"];
62                                 return ((o == null) ? true : (bool) o);
63                         }
64                         set {
65                                 properties["BlankLinesBetweenMembers"] = value;
66                         }
67                 }
68
69                 /// <summary>
70                 /// "Block" puts braces on the same line as the associated statement or declaration.
71                 /// "C" puts braces on the following line.
72                 /// Default is "C"
73                 /// </summary>
74                 public string BracingStyle {
75                         get {
76                                 object o = properties["BracingStyle"];
77                                 return ((o == null) ? "Block" : (string) o);
78                         }
79                         set {
80                                 properties["BracingStyle"] = value;
81                         }
82                 }
83
84                 /// <summary>
85                 /// Whether to start <code>else</code>,
86                 /// <code>catch</code>, or <code>finally</code>
87                 /// blocks on the same line as the previous block.
88                 /// Default is false.
89                 /// </summary>
90                 public bool ElseOnClosing {
91                         get {
92                                 object o = properties["ElseOnClosing"];
93                                 return ((o == null) ? false : (bool) o);
94                         }
95                         set {
96                                 properties["ElseOnClosing"] = value;
97                         }
98                 }
99
100                 /// <summary>
101                 /// The string used for individual indentation levels. Default is four spaces.
102                 /// </summary>
103                 public string IndentString {
104                         get {
105                                 object o = properties["IndentString"];
106                                 return ((o == null) ? "    " : (string) o);
107                         }
108                         set {
109                                 properties["IndentString"] = value;
110                         }
111                 }
112
113                 public Object this[string index] {
114                         get {
115                                 return properties[index];
116                         }
117                         set {
118                                 properties[index] = value;
119                         }
120                 }
121
122 #if NET_2_0
123                 [ComVisible (false)]
124                 public bool VerbatimOrder {
125                         get {
126                                 object o = properties["VerbatimOrder"];
127                                 return ((o == null) ? false : (bool) o);
128                         }
129                         set {
130                                 properties["VerbatimOrder"] = value;
131                         }
132                 }
133 #endif
134         }
135 }