This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / mcs / class / System / System.CodeDom.Compiler / CodeGeneratorOptions.cs
1 //
2 // System.CodeDom.Compiler CodeGeneratorOptions class
3 //
4 // Author:
5 //   Daniel Stodden (stodden@in.tum.de)
6 //
7 // (C) 2002 Ximian, Inc.
8 //
9
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.Collections;
33 using System.Collections.Specialized;
34
35 namespace System.CodeDom.Compiler
36 {
37         public class CodeGeneratorOptions
38         {
39                 private IDictionary properties;
40                 
41                 //
42                 // Constructors
43                 //
44                 public CodeGeneratorOptions()
45                 {
46                         properties = new ListDictionary();
47                         properties.Add( "BlankLinesBetweenMembers", true );
48                         properties.Add( "BracingStyle", "Block" );
49                         properties.Add( "ElseOnClosing", false );
50                         properties.Add( "IndentString", "    " );
51                 }
52
53                 //
54                 // Properties
55                 //
56
57                 /// <summary>
58                 /// Whether to insert blank lines between individual members.
59                 /// Default is true.
60                 /// </summary>
61                 public bool BlankLinesBetweenMembers {
62                         get {
63                                 return (bool)properties["BlankLinesBetweenMembers"];
64                         }
65                         set {
66                                 properties["BlankLinesBetweenMembers"] = value;
67                         }
68                 }
69
70                 /// <summary>
71                 /// "Block" puts braces on the same line as the associated statement or declaration.
72                 /// "C" puts braces on the following line.
73                 /// Default is "C"
74                 /// </summary>
75                 public string BracingStyle {
76                         get {
77                                 return (string)properties["BracingStyle"];
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                                 return (bool)properties["ElseOnClosing"];
93                         }
94                         set {
95                                 properties["ElseOnClosing"] = value;
96                         }
97                 }
98
99                 /// <summary>
100                 /// The string used for individual indentation levels. Default is four spaces.
101                 /// </summary>
102                 public string IndentString {
103                         get {
104                                 return (string)properties["IndentString"];
105                         }
106                         set {
107                                 properties["IndentString"] = value;
108                         }
109                 }
110
111                 public Object this[string index] {
112                         get {
113                                 return properties[index];
114                         }
115                         set {
116                                 properties[index] = value;
117                         }
118                 }
119         }
120 }