CodeGeneratorOptions.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //
  2. // System.CodeDom.Compiler CodeGeneratorOptions class
  3. //
  4. // Author:
  5. // Daniel Stodden ([email protected])
  6. //
  7. // (C) 2002 Ximian, Inc.
  8. //
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. using System;
  30. using System.Collections;
  31. using System.Collections.Specialized;
  32. namespace System.CodeDom.Compiler
  33. {
  34. public class CodeGeneratorOptions
  35. {
  36. private IDictionary properties;
  37. //
  38. // Constructors
  39. //
  40. public CodeGeneratorOptions()
  41. {
  42. properties = new ListDictionary();
  43. properties.Add( "BlankLinesBetweenMembers", true );
  44. properties.Add( "BracingStyle", "Block" );
  45. properties.Add( "ElseOnClosing", false );
  46. properties.Add( "IndentString", " " );
  47. }
  48. //
  49. // Properties
  50. //
  51. /// <summary>
  52. /// Whether to insert blank lines between individual members.
  53. /// Default is true.
  54. /// </summary>
  55. public bool BlankLinesBetweenMembers {
  56. get {
  57. return (bool)properties["BlankLinesBetweenMembers"];
  58. }
  59. set {
  60. properties["BlankLinesBetweenMembers"] = value;
  61. }
  62. }
  63. /// <summary>
  64. /// "Block" puts braces on the same line as the associated statement or declaration.
  65. /// "C" puts braces on the following line.
  66. /// Default is "C"
  67. /// </summary>
  68. public string BracingStyle {
  69. get {
  70. return (string)properties["BracingStyle"];
  71. }
  72. set {
  73. properties["BracingStyle"] = value;
  74. }
  75. }
  76. /// <summary>
  77. /// Whether to start <code>else</code>,
  78. /// <code>catch</code>, or <code>finally</code>
  79. /// blocks on the same line as the previous block.
  80. /// Default is false.
  81. /// </summary>
  82. public bool ElseOnClosing {
  83. get {
  84. return (bool)properties["ElseOnClosing"];
  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. return (string)properties["IndentString"];
  96. }
  97. set {
  98. properties["IndentString"] = value;
  99. }
  100. }
  101. public Object this[string index] {
  102. get {
  103. return properties[index];
  104. }
  105. set {
  106. properties[index] = value;
  107. }
  108. }
  109. }
  110. }