CodeGeneratorOptions.cs 3.5 KB

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