CodeGeneratorOptions.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // System.CodeDom.Compiler CodeGeneratorOptions class
  3. //
  4. // Author:
  5. // Daniel Stodden ([email protected])
  6. //
  7. // (C) 2002 Ximian, Inc.
  8. //
  9. using System;
  10. using System.Collections;
  11. using System.Collections.Specialized;
  12. namespace System.CodeDom.Compiler
  13. {
  14. public class CodeGeneratorOptions
  15. {
  16. private IDictionary properties;
  17. //
  18. // Constructors
  19. //
  20. public CodeGeneratorOptions()
  21. {
  22. properties = new ListDictionary();
  23. properties.Add( "BlankLinesBetweenMembers", true );
  24. properties.Add( "BracingStyle", "Block" );
  25. properties.Add( "ElseOnClosing", false );
  26. properties.Add( "IndentString", " " );
  27. }
  28. //
  29. // Properties
  30. //
  31. /// <summary>
  32. /// Whether to insert blank lines between individual members.
  33. /// Default is true.
  34. /// </summary>
  35. public bool BlankLinesBetweenMembers {
  36. get {
  37. return (bool)properties["BlankLinesBetweenMembers"];
  38. }
  39. set {
  40. properties["BlankLinesBetweenMembers"] = value;
  41. }
  42. }
  43. /// <summary>
  44. /// "Block" puts braces on the same line as the associated statement or declaration.
  45. /// "C" puts braces on the following line.
  46. /// Default is "C"
  47. /// </summary>
  48. public string BracingStyle {
  49. get {
  50. return (string)properties["BracingStyle"];
  51. }
  52. set {
  53. properties["BracingStyle"] = value;
  54. }
  55. }
  56. /// <summary>
  57. /// Whether to start <code>else</code>,
  58. /// <code>catch</code>, or <code>finally</code>
  59. /// blocks on the same line as the previous block.
  60. /// Default is false.
  61. /// </summary>
  62. public bool ElseOnClosing {
  63. get {
  64. return (bool)properties["ElseOnClosing"];
  65. }
  66. set {
  67. properties["ElseOnClosing"] = value;
  68. }
  69. }
  70. /// <summary>
  71. /// The string used for individual indentation levels. Default is four spaces.
  72. /// </summary>
  73. public string IndentString {
  74. get {
  75. return (string)properties["IndentString"];
  76. }
  77. set {
  78. properties["IndentString"] = value;
  79. }
  80. }
  81. public Object this[string index] {
  82. get {
  83. return properties[index];
  84. }
  85. set {
  86. properties[index] = value;
  87. }
  88. }
  89. }
  90. }