The Labs \ Source Viewer \ SSCLI \ System.CodeDom.Compiler \ ICodeGenerator

  1. //------------------------------------------------------------------------------
  2. // <copyright file="ICodeGenerator.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.CodeDom.Compiler
  16. {
  17.    
  18.     using System.Diagnostics;
  19.     using System.IO;
  20.     using System.Security.Permissions;
  21.    
  22.     /// <devdoc>
  23.     /// <para>
  24.     /// Provides an
  25.     /// interface for code generation.
  26.     /// </para>
  27.     /// </devdoc>
  28.     public interface ICodeGenerator
  29.     {
  30.         /// <devdoc>
  31.         /// <para>
  32.         /// Gets a value indicating whether
  33.         /// the specified value is a valid identifier for this language.
  34.         /// </para>
  35.         /// </devdoc>
  36.         [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
  37.         [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
  38.         bool IsValidIdentifier(string value);
  39.        
  40.         /// <devdoc>
  41.         /// <para>
  42.         /// Throws an exception if value is not a valid identifier.
  43.         /// </para>
  44.         /// </devdoc>
  45.         [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
  46.         [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
  47.         void ValidateIdentifier(string value);
  48.        
  49.         [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
  50.         [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
  51.         string CreateEscapedIdentifier(string value);
  52.        
  53.         [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
  54.         [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
  55.         string CreateValidIdentifier(string value);
  56.        
  57.         [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
  58.         [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
  59.         string GetTypeOutput(CodeTypeReference type);
  60.        
  61.         [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
  62.         [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
  63.         bool Supports(GeneratorSupport supports);
  64.        
  65.         /// <devdoc>
  66.         /// <para>
  67.         /// Generates code from the specified expression and
  68.         /// outputs it to the specified textwriter.
  69.         /// </para>
  70.         /// </devdoc>
  71.         [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
  72.         [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
  73.         void GenerateCodeFromExpression(CodeExpression e, TextWriter w, CodeGeneratorOptions o);
  74.        
  75.         /// <devdoc>
  76.         /// <para>
  77.         /// Outputs the language specific representaion of the CodeDom tree
  78.         /// refered to by e, into w.
  79.         /// </para>
  80.         /// </devdoc>
  81.         [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
  82.         [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
  83.         void GenerateCodeFromStatement(CodeStatement e, TextWriter w, CodeGeneratorOptions o);
  84.        
  85.         /// <devdoc>
  86.         /// <para>
  87.         /// Outputs the language specific representaion of the CodeDom tree
  88.         /// refered to by e, into w.
  89.         /// </para>
  90.         /// </devdoc>
  91.         [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
  92.         [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
  93.         void GenerateCodeFromNamespace(CodeNamespace e, TextWriter w, CodeGeneratorOptions o);
  94.        
  95.         /// <devdoc>
  96.         /// <para>
  97.         /// Outputs the language specific representaion of the CodeDom tree
  98.         /// refered to by e, into w.
  99.         /// </para>
  100.         /// </devdoc>
  101.         [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
  102.         [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
  103.         void GenerateCodeFromCompileUnit(CodeCompileUnit e, TextWriter w, CodeGeneratorOptions o);
  104.        
  105.         /// <devdoc>
  106.         /// <para>
  107.         /// Outputs the language specific representaion of the CodeDom tree
  108.         /// refered to by e, into w.
  109.         /// </para>
  110.         /// </devdoc>
  111.         [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
  112.         [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
  113.         void GenerateCodeFromType(CodeTypeDeclaration e, TextWriter w, CodeGeneratorOptions o);
  114.        
  115.     }
  116. }

Developer Fusion