New test.
[mono.git] / mcs / class / System / System.CodeDom.Compiler / CodeGeneratorOptions.cs
index e89628dd8af72dfed4ae6286d50f3b532bc839b2..ae79018906fc1d0856ed0ab8a58d84f51f4bd790 100644 (file)
@@ -1,12 +1,12 @@
 //
 // System.CodeDom.Compiler CodeGeneratorOptions class
 //
-// Author:
-//   Daniel Stodden (stodden@in.tum.de)
+// Authors:
+//     Daniel Stodden (stodden@in.tum.de)
+//     Sebastien Pouliot  <sebastien@ximian.com>
 //
 // (C) 2002 Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Collections;
 using System.Collections.Specialized;
+using System.Runtime.InteropServices;
+using System.Security.Permissions;
+
+namespace System.CodeDom.Compiler {
+
+       [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
+       public class CodeGeneratorOptions {
 
-namespace System.CodeDom.Compiler
-{
-       public class CodeGeneratorOptions
-       {
                private IDictionary properties;
                
                //
@@ -44,10 +46,6 @@ namespace System.CodeDom.Compiler
                public CodeGeneratorOptions()
                {
                        properties = new ListDictionary();
-                       properties.Add( "BlankLinesBetweenMembers", true );
-                       properties.Add( "BracingStyle", "Block" );
-                       properties.Add( "ElseOnClosing", false );
-                       properties.Add( "IndentString", "    " );
                }
 
                //
@@ -60,7 +58,8 @@ namespace System.CodeDom.Compiler
                /// </summary>
                public bool BlankLinesBetweenMembers {
                        get {
-                               return (bool)properties["BlankLinesBetweenMembers"];
+                               object o = properties["BlankLinesBetweenMembers"];
+                               return ((o == null) ? true : (bool) o);
                        }
                        set {
                                properties["BlankLinesBetweenMembers"] = value;
@@ -74,7 +73,8 @@ namespace System.CodeDom.Compiler
                /// </summary>
                public string BracingStyle {
                        get {
-                               return (string)properties["BracingStyle"];
+                               object o = properties["BracingStyle"];
+                               return ((o == null) ? "Block" : (string) o);
                        }
                        set {
                                properties["BracingStyle"] = value;
@@ -89,7 +89,8 @@ namespace System.CodeDom.Compiler
                /// </summary>
                public bool ElseOnClosing {
                        get {
-                               return (bool)properties["ElseOnClosing"];
+                               object o = properties["ElseOnClosing"];
+                               return ((o == null) ? false : (bool) o);
                        }
                        set {
                                properties["ElseOnClosing"] = value;
@@ -101,7 +102,8 @@ namespace System.CodeDom.Compiler
                /// </summary>
                public string IndentString {
                        get {
-                               return (string)properties["IndentString"];
+                               object o = properties["IndentString"];
+                               return ((o == null) ? "    " : (string) o);
                        }
                        set {
                                properties["IndentString"] = value;
@@ -116,5 +118,18 @@ namespace System.CodeDom.Compiler
                                properties[index] = value;
                        }
                }
+
+#if NET_2_0
+               [ComVisible (false)]
+               public bool VerbatimOrder {
+                       get {
+                               object o = properties["VerbatimOrder"];
+                               return ((o == null) ? false : (bool) o);
+                       }
+                       set {
+                               properties["VerbatimOrder"] = value;
+                       }
+               }
+#endif
        }
 }