2 // System.CodeDom.Compiler CodeGeneratorOptions class
5 // Daniel Stodden (stodden@in.tum.de)
7 // (C) 2002 Ximian, Inc.
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:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
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.
32 using System.Collections;
33 using System.Collections.Specialized;
35 namespace System.CodeDom.Compiler
37 public class CodeGeneratorOptions
39 private IDictionary properties;
44 public CodeGeneratorOptions()
46 properties = new ListDictionary();
47 properties.Add( "BlankLinesBetweenMembers", true );
48 properties.Add( "BracingStyle", "Block" );
49 properties.Add( "ElseOnClosing", false );
50 properties.Add( "IndentString", " " );
58 /// Whether to insert blank lines between individual members.
61 public bool BlankLinesBetweenMembers {
63 return (bool)properties["BlankLinesBetweenMembers"];
66 properties["BlankLinesBetweenMembers"] = value;
71 /// "Block" puts braces on the same line as the associated statement or declaration.
72 /// "C" puts braces on the following line.
75 public string BracingStyle {
77 return (string)properties["BracingStyle"];
80 properties["BracingStyle"] = value;
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.
90 public bool ElseOnClosing {
92 return (bool)properties["ElseOnClosing"];
95 properties["ElseOnClosing"] = value;
100 /// The string used for individual indentation levels. Default is four spaces.
102 public string IndentString {
104 return (string)properties["IndentString"];
107 properties["IndentString"] = value;
111 public Object this[string index] {
113 return properties[index];
116 properties[index] = value;